diff --git a/klp-ui/src/components/ImageUpload/index.vue b/klp-ui/src/components/ImageUpload/index.vue index 9c92e86b..32a80da2 100644 --- a/klp-ui/src/components/ImageUpload/index.vue +++ b/klp-ui/src/components/ImageUpload/index.vue @@ -49,6 +49,12 @@ import { listByIds, delOss } from "@/api/system/oss"; export default { props: { value: [String, Object, Array], + // 值模式: 'ossId' - v-model绑定ossId字符串(默认), 'url' - v-model绑定url字符串 + valueMode: { + type: String, + default: 'ossId', + validator: (val) => ['ossId', 'url'].includes(val) + }, // 图片数量限制 limit: { type: Number, @@ -89,19 +95,26 @@ export default { value: { async handler(val) { if (val) { - // 首先将值转为数组 let list; if (Array.isArray(val)) { list = val; } else { - await listByIds(val).then(res => { - list = res.data; - }) + if (this.valueMode === 'url') { + list = val.split(',').filter(url => url).map(url => { + return { name: url.slice(url.lastIndexOf('/') + 1), url: url }; + }); + } else { + await listByIds(val).then(res => { + list = res.data; + }) + } } - // 然后将数组转为对象数组 this.fileList = list.map(item => { - // 此处name使用ossId 防止删除出现重名 - item = { name: item.ossId, url: item.url, ossId: item.ossId }; + if (this.valueMode === 'url') { + item = { name: item.url.slice(item.url.lastIndexOf('/') + 1), url: item.url }; + } else { + item = { name: item.ossId, url: item.url, ossId: item.ossId }; + } return item; }); } else { @@ -172,8 +185,10 @@ export default { handleDelete(file) { const findex = this.fileList.map(f => f.name).indexOf(file.name); if(findex > -1) { - let ossId = this.fileList[findex].ossId; - delOss(ossId); + if (this.valueMode === 'ossId') { + let ossId = this.fileList[findex].ossId; + delOss(ossId); + } this.fileList.splice(findex, 1); this.$emit("input", this.listToString(this.fileList)); } @@ -203,8 +218,12 @@ export default { let strs = ""; separator = separator || ","; for (let i in list) { - if (list[i].ossId) { - strs += list[i].ossId + separator; + if (this.valueMode === 'url') { + strs += list[i].url + separator; + } else { + if (list[i].ossId) { + strs += list[i].ossId + separator; + } } } return strs != "" ? strs.substr(0, strs.length - 1) : ""; diff --git a/klp-ui/src/views/mes/qc/inspection/task.vue b/klp-ui/src/views/mes/qc/inspection/task.vue index b5c10cfa..b2c67be5 100644 --- a/klp-ui/src/views/mes/qc/inspection/task.vue +++ b/klp-ui/src/views/mes/qc/inspection/task.vue @@ -112,6 +112,13 @@ --> + + + @@ -376,6 +391,7 @@ import { listInspectionItemTemplate } from "@/api/mes/qc/inspectionItemTemplate" import { SchemeSelect } from "@/components/KLPService"; import CoilSelector from "@/components/CoilSelector/index.vue"; import CurrentCoilNo from "@/components/KLPService/Renderer/CurrentCoilNo.vue"; +import FileUpload from "@/components/FileUpload"; import { listCoilByIds, listMaterialCoil } from "@/api/wms/coil"; export default { @@ -389,7 +405,8 @@ export default { components: { SchemeSelect, CoilSelector, - CurrentCoilNo + CurrentCoilNo, + FileUpload }, data() { return { @@ -471,6 +488,11 @@ export default { enterCoilNoLoading: false, selectedEnterCoilNos: [], tempEnterCoilNo: '', + attachmentOpen: false, + attachmentTitle: '', + attachmentLoading: false, + attachmentTaskRow: null, + attachmentFiles: '', }; }, computed: { @@ -869,6 +891,29 @@ export default { }; this.resetForm("itemForm"); }, + getAttachmentCount(row) { + if (!row.attachmentFiles) return 0; + return row.attachmentFiles.split(',').filter(f => f).length; + }, + handleAttachment(row) { + this.attachmentTaskRow = row; + this.attachmentTitle = `附件管理 - ${row.taskCode}`; + this.attachmentFiles = row.attachmentFiles || ''; + this.attachmentOpen = true; + }, + submitAttachment() { + this.attachmentLoading = true; + updateInspectionTask({ + taskId: this.attachmentTaskRow.taskId, + attachmentFiles: this.attachmentFiles + }).then(() => { + this.$modal.msgSuccess('附件保存成功'); + this.attachmentTaskRow.attachmentFiles = this.attachmentFiles; + this.attachmentOpen = false; + }).finally(() => { + this.attachmentLoading = false; + }); + }, } }; diff --git a/klp-ui/src/views/wms/coil/components/AbnormalForm.vue b/klp-ui/src/views/wms/coil/components/AbnormalForm.vue index 3509be1c..3d7055cf 100644 --- a/klp-ui/src/views/wms/coil/components/AbnormalForm.vue +++ b/klp-ui/src/views/wms/coil/components/AbnormalForm.vue @@ -52,17 +52,22 @@ 是否为主缺陷 + + +