Merge branch 'master' of http://192.168.30.2:3000/bonus/bonus-material-app
This commit is contained in:
commit
36566b7ee1
|
|
@ -32,8 +32,8 @@
|
|||
@clear="clearPro"
|
||||
></eselect>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料人员:" name="backPerson">
|
||||
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入退料人" />
|
||||
<uni-forms-item label="制单人员:" name="backPerson">
|
||||
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入制单人" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="联系电话:" name="phone">
|
||||
<uni-easyinput v-model="phone" maxlength="11" placeholder="请输入联系电话" />
|
||||
|
|
@ -166,7 +166,7 @@ const confirmAdd = () => {
|
|||
if (agreementId.value == '') {
|
||||
uni.showToast({ title: '请确认退料单位,退料工程!', icon: 'none' })
|
||||
} else if (backPerson.value == '') {
|
||||
uni.showToast({ title: '请确认退料人!', icon: 'none' })
|
||||
uni.showToast({ title: '请确认制单人!', icon: 'none' })
|
||||
} else if (phone.value == '') {
|
||||
uni.showToast({ title: '请确认联系电话!', icon: 'none' })
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
taskInfo.code
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料人员:" name="backPerson">
|
||||
<uni-forms-item label="制单人员:" name="backPerson">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.backPerson
|
||||
}}</span>
|
||||
|
|
@ -83,23 +83,22 @@
|
|||
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
|
||||
<radio-group @change="changeRadio">
|
||||
<radio value="完好" checked style="margin-right: 5px">完好</radio>
|
||||
<radio value="损坏">损坏</radio>
|
||||
<radio value="不合格">不合格</radio>
|
||||
</radio-group>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">附件:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
|
||||
<div class="upload" @click="uploadImg" v-else>
|
||||
<image
|
||||
:src="imgBeseUrl"
|
||||
style="width: 160rpx; height: 160rpx"
|
||||
mode=""
|
||||
></image>
|
||||
</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="4">附件:</uni-col>
|
||||
<uni-col :span="20">
|
||||
<div class="upload-container">
|
||||
<div class="upload" @click="uploadImg" v-if="imgList.length < 3">+</div>
|
||||
<div class="image-preview" v-for="(img, index) in imgList" :key="index">
|
||||
<image :src="img.url" mode="aspectFill"></image>
|
||||
<view class="delete-btn" @click.stop="deleteImage(index)">×</view>
|
||||
</div>
|
||||
</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</div>
|
||||
|
||||
<div class="btn">
|
||||
|
|
@ -124,7 +123,8 @@ const typeId = ref('') //类型id
|
|||
const maStatusName = ref('') //状态
|
||||
const apDetection = ref('完好') //外观判定
|
||||
const imgBeseUrl = ref('') //图片展示
|
||||
const bmFileInfos = ref([]) //图片数组
|
||||
const imgList = ref([]) // 图片列表,用于回显
|
||||
const bmFileInfos = ref([]) // 上传后的图片信息
|
||||
const scanQrCodeRef = ref(null)
|
||||
|
||||
const changeRadio = (e) => {
|
||||
|
|
@ -292,7 +292,7 @@ const submitCode = () => {
|
|||
typeId: typeId.value,
|
||||
apDetection: apDetection.value,
|
||||
goodNum: apDetection.value == '完好' ? 1 : 0,
|
||||
badNum: apDetection.value == '损坏' ? 1 : 0,
|
||||
badNum: apDetection.value == '不合格' ? 1 : 0,
|
||||
bmFileInfos: bmFileInfos.value,
|
||||
}
|
||||
let param = {
|
||||
|
|
@ -329,46 +329,76 @@ const submitCode = () => {
|
|||
|
||||
//上传
|
||||
const uploadImg = () => {
|
||||
uni.chooseImage({
|
||||
count: 1, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('本地地址', imgFiles)
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: '/file/upload', //h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res.code)
|
||||
console.log('上传成功', res.data)
|
||||
if (res.code && res.code == 200) {
|
||||
let obj = {
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
taskType: '10',
|
||||
}
|
||||
// console.log(obj)
|
||||
bmFileInfos.value = [obj]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
bmFileInfos.value = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
},
|
||||
})
|
||||
// this.$refs.vForm.clearValidate()
|
||||
},
|
||||
})
|
||||
uni.chooseImage({
|
||||
count: 3 - imgList.value.length, // 最多选择3张,减去已选数量
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async (res) => {
|
||||
const tempFiles = res.tempFiles
|
||||
if (imgList.value.length + tempFiles.length > 3) {
|
||||
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 显示选择的图片
|
||||
for (let i = 0; i < tempFiles.length; i++) {
|
||||
imgList.value.push({
|
||||
url: tempFiles[i].path,
|
||||
uploading: true
|
||||
})
|
||||
}
|
||||
|
||||
// 上传所有图片
|
||||
const uploadPromises = tempFiles.map(file => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: '/file/upload',
|
||||
filePath: file.path,
|
||||
name: 'file',
|
||||
success: (uploadRes) => {
|
||||
const resData = JSON.parse(uploadRes.data)
|
||||
if (resData.code === 200) {
|
||||
resolve({
|
||||
name: resData.data.name,
|
||||
url: resData.data.url,
|
||||
taskType: '10'
|
||||
})
|
||||
} else {
|
||||
reject(new Error('上传失败'))
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
try {
|
||||
const results = await Promise.all(uploadPromises)
|
||||
bmFileInfos.value = [...bmFileInfos.value, ...results]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
|
||||
// 更新图片状态
|
||||
imgList.value = imgList.value.map(img => {
|
||||
return {
|
||||
...img,
|
||||
uploading: false
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
|
||||
// 移除上传失败的图片
|
||||
imgList.value = imgList.value.filter(img => !img.uploading)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片
|
||||
const deleteImage = (index) => {
|
||||
imgList.value.splice(index, 1)
|
||||
bmFileInfos.value.splice(index, 1)
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
|
|
@ -379,6 +409,70 @@ onLoad((options) => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 在style部分添加 */
|
||||
.upload-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.uploading-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-radio-input {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -47,7 +47,7 @@
|
|||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<span>{{item.apDetection}}</span>
|
||||
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
|
||||
<!-- <span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span> -->
|
||||
<!-- <span>{{ item.goodNum == 1 ? '完好' : '不合格' }}</span> -->
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
<uni-th width="90px" style="font-size: 24rpx;" align="center">退料数</uni-th>
|
||||
<!-- <uni-th width="90px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">不合格数量</uni-th>
|
||||
<uni-th width="70px" style="font-size: 24rpx;" align="center">操作</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="损坏数量"
|
||||
placeholder="不合格数量"
|
||||
v-model="item.badNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
|
|
@ -314,9 +314,9 @@ const changeNum = (row) => {
|
|||
// 不能大于preNum
|
||||
if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
|
||||
console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
|
||||
// this.$message.error('完好数量和损坏数量之和不能大于退料数量')
|
||||
// this.$message.error('完好数量和不合格数量之和不能大于退料数量')
|
||||
uni.showToast({
|
||||
title: '完好数量和损坏数量之和不能大于退料数量',
|
||||
title: '完好数量和不合格数量之和不能大于退料数量',
|
||||
icon: 'none',
|
||||
})
|
||||
row.badNum = 0
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<uni-forms-item label="退料单号:" name="code">
|
||||
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料人员:" name="backPerson">
|
||||
<uni-forms-item label="制单人员:" name="backPerson">
|
||||
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料电话:" name="phone">
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<uni-th width="80px" style="font-size: 24rpx;" align="center">退料数</uni-th>
|
||||
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">不合格数量</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
<uni-tr v-for="(item,index) in typeList" :key="item.id">
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="8">退料人:</uni-col>
|
||||
<uni-col :span="8">制单人:</uni-col>
|
||||
<uni-col :span="16"
|
||||
><div class="cont">{{ item.backPerson }}</div></uni-col
|
||||
>
|
||||
|
|
|
|||
|
|
@ -619,9 +619,9 @@ const changeNum = (row) => {
|
|||
// // 不能大于preNum
|
||||
// if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
|
||||
// console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
|
||||
// // this.$message.error('完好数量和损坏数量之和不能大于退料数量')
|
||||
// // this.$message.error('完好数量和不合格数量之和不能大于退料数量')
|
||||
// uni.showToast({
|
||||
// title: '完好数量和损坏数量之和不能大于退料数量',
|
||||
// title: '完好数量和不合格数量之和不能大于退料数量',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// row.badNum = 0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,690 @@
|
|||
<template>
|
||||
<!-- 数量出库 -->
|
||||
<view class="page-container">
|
||||
<view class="table-list-item">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">物资名称:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ queryParams.typeName }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">物资类型:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ queryParams.type }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">设备编码:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ selectedCodesDisplay }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<uni-row
|
||||
:gutter="24"
|
||||
class="search-form"
|
||||
style="background: #fff; padding: 10px; margin: 5px; border-radius: 5px"
|
||||
>
|
||||
<uni-col :span="6">
|
||||
<view class="btnBox complete" @click="saveCode"> 维修完成 </view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<scroll-view scroll-y style="padding-bottom: 20rpx">
|
||||
<!-- -->
|
||||
<view class="table-list-item">
|
||||
<!-- 维修人员 -->
|
||||
<h2 style="padding: 4rpx 0; font-weight: bold">维修信息</h2>
|
||||
<uni-forms ref="baseForm" label-align="right">
|
||||
<uni-forms-item label="维修人员">
|
||||
<uni-data-select
|
||||
:localdata="repairPersonData"
|
||||
v-model="repairPerson"
|
||||
placeholder="请选择维修人员"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注">
|
||||
<uni-easyinput placeholder="请填写备注" maxlength="50" v-model="remark" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="附件">
|
||||
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
|
||||
<div class="upload" @click="uploadImg" v-else>
|
||||
<image
|
||||
:src="imgBeseUrl"
|
||||
style="width: 160rpx; height: 160rpx"
|
||||
mode=""
|
||||
></image>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
||||
<!-- 内部维修 -->
|
||||
<view class="table-list-item" v-if="repairType == 1">
|
||||
<h2 style="padding: 4rpx 0; font-weight: bold">内部维修</h2>
|
||||
<uni-forms ref="baseForm" label-align="right">
|
||||
<!-- <uni-forms-item label="维修数量">
|
||||
<uni-easyinput placeholder="请填写维修数量" v-model="formLeft.repairNum"/>
|
||||
</uni-forms-item> -->
|
||||
<div v-for="(item, index) in partItems" :key="index">
|
||||
<uni-forms-item label="配件类型">
|
||||
<treeSelect
|
||||
style="width: 100%; height: 90rpx"
|
||||
ref="treeSelectRef"
|
||||
:options="partTreeData"
|
||||
@change="partTreeChange"
|
||||
:index="index"
|
||||
@clear="clearPart"
|
||||
:defaultProps="defaultProps"
|
||||
></treeSelect>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="配件数量">
|
||||
<uni-easyinput
|
||||
placeholder="配件数量"
|
||||
v-model="item.partNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
@input="partCheckNum(item)"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="是否收费">
|
||||
<div style="width: 100%; display: flex">
|
||||
<uni-data-select
|
||||
:localdata="isChargeList"
|
||||
v-model="item.partType"
|
||||
placeholder="请选择是否收费"
|
||||
:clear="false"
|
||||
/>
|
||||
<div class="operation-btns">
|
||||
<span class="add" @click="addPart">+</span>
|
||||
<span class="remove" @click="delPart(index)">-</span>
|
||||
</div>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
</div>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive } from 'vue'
|
||||
import {
|
||||
partTypeTreeList,
|
||||
getSupplierList,
|
||||
getRepairerListApi,
|
||||
saveRepairRow,
|
||||
getScrapReasonList,
|
||||
} from '@/services/repair/repair.js'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import treeSelect from '../tree-select/tselect.vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
const queryParams = ref({})
|
||||
const rowIndex = ref(-1)
|
||||
// 计算属性:将选中的编码用逗号拼接显示
|
||||
const selectedCodesDisplay = computed(() => {
|
||||
if (queryParams.value.selectedCodes && queryParams.value.selectedCodes.length > 0) {
|
||||
// 清理可能存在的双引号和其他字符
|
||||
const cleanCodes = queryParams.value.selectedCodes.map(code => {
|
||||
// 如果是字符串,移除首尾的双引号
|
||||
if (typeof code === 'string') {
|
||||
return code.replace(/^["']|["']$/g, '')
|
||||
}
|
||||
return String(code)
|
||||
})
|
||||
return cleanCodes.join(', ')
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
// onLoad((options) => {
|
||||
// console.log(options)
|
||||
// queryParams.value = JSON.parse(options.queryParams)
|
||||
// rowIndex.value = options.rowIndex
|
||||
// console.log(queryParams.value)
|
||||
// getScrapReasonListData()
|
||||
// })
|
||||
|
||||
onLoad((options) => {
|
||||
queryParams.value = JSON.parse(decodeURIComponent(options.batchParams))
|
||||
if (queryParams.value.selectedCodes) {
|
||||
queryParams.value.selectedCodes = queryParams.value.selectedCodes.map(code => {
|
||||
// 清理双引号
|
||||
if (typeof code === 'string') {
|
||||
return code.replace(/^["']|["']$/g, '')
|
||||
}
|
||||
return String(code)
|
||||
})
|
||||
}
|
||||
console.log('批量维修参数:', queryParams.value)
|
||||
console.log('选中的设备:', queryParams.value.selectedDevices)
|
||||
console.log('选中的编码:', queryParams.value.selectedCodes)
|
||||
})
|
||||
|
||||
const repairType = ref(1)
|
||||
const changeTab = async (e) => {
|
||||
repairType.value = e
|
||||
}
|
||||
const isChargeList = ref([
|
||||
{ value: 1, text: '是' },
|
||||
{ value: 0, text: '否' },
|
||||
])
|
||||
|
||||
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
|
||||
// console.log('🚀 ~ userInfo:', userInfo)
|
||||
|
||||
//获取维修人员
|
||||
const repairPersonData = ref([])
|
||||
const repairPerson = ref('')
|
||||
const getRepairerListData = async () => {
|
||||
const res = await getRepairerListApi({})
|
||||
console.log(res)
|
||||
repairPersonData.value = res.data.map((item) => {
|
||||
let obj = {
|
||||
value: item.userId,
|
||||
text: item.repairer,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
// 如果 userInfo.userId 在repairPersonData.value 数组中说明是维修人员,则默认选中, 否则默认选中第一个
|
||||
if (
|
||||
repairPersonData.value &&
|
||||
repairPersonData.value.findIndex((v) => v.value === userInfo.userId) > -1
|
||||
) {
|
||||
repairPerson.value = userInfo.userId
|
||||
} else {
|
||||
repairPerson.value = repairPersonData.value[0].value
|
||||
}
|
||||
}
|
||||
getRepairerListData()
|
||||
|
||||
const remark = ref('') //备注
|
||||
|
||||
const imgBeseUrl = ref('') //图片展示
|
||||
const bmFileInfos = ref([]) //图片数组
|
||||
//上传
|
||||
const uploadImg = () => {
|
||||
uni.chooseImage({
|
||||
count: 1, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: '/file/upload', //h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res)
|
||||
|
||||
if (res.code && res.code == 200) {
|
||||
let obj = {
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
}
|
||||
bmFileInfos.value = [obj]
|
||||
console.log('上传成功', bmFileInfos.value)
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
bmFileInfos.value = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//配件树
|
||||
const partTreeData = ref([])
|
||||
const defaultProps = ref({
|
||||
id: 'id',
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
})
|
||||
const getPartTreeData = async () => {
|
||||
const res = await partTypeTreeList({})
|
||||
partTreeData.value = res.data
|
||||
}
|
||||
getPartTreeData()
|
||||
const treeSelectRef = ref([])
|
||||
const clearPart = (index) => {
|
||||
partItems.value[index].partId = ''
|
||||
}
|
||||
const partTreeChange = (val, index) => {
|
||||
const isHas = partItems.value.findIndex((v) => v.partId === val.id)
|
||||
if (isHas > -1) {
|
||||
//不可选择相同的配件
|
||||
console.log(isHas)
|
||||
uni.showToast({ title: '已存在该配件类型', icon: 'none' })
|
||||
treeSelectRef.value[index].clearInput()
|
||||
partItems.value[index].partId = ''
|
||||
partItems.value[index].storageNum = ''
|
||||
partItems.value[index].partNum = 0
|
||||
} else {
|
||||
partItems.value[index].partId = val.id
|
||||
partItems.value[index].storageNum = val.storageNum
|
||||
partItems.value[index].partNum = 0
|
||||
}
|
||||
}
|
||||
|
||||
//内部维修
|
||||
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }])
|
||||
const addPart = () => {
|
||||
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||
}
|
||||
const delPart = (index) => {
|
||||
if (partItems.value.length > 1) {
|
||||
partItems.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
const partIds = ref([])
|
||||
const formLeft = ref({
|
||||
// repairNum:0
|
||||
})
|
||||
|
||||
const partItemsMiddle = ref([
|
||||
{ partName: '', supplierId: '', partNum: 0, partPrice: 0, partType: 0 },
|
||||
])
|
||||
const addMidPart = () => {
|
||||
partItemsMiddle.value.push({
|
||||
partName: '',
|
||||
supplierId: '',
|
||||
partNum: 0,
|
||||
partPrice: 0,
|
||||
partType: 0,
|
||||
})
|
||||
}
|
||||
const delMidPart = (index) => {
|
||||
if (partItemsMiddle.value.length > 1) {
|
||||
partItemsMiddle.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
const formMiddle = ref({
|
||||
// supplierId:undefined,
|
||||
// repairNum:0
|
||||
})
|
||||
|
||||
//待报废
|
||||
const formRight = ref({
|
||||
// scrapNum:0,
|
||||
scrapType: 0,
|
||||
scrapId: null, // 报废原因id
|
||||
scrapReason: '', // 报废原因
|
||||
fileList: [],
|
||||
})
|
||||
|
||||
const rowData = ref({})
|
||||
// 配件框change事件
|
||||
const partCheckNum = (item) => {
|
||||
// console.log(item)
|
||||
// console.log(item.partNum)
|
||||
setTimeout(() => {
|
||||
item.partNum = Number(String(item.partNum).replace(/[^\d.]/g, ''))
|
||||
if (item.storageNum) {
|
||||
// console.log(item.partNum)
|
||||
// console.log(item.storageNum)
|
||||
if (Number(item.partNum) >= Number(item.storageNum)) {
|
||||
item.partNum = Number(item.storageNum)
|
||||
}
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
// 金额框change事件
|
||||
const costCheckNum = (item) => {
|
||||
// console.log(item)
|
||||
// console.log(item.partPrice)
|
||||
setTimeout(() => {
|
||||
item.partPrice = Number(String(item.partPrice).replace(/[^\d.]/g, ''))
|
||||
}, 500)
|
||||
}
|
||||
//维修完成校验
|
||||
const saveCode = () => {
|
||||
if (repairType.value == 1) {
|
||||
let index1 = partItems.value.findIndex((v) => v.partId == '')
|
||||
let index2 = partItems.value.findIndex((v) => v.partNum == 0)
|
||||
if (repairPerson.value == '') {
|
||||
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
||||
} else if (index1 > -1) {
|
||||
uni.showToast({ title: '请先选择配件类型!', icon: 'none' })
|
||||
} else if (index2 > -1) {
|
||||
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
|
||||
} else {
|
||||
saveCodeApi()
|
||||
}
|
||||
}
|
||||
}
|
||||
//维修完成请求
|
||||
const saveCodeApi = async () => {
|
||||
//请求接口
|
||||
rowData.value = queryParams.value
|
||||
// 遍历所有设备列表项,为每一项设置相同的值
|
||||
for (let i = 0; i < rowData.value.repairDeviceList.length; i++) {
|
||||
// 设置维修人员信息
|
||||
rowData.value.repairDeviceList[i].repairList = [
|
||||
{
|
||||
repairer: repairPerson.value,
|
||||
remark: remark.value,
|
||||
fileList: bmFileInfos.value,
|
||||
},
|
||||
]
|
||||
// 初始化配件列表数组(如果不存在)
|
||||
if (!rowData.value.repairDeviceList[i].codeInRepairPartList) {
|
||||
rowData.value.repairDeviceList[i].codeInRepairPartList = [];
|
||||
}
|
||||
// 添加配件信息
|
||||
for (let j = 0; j < partItems.value.length; j++) {
|
||||
rowData.value.repairDeviceList[i].codeInRepairPartList.push({
|
||||
partType: partItems.value[j].partType,
|
||||
partId: partItems.value[j].partId,
|
||||
partNum: partItems.value[j].partNum,
|
||||
storageNum: partItems.value[j].storageNum,
|
||||
})
|
||||
}
|
||||
|
||||
// 设置维修类型为1
|
||||
rowData.value.repairDeviceList[i].repairType = 1;
|
||||
}
|
||||
console.log(rowData.value.repairDeviceList)
|
||||
saveRepairRow(rowData.value.repairDeviceList).then(async (response) => {
|
||||
if (response.code == 200) {
|
||||
uni.showToast({ title: '保存成功', icon: 'none' })
|
||||
uni.navigateBack({
|
||||
delta: 2, // 返回到已存在的页面
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.upload-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
// 上传区域样式
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #3784fb;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
padding: 24rpx;
|
||||
flex-direction: column;
|
||||
background-color: #f7f8fa;
|
||||
|
||||
// 基本信息卡片
|
||||
.table-list-item {
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
// 标题样式
|
||||
h2 {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
margin-bottom: 24rpx;
|
||||
position: relative;
|
||||
padding-left: 24rpx;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
background: #3784fb;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 信息行
|
||||
.uni-row {
|
||||
padding: 16rpx 0;
|
||||
font-size: 28rpx;
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.uni-col-6 {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
.cont {
|
||||
color: #262626;
|
||||
}
|
||||
}
|
||||
|
||||
// 表单样式
|
||||
:deep(.uni-forms-item) {
|
||||
padding: 24rpx 0;
|
||||
margin-bottom: 0;
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.uni-forms-item__label {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
.uni-easyinput__content {
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:focus-within {
|
||||
border-color: #3784fb;
|
||||
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// 下拉选择框样式
|
||||
.uni-data-select {
|
||||
.uni-select {
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:focus-within {
|
||||
border-color: #3784fb;
|
||||
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 操作按钮组
|
||||
.search-form {
|
||||
margin-bottom: 24rpx;
|
||||
background: #fff !important;
|
||||
border-radius: 20rpx !important;
|
||||
padding: 24rpx !important;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.btnBox {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
border-radius: 12rpx;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
// 内部维修按钮
|
||||
&.internal {
|
||||
background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
|
||||
box-shadow: 0 6rpx 20rpx rgba(46, 204, 113, 0.2);
|
||||
}
|
||||
|
||||
// 返厂维修按钮
|
||||
&.return {
|
||||
background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
|
||||
box-shadow: 0 6rpx 20rpx rgba(243, 156, 18, 0.2);
|
||||
}
|
||||
|
||||
// 待报废按钮
|
||||
&.scrap {
|
||||
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
|
||||
box-shadow: 0 6rpx 20rpx rgba(231, 76, 60, 0.2);
|
||||
}
|
||||
|
||||
// 维修完成按钮
|
||||
&.complete {
|
||||
background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
|
||||
box-shadow: 0 6rpx 20rpx rgba(52, 152, 219, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加减按钮
|
||||
.operation-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-left: 24rpx;
|
||||
|
||||
span {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 32rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
&.add {
|
||||
color: #2ecc71;
|
||||
background-color: rgba(46, 204, 113, 0.1);
|
||||
}
|
||||
|
||||
// 删除按钮
|
||||
&.remove {
|
||||
color: #e74c3c;
|
||||
background-color: rgba(231, 76, 60, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 加载提示文字
|
||||
.loading-text {
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.outbound-btn {
|
||||
width: 70%;
|
||||
margin: 25rpx auto;
|
||||
height: 65rpx;
|
||||
line-height: 65rpx;
|
||||
text-align: center;
|
||||
background-color: #19be6b;
|
||||
border-radius: 12rpx;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -201,14 +201,21 @@
|
|||
<uni-easyinput placeholder="请填写其他原因" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="附件">
|
||||
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2 == ''">+</div>
|
||||
<div class="upload" @click="uploadScrapImg" v-else>
|
||||
<image
|
||||
:src="imgBeseUrl2"
|
||||
style="width: 160rpx; height: 160rpx"
|
||||
mode=""
|
||||
></image>
|
||||
<!-- <div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2 == ''">+</div>-->
|
||||
<!-- <div class="upload" @click="uploadScrapImg" v-else>-->
|
||||
<!-- <image-->
|
||||
<!-- :src="imgBeseUrl2"-->
|
||||
<!-- style="width: 160rpx; height: 160rpx"-->
|
||||
<!-- mode=""-->
|
||||
<!-- ></image>-->
|
||||
<!-- </div>-->
|
||||
<div class="upload-container">
|
||||
<div class="upload" @click="uploadImg2" v-if="imgList2.length < 3">+</div>
|
||||
<div class="image-preview" v-for="(img, index) in imgList2" :key="index">
|
||||
<image :src="img.url" mode="aspectFill"></image>
|
||||
<view class="delete-btn" @click.stop="deleteImage2(index)">×</view>
|
||||
</div>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
|
@ -440,44 +447,77 @@ const formRight = ref({
|
|||
fileList: [],
|
||||
})
|
||||
const imgBeseUrl2 = ref('') //图片展示
|
||||
const imgList2 = ref([]) // 图片列表,用于回显
|
||||
//上传
|
||||
const uploadScrapImg = () => {
|
||||
uni.chooseImage({
|
||||
count: 1, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl2.value = imgFiles[0]
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: '/file/upload', //h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res)
|
||||
const uploadImg2 = () => {
|
||||
uni.chooseImage({
|
||||
count: 3 - imgList2.value.length, // 最多选择3张,减去已选数量
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async (res) => {
|
||||
const tempFiles = res.tempFiles
|
||||
if (imgList2.value.length + tempFiles.length > 3) {
|
||||
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (res.code && res.code == 200) {
|
||||
let obj = {
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
}
|
||||
formRight.value.fileList = [obj]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
formRight.value.fileList = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
// 显示选择的图片
|
||||
for (let i = 0; i < tempFiles.length; i++) {
|
||||
imgList2.value.push({
|
||||
url: tempFiles[i].path,
|
||||
uploading: true
|
||||
})
|
||||
}
|
||||
|
||||
// 上传所有图片
|
||||
const uploadPromises = tempFiles.map(file => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: '/file/upload',
|
||||
filePath: file.path,
|
||||
name: 'file',
|
||||
success: (uploadRes) => {
|
||||
const resData = JSON.parse(uploadRes.data)
|
||||
if (resData.code === 200) {
|
||||
resolve({
|
||||
name: resData.data.name,
|
||||
url: resData.data.url
|
||||
})
|
||||
} else {
|
||||
reject(new Error('上传失败'))
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
try {
|
||||
const results = await Promise.all(uploadPromises)
|
||||
formRight.value.fileList = [...bmFileInfos.value, ...results]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
|
||||
// 更新图片状态
|
||||
imgList2.value = imgList2.value.map(img => {
|
||||
return {
|
||||
...img,
|
||||
uploading: false
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
|
||||
// 移除上传失败的图片
|
||||
imgList2.value = imgList2.value.filter(img => !img.uploading)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 删除图片
|
||||
const deleteImage2 = (index) => {
|
||||
imgList2.value.splice(index, 1)
|
||||
formRight.value.fileList.splice(index, 1)
|
||||
}
|
||||
|
||||
const rowData = ref({})
|
||||
|
|
@ -594,6 +634,54 @@ const saveCodeApi = async () => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.upload-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
// 上传区域样式
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="page-container">
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="12">
|
||||
<uni-col :span="10">
|
||||
<view>
|
||||
<uni-easyinput placeholder="请输入内容" />
|
||||
</view>
|
||||
|
|
@ -12,54 +12,79 @@
|
|||
<uni-col :span="4">
|
||||
<view class="search" style="background: #19be6b" @click="onQualified">合格</view>
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="search" style="background: #19be6b" @click="onBatchRepair">批量维修</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<view class="table-list-item">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">物资名称:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ queryParams.typeName }}</view>
|
||||
<uni-col :span="18">
|
||||
<view class="cont">{{ queryParams.typeName }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">物资类型:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ queryParams.type }}</view>
|
||||
<uni-col :span="18">
|
||||
<view class="cont">{{ queryParams.type }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">待修数量:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{
|
||||
<uni-col :span="18">
|
||||
<view class="cont">{{
|
||||
queryParams.typeRepairNum - queryParams.typeRepairedNum
|
||||
}}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<!-- <view class="table-list-item" style="margin: 0">
|
||||
<checkbox-group>
|
||||
<label>
|
||||
全选
|
||||
|
||||
<view class="table-list-item" style="margin: 0">
|
||||
<checkbox-group @change="handleSelectAll">
|
||||
<label class="select-all-label">
|
||||
<checkbox
|
||||
color="#409eff"
|
||||
borderColor="#409eff"
|
||||
activeBorderColor="#409eff"
|
||||
:checked="allChecked"
|
||||
:disabled="selectableItems.length === 0"
|
||||
value="all"
|
||||
style="transform: scale(0.7)"
|
||||
/>
|
||||
<text class="select-all-text">全选</text>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<div v-for="(item, index) in repairDeviceList" :key="index">
|
||||
<view class="code-list-item" @click="goOperate(item,index)">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="2">{{ index + 1 }}.</uni-col>
|
||||
<uni-col :span="16">{{ item.code }}</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="cont" v-if="item.status == '1'" style="color: green">已完成</view>
|
||||
<view class="cont" v-if="item.status == '0'" style="color: red">未完成</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<view class="item-content">
|
||||
<!-- 左侧:复选框和序号 -->
|
||||
<view class="left-section">
|
||||
<checkbox
|
||||
color="#409eff"
|
||||
:value="item.code"
|
||||
:checked="selectedItems.includes(item.code)"
|
||||
:disabled="item.status !== '0'"
|
||||
@click.stop="handleItemCheck(item.code)"
|
||||
style="transform: scale(0.7)"
|
||||
/>
|
||||
<text class="index-number">{{ index + 1 }}.</text>
|
||||
</view>
|
||||
|
||||
<!-- 中间:设备编码 -->
|
||||
<view class="middle-section">
|
||||
<text class="device-code">{{ item.code }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 右侧:状态 -->
|
||||
<view class="right-section">
|
||||
<view class="status-tag" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
</view>
|
||||
|
|
@ -69,33 +94,60 @@
|
|||
import { computed, ref } from 'vue'
|
||||
import { auditRepairPass } from '@/services/repair/repair.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
// const query = defineProps() // 获取上级页面传递的由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
|
||||
const queryParams = ref({})
|
||||
// console.log(queryParams)
|
||||
const allChecked = ref(false)
|
||||
const repairDeviceList = ref([])
|
||||
onLoad((options) => {
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
console.log(queryParams.value)
|
||||
repairDeviceList.value=queryParams.value.repairDeviceList;
|
||||
console.log(repairDeviceList.value)
|
||||
const selectedItems = ref([])
|
||||
|
||||
const selectableItems = computed(() => {
|
||||
return repairDeviceList.value.filter(item => item.status === '0').map(item => item.code)
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
console.log(queryParams.value)
|
||||
repairDeviceList.value = queryParams.value.repairDeviceList;
|
||||
console.log(repairDeviceList.value)
|
||||
})
|
||||
|
||||
const handleSelectAll = (e) => {
|
||||
const checked = e.detail.value.length > 0
|
||||
allChecked.value = checked
|
||||
if (checked) {
|
||||
selectedItems.value = [...selectableItems.value]
|
||||
} else {
|
||||
selectedItems.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const handleItemCheck = (code) => {
|
||||
// Only allow selection if item is status '0'
|
||||
const item = repairDeviceList.value.find(i => i.code === code)
|
||||
if (item && item.status !== '0') return
|
||||
|
||||
const index = selectedItems.value.indexOf(code)
|
||||
if (index === -1) {
|
||||
selectedItems.value.push(code)
|
||||
} else {
|
||||
selectedItems.value.splice(index, 1)
|
||||
}
|
||||
allChecked.value = selectedItems.value.length === selectableItems.value.length
|
||||
}
|
||||
|
||||
// 点击跳转维修页面
|
||||
const goOperate = (item,index) => {
|
||||
if(item.status==0){
|
||||
const codingUrl = '/pages/repair/repairManage/code-operate' // 编码维修
|
||||
uni.navigateTo({
|
||||
url: `${codingUrl}?queryParams=${JSON.stringify(queryParams.value)}&rowIndex=${index}`,
|
||||
})
|
||||
}
|
||||
if(item.status==0){
|
||||
const codingUrl = '/pages/repair/repairManage/code-operate' // 编码维修
|
||||
uni.navigateTo({
|
||||
url: `${codingUrl}?queryParams=${JSON.stringify(queryParams.value)}&rowIndex=${index}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const onQualified = async () => {
|
||||
console.log(queryParams.value.ids[1])
|
||||
let id = [queryParams.value.ids[1]]
|
||||
let id = [queryParams.value.ids[1]]
|
||||
const res = await auditRepairPass(id)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
|
|
@ -104,12 +156,67 @@ const onQualified = async () => {
|
|||
})
|
||||
uni.navigateBack({
|
||||
delta: 1, // 返回到已存在的页面
|
||||
success() {
|
||||
uni.$emit('onUpdate')
|
||||
},
|
||||
success() {
|
||||
uni.$emit('onUpdate')
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 批量维修处理函数
|
||||
const onBatchRepair = () => {
|
||||
// 检查是否有勾选数据
|
||||
if (selectedItems.value.length === 0) {
|
||||
uni.showToast({
|
||||
title: '请先勾选数据',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 获取勾选的完整设备信息
|
||||
const selectedDevices = repairDeviceList.value.filter(item =>
|
||||
selectedItems.value.includes(item.code)
|
||||
)
|
||||
|
||||
console.log('选中的设备:', selectedDevices)
|
||||
console.log('选中的设备编码:', selectedItems.value)
|
||||
|
||||
// 构造传递的参数
|
||||
const batchParams = {
|
||||
...queryParams.value,
|
||||
selectedDevices: selectedDevices,
|
||||
selectedCodes: selectedItems.value,
|
||||
batchMode: true // 标识为批量模式
|
||||
}
|
||||
|
||||
// 跳转到批量维修页面
|
||||
const batchRepairUrl = '/pages/repair/repairManage/batch-repair' // 批量维修页面
|
||||
uni.navigateTo({
|
||||
url: `${batchRepairUrl}?batchParams=${encodeURIComponent(JSON.stringify(batchParams))}`,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取状态样式类
|
||||
const getStatusClass = (status) => {
|
||||
switch(status) {
|
||||
case '1': return 'status-completed'
|
||||
case '0': return 'status-pending'
|
||||
case '2': return 'status-scrap'
|
||||
default: return ''
|
||||
}
|
||||
}
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status) => {
|
||||
switch(status) {
|
||||
case '1': return '已完成'
|
||||
case '0': return '未完成'
|
||||
case '2': return '待报废'
|
||||
default: return '未知'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -182,6 +289,19 @@ const onQualified = async () => {
|
|||
color: #262626;
|
||||
}
|
||||
}
|
||||
|
||||
// 全选标签样式
|
||||
.select-all-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.select-all-text {
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 编码列表项
|
||||
|
|
@ -199,43 +319,76 @@ const onQualified = async () => {
|
|||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.uni-row {
|
||||
.item-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
min-height: 60rpx;
|
||||
}
|
||||
|
||||
.uni-col-2 {
|
||||
// 左侧区域:复选框 + 序号
|
||||
.left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
min-width: 100rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
.index-number {
|
||||
font-size: 28rpx;
|
||||
color: #8c8c8c;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-col-16 {
|
||||
// 中间区域:设备编码
|
||||
.middle-section {
|
||||
flex: 1;
|
||||
padding: 0 24rpx;
|
||||
min-width: 0; // 防止文本溢出
|
||||
|
||||
.device-code {
|
||||
font-size: 28rpx;
|
||||
color: #262626;
|
||||
font-weight: 500;
|
||||
word-break: break-all; // 长文本换行
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-col-6 {
|
||||
text-align: right;
|
||||
// 右侧区域:状态
|
||||
.right-section {
|
||||
flex-shrink: 0;
|
||||
min-width: 120rpx;
|
||||
text-align: right;
|
||||
|
||||
.cont {
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
|
||||
&[style*="color: green"] {
|
||||
color: #52c41a !important;
|
||||
background-color: rgba(82, 196, 26, 0.1);
|
||||
}
|
||||
&.status-completed {
|
||||
color: #52c41a;
|
||||
background-color: rgba(82, 196, 26, 0.1);
|
||||
}
|
||||
|
||||
&[style*="color: red"] {
|
||||
color: #f5222d !important;
|
||||
background-color: rgba(245, 34, 45, 0.1);
|
||||
}
|
||||
&.status-pending {
|
||||
color: #f5222d;
|
||||
background-color: rgba(245, 34, 45, 0.1);
|
||||
}
|
||||
|
||||
&.status-scrap {
|
||||
color: #999;
|
||||
background-color: rgba(153, 153, 153, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加载提示文字
|
||||
.loading-text {
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -39,16 +39,17 @@
|
|||
<view class="table-list-item" :key="index" @click="handleItem(item)" v-for="(item, index) in tableList">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item @click="onClick($event, item)" :right-options="options">
|
||||
<div class="title">
|
||||
<div class="title-left">
|
||||
<span class="code">{{ item.repairCode }}</span>
|
||||
</div>
|
||||
<div class="title-right">
|
||||
<uni-tag v-if="item.repairStatusCode == 0" text="未完成" type="warning" custom-style="warningStyle"/>
|
||||
<uni-tag v-if="item.repairStatusCode == 1" text="已完成" type="success" custom-style="successStyle"/>
|
||||
<uni-tag v-if="item.repairStatusCode == 2" text="已驳回" type="warning" custom-style="warningStyle"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="title">
|
||||
<div class="title-left">
|
||||
<span class="code">{{ item.repairCode }}</span>
|
||||
<span class="sub-code">{{ `${item.backCode}-${item.level}` }}</span>
|
||||
</div>
|
||||
<div class="title-right">
|
||||
<uni-tag v-if="item.repairStatusCode == 0" text="未完成" type="warning" custom-style="warningStyle"/>
|
||||
<uni-tag v-if="item.repairStatusCode == 1" text="已完成" type="success" custom-style="successStyle"/>
|
||||
<uni-tag v-if="item.repairStatusCode == 2" text="已驳回" type="warning" custom-style="warningStyle"/>
|
||||
</div>
|
||||
</div>
|
||||
<view class="line"></view>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">任务时间:</uni-col>
|
||||
|
|
@ -265,6 +266,23 @@ const maskClick = () => {}
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title-left {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.code {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #3784fb;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.sub-code {
|
||||
font-size: 28rpx; /* 比主code小一点 */
|
||||
color: #8c8c8c; /* 灰色更柔和 */
|
||||
margin-top: 4rpx; /* 与主code有一点间距 */
|
||||
}
|
||||
}
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
|
|
|
|||
|
|
@ -184,10 +184,17 @@
|
|||
<uni-easyinput placeholder="请填写其他原因" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="附件">
|
||||
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2==''">+</div>
|
||||
<div class="upload" @click="uploadScrapImg" v-else>
|
||||
<image :src="imgBeseUrl2" style="width: 160rpx;height: 160rpx;" mode=""></image>
|
||||
<!-- <div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2==''">+</div>-->
|
||||
<!-- <div class="upload" @click="uploadScrapImg" v-else>-->
|
||||
<!-- <image :src="imgBeseUrl2" style="width: 160rpx;height: 160rpx;" mode=""></image>-->
|
||||
<!-- </div>-->
|
||||
<div class="upload-container">
|
||||
<div class="upload" @click="uploadImg2" v-if="imgList2.length < 3">+</div>
|
||||
<div class="image-preview" v-for="(img, index) in imgList2" :key="index">
|
||||
<image :src="img.url" mode="aspectFill"></image>
|
||||
<view class="delete-btn" @click.stop="deleteImage2(index)">×</view>
|
||||
</div>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
|
@ -200,7 +207,7 @@ import { computed, ref } from 'vue'
|
|||
import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow } from '@/services/repair/repair.js'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import treeSelect from '../tree-select/tselect.vue';
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
// const query = defineProps() // 获取上级页面传递的路由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
const queryParams = ref({})
|
||||
|
|
@ -220,20 +227,30 @@ const isChargeList = ref([
|
|||
{ value: 0, text: '否' },
|
||||
])
|
||||
|
||||
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
|
||||
|
||||
//获取维修人员
|
||||
const repairPersonData = ref([])
|
||||
const repairPerson = ref("")
|
||||
const repairPerson = ref("")
|
||||
const getRepairerListData = async () => {
|
||||
console.log('获取维修人员')
|
||||
const res = await getRepairerListApi({})
|
||||
console.log('2222222222222222')
|
||||
console.log(res)
|
||||
repairPersonData.value = res.data.map((item) => {
|
||||
let obj = {
|
||||
value: item.repairer,
|
||||
value: item.userId,
|
||||
text: item.repairer,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
// 如果 userInfo.userId 在repairPersonData.value 数组中说明是维修人员,则默认选中, 否则默认选中第一个
|
||||
if (
|
||||
repairPersonData.value &&
|
||||
repairPersonData.value.findIndex((v) => v.value === userInfo.userId) > -1
|
||||
) {
|
||||
repairPerson.value = userInfo.userId
|
||||
} else {
|
||||
repairPerson.value = repairPersonData.value[0].value
|
||||
}
|
||||
}
|
||||
getRepairerListData()
|
||||
|
||||
|
|
@ -243,46 +260,46 @@ const imgBeseUrl = ref("") //图片展示
|
|||
const bmFileInfos = ref([])//图片数组
|
||||
//上传
|
||||
const uploadImg = () => {
|
||||
uni.chooseImage({
|
||||
uni.chooseImage({
|
||||
count: 1, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: res => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: "/file/upload",//h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res);
|
||||
|
||||
if(res.code&&res.code==200){
|
||||
let obj = {
|
||||
"name":res.data.name,
|
||||
"url":res.data.url
|
||||
}
|
||||
bmFileInfos.value = [obj]
|
||||
console.log('上传成功', bmFileInfos.value);
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
}else{
|
||||
bmFileInfos.value = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: '/file/upload', //h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res)
|
||||
|
||||
if (res.code && res.code == 200) {
|
||||
let obj = {
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
}
|
||||
bmFileInfos.value = [obj]
|
||||
console.log('上传成功', bmFileInfos.value)
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
bmFileInfos.value = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//配件树
|
||||
//配件树
|
||||
const partTreeData = ref([])
|
||||
const defaultProps = ref({
|
||||
id: 'id',
|
||||
|
|
@ -293,7 +310,7 @@ const getPartTreeData = async () => {
|
|||
const res = await partTypeTreeList({})
|
||||
partTreeData.value = res.data;
|
||||
}
|
||||
getPartTreeData()
|
||||
getPartTreeData()
|
||||
// 配件清除
|
||||
const clearPart = (index) =>{
|
||||
partItems.value[index].partId=""
|
||||
|
|
@ -328,14 +345,14 @@ const getSupplierListData = async () => {
|
|||
return obj
|
||||
})
|
||||
}
|
||||
getSupplierListData()
|
||||
getSupplierListData()
|
||||
|
||||
|
||||
//内部维修
|
||||
const formLeft = ref({
|
||||
repairNum: 0,
|
||||
})
|
||||
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
|
||||
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
|
||||
const addPart = () => {
|
||||
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||
}
|
||||
|
|
@ -347,7 +364,7 @@ const delPart = (index) => {
|
|||
const partIds = ref([])
|
||||
|
||||
|
||||
//返厂维修
|
||||
//返厂维修
|
||||
const formMiddle = ref({
|
||||
supplierId: undefined,
|
||||
repairNum: 0,
|
||||
|
|
@ -371,44 +388,77 @@ const formRight = ref({
|
|||
fileList:[]
|
||||
})
|
||||
const imgBeseUrl2 = ref("") //图片展示
|
||||
const imgList2 = ref([]) // 图片列表,用于回显
|
||||
//上传
|
||||
const uploadScrapImg = () => {
|
||||
uni.chooseImage({
|
||||
count: 1, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: res => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgBeseUrl2.value = imgFiles[0]
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: "/file/upload",//h5
|
||||
filePath: imgFiles[0],
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res);
|
||||
|
||||
if(res.code&&res.code==200){
|
||||
let obj = {
|
||||
"name":res.data.name,
|
||||
"url":res.data.url
|
||||
}
|
||||
formRight.value.fileList = [obj]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
}else{
|
||||
formRight.value.fileList = []
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err);
|
||||
}
|
||||
});
|
||||
const uploadImg2 = () => {
|
||||
uni.chooseImage({
|
||||
count: 3 - imgList2.value.length, // 最多选择3张,减去已选数量
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async (res) => {
|
||||
const tempFiles = res.tempFiles
|
||||
if (imgList2.value.length + tempFiles.length > 3) {
|
||||
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 显示选择的图片
|
||||
for (let i = 0; i < tempFiles.length; i++) {
|
||||
imgList2.value.push({
|
||||
url: tempFiles[i].path,
|
||||
uploading: true
|
||||
})
|
||||
}
|
||||
|
||||
// 上传所有图片
|
||||
const uploadPromises = tempFiles.map(file => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: '/file/upload',
|
||||
filePath: file.path,
|
||||
name: 'file',
|
||||
success: (uploadRes) => {
|
||||
const resData = JSON.parse(uploadRes.data)
|
||||
if (resData.code === 200) {
|
||||
resolve({
|
||||
name: resData.data.name,
|
||||
url: resData.data.url
|
||||
})
|
||||
} else {
|
||||
reject(new Error('上传失败'))
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
try {
|
||||
const results = await Promise.all(uploadPromises)
|
||||
formRight.value.fileList = [...bmFileInfos.value, ...results]
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
|
||||
// 更新图片状态
|
||||
imgList2.value = imgList2.value.map(img => {
|
||||
return {
|
||||
...img,
|
||||
uploading: false
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
|
||||
// 移除上传失败的图片
|
||||
imgList2.value = imgList2.value.filter(img => !img.uploading)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 删除图片
|
||||
const deleteImage2 = (index) => {
|
||||
imgList2.value.splice(index, 1)
|
||||
formRight.value.fileList.splice(index, 1)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -429,7 +479,7 @@ const saveNumAll = async () => {
|
|||
uni.showToast({ title: '返厂维修请填写配件名称!', icon: 'none' })
|
||||
}else if(formMiddle.value.repairNum>0&&partItemsMiddle.value.findIndex(v => v.partNum == 0)>-1){
|
||||
uni.showToast({ title: '返厂维修请填写配件数量!', icon: 'none' }) //partPrice == 0 uni.showToast({ title: '返厂维修请填写配件金额!', icon: 'none' })
|
||||
}else if(formRight.value.scrapNum>0&&formRight.value.scrapReason==''){
|
||||
}else if(formRight.value.scrapNum>0&&formRight.value.scrapReason==''){
|
||||
uni.showToast({ title: '维修报废请填写报废原因!', icon: 'none' })
|
||||
}else {
|
||||
//维修人员
|
||||
|
|
@ -472,7 +522,7 @@ const saveNumAll = async () => {
|
|||
delta: 1, // 返回到已存在的页面
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +609,7 @@ const partCheckNum = (item) => {
|
|||
if(Number(item.partNum)>=Number(item.storageNum)){
|
||||
item.partNum=Number(item.storageNum)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
// 金额框change事件
|
||||
|
|
@ -571,6 +621,68 @@ const costCheckNum = (item) => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.upload-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.uploading-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
|
|
@ -796,7 +908,7 @@ const costCheckNum = (item) => {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.confirm-content-wrap1 {
|
||||
position: relative;
|
||||
left: 0;
|
||||
|
|
@ -810,23 +922,23 @@ const costCheckNum = (item) => {
|
|||
z-index: 999;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
.content_margin {
|
||||
padding: 15px 0px 15px 0px;
|
||||
}
|
||||
|
||||
|
||||
.flex_row_center {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.label_text {
|
||||
font-size: 28rpx;
|
||||
color: #555555;
|
||||
}
|
||||
|
||||
|
||||
.inputStyle {
|
||||
border: #bababa 0.5px solid;
|
||||
width: 169px;
|
||||
|
|
@ -835,13 +947,13 @@ const costCheckNum = (item) => {
|
|||
font-size: 13px;
|
||||
padding: 3px 2px;
|
||||
}
|
||||
|
||||
|
||||
.top_level {
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
|
||||
.ly_tree_style {
|
||||
border: #F5F5F5 1px solid;
|
||||
width: 169px;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">待修数量:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><view class="cont">{{ queryParams.typeRepairNum }}</view>
|
||||
><view class="cont">{{ Number(queryParams.typeRepairNum)-Number(queryParams.typeRepairedNum)-Number(queryParams.typeScrapNum)}}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -62,6 +62,12 @@
|
|||
<view class="cont">{{ item.repairer||"" }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">配件:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<view class="cont">{{ item.partName||"" }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">操作人:</uni-col>
|
||||
<uni-col :span="16">
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export const auditRepairPass = (data) => {
|
|||
export const getDetailsListApi = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/repair/getDetailsList',
|
||||
url: '/material/repair/getDetailsListApp',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue