diff --git a/src/views/material/part/partInventory/index.vue b/src/views/material/part/partInventory/index.vue new file mode 100644 index 00000000..aadacf30 --- /dev/null +++ b/src/views/material/part/partInventory/index.vue @@ -0,0 +1,155 @@ + + + + diff --git a/src/views/material/purchase/goodsArrived/component/addTools.vue b/src/views/material/purchase/goodsArrived/component/addTools.vue index 2ff60a63..85ba9dec 100644 --- a/src/views/material/purchase/goodsArrived/component/addTools.vue +++ b/src/views/material/purchase/goodsArrived/component/addTools.vue @@ -348,25 +348,43 @@ - @@ -552,7 +570,9 @@ export default { currentMatchIndex: -1, // 当前匹配项索引 matchedOptions: [], // 匹配的选项 keepSelectOpen: false, // 控制下拉框是否保持打开 - isSearching: false // 添加搜索状态标记 + isSearching: false, // 添加搜索状态标记 + uploadLoading: false, // 上传加载状态 + currentUploadRow: null, // 当前正在上传的行 } }, computed: { @@ -609,7 +629,7 @@ export default { this.maForm.arrivalTime = this.formatDate(new Date()); } this.supplierInfoList() - + }, methods: { handleDateTypeChange(val) { @@ -1107,142 +1127,121 @@ export default { }) .catch(() => {}) }, - beforeFileUpload(row){ - this.rowData.fileType = row.fileType - }, + // 点击上传按钮前准备 + beforeFileUpload(row) { + this.rowData.fileType = row.fileType; + this.currentUploadRow = row; + }, - beforeUpload(row, file) { - row.fileList.push(file); - console.log('6666666',row.fileList) - if (row.fileList.length > 3) { - this.$message.warning('最多只能上传三张图片'); - // 删除最后一个文件 - row.fileList.pop(); - return false; // 阻止上传 - } - return true; // 允许上传 - }, + // 文件上传前的处理 + beforeUpload(row, file) { + this.uploadLoading = true; + row.fileList.push(file); + if (row.fileList.length > 3) { + this.$message.warning('最多只能上传三张图片'); + row.fileList.pop(); + this.uploadLoading = false; + return false; + } + return true; + }, + // 文件选择变化(包括取消选择) + handleFileChange(file, fileList, row) { + // 当用户取消文件选择时,fileList为空 + if (!fileList || fileList.length === 0) { + this.uploadLoading = false; + this.currentUploadRow = null; + } + }, // 文件上传成功处理 - handleFileSuccess(row,response, file, fileList) { - if (response.code == 200) { - if (this.taskId == "") {//新增逻辑 - row.fileListTemp.push({ - "name": response.data.name, - "url": response.data.url, - }) - // console.log(response) - // console.log(this.rowData) - // console.log(this.rowData.bmFileInfos) - let obj = { - "taskId": this.taskId, - "taskType": "0", - "name": response.data.name, - "url": response.data.url, - "modelId": this.rowData.partId, - "fileType": this.rowData.fileType, - // "dictLabel": this.rowData.dictLabel, - } - //根据文件上传返回更新文件管理弹窗内容 - let index = this.fileDataList.findIndex(v=>v.fileType==this.rowData.fileType) - this.fileDataList[index].name = response.data.name - this.fileDataList[index].url = response.data.url - //判断当前上传的文件是否已上传过-再往机具类型数据中插入 - if(this.rowData.bmFileInfos.length>0){ - let index2 = this.rowData.bmFileInfos.findIndex(v=>v.fileType==this.rowData.fileType) - if(index2>-1){//相同类型文件重复上传-替换 - this.rowData.bmFileInfos.splice(index2,0,obj) - }else{//不存在相同类型文件-添加 - this.rowData.bmFileInfos.push(obj) - } - }else{ - this.rowData.bmFileInfos.push(obj) - } + handleFileSuccess(row, response, file, fileList) { + this.uploadLoading = false; + this.currentUploadRow = null; - } else {//编辑逻辑 - row.fileListTemp.push({ - "name": response.data.name, - "url": response.data.url, - }) - let obj = { - "taskId": this.taskId, - "taskType": "0", - "name": response.data.name, - "url": response.data.url, - "modelId": this.rowData.partId, - "fileType": this.rowData.fileType, - // "dictLabel": this.rowData.dictLabel, - } - //根据文件上传返回更新文件管理弹窗内容 - let index = this.fileDataList.findIndex(v=>v.fileType==this.rowData.fileType) - this.fileDataList[index].name = response.data.name - this.fileDataList[index].url = response.data.url - //判断当前上传的文件是否已上传过-再往机具类型数据中插入 - if(this.rowData.bmFileInfos.length>0){ - let index2 = this.rowData.bmFileInfos.findIndex(v=>v.fileType==this.rowData.fileType) - if(index2>-1){//相同类型文件重复上传-替换 - this.rowData.bmFileInfos.splice(index2,0,obj) - }else{//不存在相同类型文件-添加 - this.rowData.bmFileInfos.push(obj) - } - }else{ - this.rowData.bmFileInfos.push(obj) - } - uploadPurchaseFile(obj).then((response) => { - this.$modal.msgSuccess('上传成功') + if (response.code === 200) { + // 新增逻辑 + row.fileListTemp.push({ + name: response.data.name, + url: response.data.url, + }); - }).catch(() => { - this.$modal.msgError('上传失败') - }) + const obj = { + taskId: this.taskId, + taskType: "0", + name: response.data.name, + url: response.data.url, + modelId: this.rowData.partId, + fileType: this.rowData.fileType, + }; + + const index = this.fileDataList.findIndex(v => v.fileType == this.rowData.fileType); + if (index > -1) { + this.fileDataList[index].name = response.data.name; + this.fileDataList[index].url = response.data.url; + } + + if (this.rowData.bmFileInfos.length > 0) { + const index2 = this.rowData.bmFileInfos.findIndex(v => v.fileType == this.rowData.fileType); + if (index2 > -1) { + this.rowData.bmFileInfos.splice(index2, 0, obj); + } else { + this.rowData.bmFileInfos.push(obj); } + } else { + this.rowData.bmFileInfos.push(obj); } - }, - picturePreviewFile(row) { - row.fileList = [] - row.fileListTemp.forEach(item=>{ - row.fileList.push({ - "name": item.name, - "url": item.url, - }) - }) - this.fileId = row.fileType - this.fileListInfo = row.fileListTemp - - this.dialogVisibleFile = true - }, - - - //图片查看 - picturePreview(file) { - this.dialogImageUrl = file.url.replaceAll("#","%23") - const parts = file.name.split('.') - const extension = parts.pop() - if(extension === 'doc' || extension === 'DOC' || extension === 'docx' || extension === 'DOCX' || extension === 'pdf' || extension === 'PDF'){ - const windowName = file.name - window.open(file.url,windowName) - }else{ - this.dialogVisible = true + // 若是编辑逻辑 + if (this.taskId !== "") { + uploadPurchaseFile(obj) + .then(() => this.$modal.msgSuccess("上传成功")) + .catch(() => this.$modal.msgError("上传失败")); } - }, + } + }, + // 上传失败 + handleUploadError(error, file, fileList) { + this.uploadLoading = false; + this.currentUploadRow = null; + this.$modal.msgError("上传失败"); + console.error("上传失败:", error); + }, - //删除图片 - pictureDelete(row, id) { - let index = id - this.fileListInfo = this.fileListInfo.filter(item => item.url !== row.url); - this.fileDataList[this.fileId].fileList = this.fileDataList[this.fileId].fileList.filter(item => item.url !== row.url); - this.fileDataList[this.fileId].fileListTemp = this.fileDataList[this.fileId].fileListTemp.filter(item => item.url !== row.url); - let bmFiles = [] - this.rowData.bmFileInfos.forEach((item)=>{ - if (item.fileType != this.fileId) { - bmFiles.push(item) - }else{ - if (item.url!= row.url) { - bmFiles.push(item) - } - } - }) - this.rowData.bmFileInfos = bmFiles; - }, + picturePreviewFile(row) { + row.fileList = row.fileListTemp.map(item => ({ + name: item.name, + url: item.url, + })); + this.fileId = row.fileType; + this.fileListInfo = row.fileListTemp; + this.dialogVisibleFile = true; + }, + + + // 图片预览 + picturePreview(file) { + this.dialogImageUrl = file.url.replaceAll("#", "%23"); + const ext = file.name.split('.').pop().toLowerCase(); + if (["doc", "docx", "pdf"].includes(ext)) { + window.open(file.url, file.name); + } else { + this.dialogVisible = true; + } + }, + + // 删除图片 + pictureDelete(row, id) { + this.fileListInfo = this.fileListInfo.filter(item => item.url !== row.url); + this.fileDataList[this.fileId].fileList = + this.fileDataList[this.fileId].fileList.filter(item => item.url !== row.url); + this.fileDataList[this.fileId].fileListTemp = + this.fileDataList[this.fileId].fileListTemp.filter(item => item.url !== row.url); + + this.rowData.bmFileInfos = this.rowData.bmFileInfos.filter(item => { + if (item.fileType !== this.fileId) return true; + return item.url !== row.url; + }); + }, /** 删除按钮操作 */ handleDelete(row) { diff --git a/src/views/material/repair/repairManage/component/edit.vue b/src/views/material/repair/repairManage/component/edit.vue index 4e672e1e..41247317 100644 --- a/src/views/material/repair/repairManage/component/edit.vue +++ b/src/views/material/repair/repairManage/component/edit.vue @@ -11,7 +11,7 @@ clearable style="width: 240px" disabled/> - @@ -23,7 +23,7 @@ @click="goBack">维修管理 - 合格 @@ -35,7 +35,7 @@ - + @@ -131,12 +131,12 @@ :normalizer="normalizer" :searchable="true" :disable-branch-nodes="true" - :show-count="false" + :show-count="false" :expand-on-click-node="false" placeholder="请选择配件型号" style="width: 80%;" @select="partChange" - /> + /> @@ -295,7 +295,7 @@ - +
- 物资名称: {{ typeNameTemp }} + 物资名称: {{ typeNameTemp }}
- 规格型号: {{ typeTemp }} + 规格型号: {{ typeTemp }}
- 待维修数量: {{ disrepairNumTemp }} + 待维修数量: {{ disrepairNumTemp }}
-
+
- +
@@ -375,7 +375,7 @@ :options="partTypeTreeTwo" :searchable="true" :disable-branch-nodes="true" - :show-count="false" + :show-count="false" :expand-on-click-node="false" placeholder="请选择配件型号" style="width: 200px;" @@ -401,7 +401,7 @@ - + @@ -477,7 +477,7 @@ - @@ -518,7 +518,7 @@ - + { this.partTypeTreeTwo = this.filterTree(res.data); this.resetForm("formLeft"); @@ -964,7 +964,7 @@ export default { }); } if (this.repairRowData.repairDeviceList&&this.repairRowData.repairDeviceList.length > 0) { - this.repairDeviceList = this.repairRowData.repairDeviceList; + this.repairDeviceList = this.repairRowData.repairDeviceList; } }, //遍历树状数据 @@ -979,7 +979,7 @@ export default { return node; }); }, - + // ********编码维修******** @@ -1008,10 +1008,10 @@ export default { this.equipmentList = res.data; this.equipmentList.forEach((e) => { e.disrepairNum = Number(e.typeRepairNum) - Number(e.typeRepairedNum)-Number(e.typeScrapNum); - }); + }); this.openCode = false; // console.log(this.equipmentList) - }, + }, // 编码维修弹窗取消 async cancelCodeDialog(){ let param = { @@ -1023,7 +1023,7 @@ export default { this.equipmentList = res.data; this.equipmentList.forEach((e) => { e.disrepairNum = Number(e.typeRepairNum) - Number(e.typeRepairedNum)-Number(e.typeScrapNum); - }); + }); this.openCode = false; }, @@ -1046,7 +1046,7 @@ export default { const params = {}; const res = await partTypeTreeList(params); console.log("treeData==========", res); - this.partTypeTree = res.data; + this.partTypeTree = res.data; }, //编码-内部维修- 反显 树结构数据获取父 -旧组件 getSelectId(list, id) { @@ -1155,7 +1155,7 @@ export default { return null; // 未找到父节点时返回null }, //编码-内部维修- 重置按钮操作 - resetInner() { + resetInner() { this.partTypeId=null; this.partTableList = []; }, @@ -1310,6 +1310,11 @@ export default { this.uploadKey = Date.now(); this.$refs["scrapForm"].validate(async(valid) => { if(valid){ + // 添加文件必传验证 + if(this.fileList.length === 0){ + this.$message.error('请上传照片'); + return; + } if(this.fileList.length!=0){ await this.getImaUpload(), await this.addWaitRepairPic(this.scrapForm); @@ -1336,7 +1341,7 @@ export default { this.fileList = []; this.fileListTemp = []; this.resetForm("scrapForm"); - }, + }, //编码-待报废-上传文件库 async getImaUpload(){ this.fileListTemp = []; @@ -1447,7 +1452,7 @@ export default { }; // this.scrapForm={} } - }, + }, @@ -1512,7 +1517,7 @@ export default { this.partItems.splice(index, 1); this.dividerHeight -= 200; // 每次删除配件时,竖线高度减少 } - }, + }, //数量管理中间-返厂维修-添加 addPartItemMiddle() { this.partItemsMiddle.push({ partTypeName: "", partNum: "", partType: "0" }); @@ -1539,6 +1544,13 @@ export default { }) return } + if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum)) ==0) { + this.$message({ + message: '请输入维修数量 ', + type: 'warning' + }) + return + } let refTemp = []; if(this.formLeft.repairNum!=0){ refTemp.push(this.$refs.formLeft) @@ -1548,6 +1560,11 @@ export default { } if(this.formRight.scrapNum!=0){ refTemp.push(this.$refs.formRight) + // 添加文件必传验证 + if(this.fileList.length === 0){ + this.$message.error('请上传照片'); + return; + } } const valid = await this.validateForms(refTemp) if(valid){ @@ -1596,7 +1613,7 @@ export default { this.equipmentList = res.data; this.equipmentList.forEach((e) => { e.disrepairNum = Number(e.typeRepairNum) - Number(e.typeRepairedNum)-Number(e.typeScrapNum); - }); + }); this.openNum=false; } }); @@ -1659,7 +1676,7 @@ export default { // this.equipmentList = res.data; // this.equipmentList.forEach((e) => { // e.disrepairNum = Number(e.typeRepairNum) - Number(e.typeRepairedNum)-Number(e.typeScrapNum); - // }); + // }); // this.openNum=false; // } // }); @@ -1713,12 +1730,12 @@ export default { // this.equipmentList = res.data; // this.equipmentList.forEach((e) => { // e.disrepairNum = Number(e.typeRepairNum) - Number(e.typeRepairedNum)-Number(e.typeScrapNum); - // }); + // }); // } // }) // } - + }, //数量维修取消 saveCancelAll(){ @@ -1730,7 +1747,7 @@ export default { this.partItems = [{ partNum: "", partType: "0", partId:null, storageNum:"" }], this.partItemsMiddle = [{ partName: "", partNum: "", partPrice: "0", partType: "0" }], this.openNum=false; - }, + }, //待维修数量限制统计 waitRepairCount(){ if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum)) >this.disrepairNumTemp){ @@ -1748,7 +1765,7 @@ export default { if(Number(this.formRight.scrapNum)==0){ this.resetForm("formRight") } - }, + }, }, }; @@ -1794,4 +1811,4 @@ export default { margin: 0 10px; flex-shrink: 0; /* 防止竖线在内容较少时缩小 */ } - \ No newline at end of file + diff --git a/src/views/material/repair/repairManage/component/home.vue b/src/views/material/repair/repairManage/component/home.vue index f22d1d19..1c39a53e 100644 --- a/src/views/material/repair/repairManage/component/home.vue +++ b/src/views/material/repair/repairManage/component/home.vue @@ -311,40 +311,50 @@ -
-
-
- 负责人: +
+ +
+
+ 维修人员: +
+
+
-
-
- 完成日期: - {{ repairTicketlLevelOne.finishTime }} -
-
- -
-
-
-
- 维修人员: -
-
- -
-
- 试验人员: -
-
- -
-
- 检验人员: -
+ +
+ 完成日期: + {{ repairTicketlLevelOne.repairTime }}
+ + + + + + + + + + + + + + + + + + +
@@ -510,8 +520,8 @@ export default { //维修单显示 openPrint:false, printData: {}, - //选择的taskId数组 - ids:[], + // //选择的taskId数组 + // ids:[], taskList:[], //维修任务单上部分数据 repairTicketlLevelOne:{}, @@ -866,4 +876,8 @@ export default { .part-info .total-price { margin-left: 20px; /* 调整间距大小 */ } +.is-rotate { + transform: rotate(-90deg); + transform-origin: center center; +}