diff --git a/src/pages/back/addBack.vue b/src/pages/back/addBack.vue index 5be75e9..cab5e4b 100644 --- a/src/pages/back/addBack.vue +++ b/src/pages/back/addBack.vue @@ -32,8 +32,8 @@ @clear="clearPro" > - - + + @@ -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 { diff --git a/src/pages/back/backCode.vue b/src/pages/back/backCode.vue index 32a26e6..c60257c 100644 --- a/src/pages/back/backCode.vue +++ b/src/pages/back/backCode.vue @@ -18,7 +18,7 @@ taskInfo.code }} - + {{ taskInfo.backPerson }} @@ -83,23 +83,22 @@ 完好 - 损坏 + 不合格 - - 附件: - -
+
-
- -
-
-
+ + 附件: + +
+
+
+
+ + × +
+
+
+
@@ -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) => { + \ No newline at end of file diff --git a/src/pages/back/backCodeDetail.vue b/src/pages/back/backCodeDetail.vue index 24d4105..d097c48 100644 --- a/src/pages/back/backCodeDetail.vue +++ b/src/pages/back/backCodeDetail.vue @@ -47,7 +47,7 @@ {{item.apDetection}} - + {{item.createBy}} {{item.createTime}} diff --git a/src/pages/back/backNum.vue b/src/pages/back/backNum.vue index 21b78e1..8eeab88 100644 --- a/src/pages/back/backNum.vue +++ b/src/pages/back/backNum.vue @@ -59,7 +59,7 @@ 退料数 完好数量 - 损坏数量 + 不合格数量 操作 @@ -90,7 +90,7 @@ { // 不能大于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 diff --git a/src/pages/back/backNumDetail.vue b/src/pages/back/backNumDetail.vue index 6f8d548..e0c2a27 100644 --- a/src/pages/back/backNumDetail.vue +++ b/src/pages/back/backNumDetail.vue @@ -14,7 +14,7 @@ {{ taskInfo.code }} - + {{ taskInfo.backPerson }} @@ -40,7 +40,7 @@ 退料数 完好数量 - 损坏数量 + 不合格数量 diff --git a/src/pages/back/index.vue b/src/pages/back/index.vue index 92c143d..4d1d73b 100644 --- a/src/pages/back/index.vue +++ b/src/pages/back/index.vue @@ -111,7 +111,7 @@ > - 退料人: + 制单人:
{{ item.backPerson }}
diff --git a/src/pages/business/leaseApply.vue b/src/pages/business/leaseApply.vue index f62bf05..f8a7777 100644 --- a/src/pages/business/leaseApply.vue +++ b/src/pages/business/leaseApply.vue @@ -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 diff --git a/src/pages/repair/repairManage/batch-repair.vue b/src/pages/repair/repairManage/batch-repair.vue new file mode 100644 index 0000000..df86af7 --- /dev/null +++ b/src/pages/repair/repairManage/batch-repair.vue @@ -0,0 +1,690 @@ + + + + + diff --git a/src/pages/repair/repairManage/code-operate.vue b/src/pages/repair/repairManage/code-operate.vue index 5e20680..46be988 100644 --- a/src/pages/repair/repairManage/code-operate.vue +++ b/src/pages/repair/repairManage/code-operate.vue @@ -201,14 +201,21 @@
--> -
+
-
- + + + + + + + + +
+
+
+
+ + ×
+
@@ -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 () => {