From 2a5918568692d9e143fc96ba9f1fa70b3c3acf6f Mon Sep 17 00:00:00 2001 From: jjLv <1981429112@qq.com> Date: Tue, 19 Nov 2024 18:27:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/repair/repair.js | 19 + .../repair/repairManage/component/edit.vue | 414 +++++++++++------- .../repair/repairManage/component/home.vue | 67 ++- 3 files changed, 328 insertions(+), 172 deletions(-) diff --git a/src/api/repair/repair.js b/src/api/repair/repair.js index 0407887a..6156b27a 100644 --- a/src/api/repair/repair.js +++ b/src/api/repair/repair.js @@ -54,3 +54,22 @@ export function saveCodeList(data) { }) } +//维修提交 +export function sendList(data) { + return request({ + url: '/material/repair/endRepairTask', + method: 'post', + data: data, + }) +} + +//维修合格 +export function auditPass(data) { + return request({ + url: '/material/repair/completeRepair', + method: 'post', + data: data, + + }) +} + diff --git a/src/views/material/repair/repairManage/component/edit.vue b/src/views/material/repair/repairManage/component/edit.vue index c750be97..7e9481c8 100644 --- a/src/views/material/repair/repairManage/component/edit.vue +++ b/src/views/material/repair/repairManage/component/edit.vue @@ -118,7 +118,7 @@ 维修 - 合格 + 合格 @@ -250,7 +250,7 @@ 保存 - 取消 @@ -538,10 +538,10 @@ :inline="true" label-width="100px" > - + + - + - - + + + @@ -750,6 +751,7 @@ maxlength="20" type="number" style="width: 265px" + @input="waitRepairCount" /> @@ -880,25 +882,10 @@ maxlength="20" type="number" style="width: 250px" + @input="waitRepairCount" /> - - - - - - + - - - - -
- 将文件拖到此处,或点击上传 -
- -
+ > +
+ + + + + @@ -959,7 +944,7 @@ align-items: center; " > - 保存 { + // const regex = /^[+-]?(0|[1-9]\d*)(\.\d+)?$/; + // if(!regex.test(value)){ + // return callback(new Error('请勿输入非数字')); + // } + // const pat = parseFloat(value); + // console.log('pat',pat) + // if(pat.toString().includes('.')==true){ + // if (pat <0 ||pat.toString().split(".")[1].length>6) { + // callback(new Error('请必须输入大于0的数据且小数点后最多保留六位')); + // } else { + // callback(); + // } + // }else{ + // if (pat<0) { + // callback(new Error('请必须输入大于0的数据且小数点后最多保留六位')); + // }else{ + // callback(); + // } + // } + // }, + // trigger: 'blur' + // } + ] + }, + rulesRight: { + scrapNum: [ + { + required: true, + message: "请输入返厂维修数量", + trigger: "blur", + }, + ], + + scrapType: [ + { + required: true, + message: "请选择损坏原因", + trigger: "change", + }, + ], + scrapReason: [ + { + required: true, + message: "请输入报废原因", + trigger: "blur", + }, + ], + }, + + //文件数组 fileList: [], + //暂存的文件数组 + fileListTemp:[], + typeTemp: "", typeNameTemp: "", - typeeTmp: "", + //待维修数量 disrepairNumTemp: undefined, + //数量维修是否能保存 + flagSave: false, + //合格勾选对象数组 + idsList:[], }; }, mounted() { @@ -1193,31 +1267,42 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.queryParams.equipmentList = selection; + this.idsList = []; + this.ids = selection.map((item) => item.id); + selection.forEach((item) => { + this.idsList.push(item.id); + }); + this.single = selection.length != 1; + this.multiple = !selection.length; }, /** 批量合格按钮操作 */ handleAdd() { - if (this.queryParams.equipmentList.length == 0) { - this.$message.error("请先勾选数据"); - return; + if (this.ids.length == 0) { + this.$alert("请至少勾选一条数据", "提示", { + type: "warning", + confirmButtonText: "确定", + }); + }else{ + auditPass(this.idsList).then((response) => { + if (response.code == 200) { + this.$modal.msgSuccess("通过成功"); + } + }); } - console.log(this.queryParams); - // this.queryParams.backApplyInfo = { - // remark: this.queryParams.remark, - // agreementId: this.queryParams.agreementId, - // backTime: this.queryParams.backTime, - // } - // let params = { - // backApplyInfo: this.queryParams.backApplyInfo, - // backApplyDetailsList: - // this.queryParams.equipmentList, - // } - // const res = await editBackApply(params) - // if (res.code == 200) { - // this.$message({ type: 'success', message: res.msg }) - // setTimeout(() => { - // this.$emit('goBackPage') - // }, 1000) - // } + }, + //单个合格按钮操作 + handleAddSingle(row){ + const ids = []; + ids.push(row.id); + this.$modal + .confirm("是否确认合格所选择的数据项?") + .then(function () { + return auditPass(ids); + }) + .then(() => { + this.$modal.msgSuccess("合格成功"); + }) + .catch(() => {}); }, //是否可用勾选框 selectable(row) { @@ -1287,43 +1372,6 @@ export default { this.openNum = true; }); } - // this.repairRowData = row; - // this.repairDeviceList = []; - // this.repairRowData.repairDeviceList = [ - // { - // materialName: "速差自控器", - // typeName: "G-J-10", - // maId: "1", - // maCode: "W202407-00001", - // maStatus: "待修", - // apDetection: "", - // partTableList: [], - // backTableList: [], - // bmFileInfos: [], - // }, - // { - // materialName: "速差自控器", - // typeName: "G-J-10", - // maId: "2", - // maCode: "W202407-00002", - // maStatus: "待修", - // apDetection: "", - // partTableList: [], - // backTableList: [], - // bmFileInfos: [], - // }, - // { - // materialName: "速差自控器", - // typeName: "G-J-10", - // maId: "3", - // maCode: "W202407-00003", - // maStatus: "待修", - // apDetection: "", - // partTableList: [], - // backTableList: [], - // bmFileInfos: [], - // }, - // ]; if ( this.repairRowData.repairDeviceList && this.repairRowData.repairDeviceList.length > 0 @@ -1341,12 +1389,12 @@ export default { }, // 编码维修弹窗保存 saveCodeDialog() { - console.log(this.repairRowData); - console.log(this.repairDeviceList); this.repairRowData.repairDeviceList = this.repairDeviceList; saveCodeList(this.repairRowData.repairDeviceList).then((response) => { if (response.code == 200) { this.$modal.msgSuccess("保存成功"); + this.fileList = []; + this.fileListTemp = []; } }); this.openCode = false; @@ -1397,8 +1445,6 @@ export default { }, // 图片上传 handleChange(file, fileList) { - console.log(file); - console.log(fileList); if (this.beforeUpload(file) == false) { fileList.splice(fileList.length - 1, 1); } @@ -1429,25 +1475,66 @@ export default { }); this.fileList.splice(sum, 1); }, - // 保存按钮 - saveSubmit() { + // 待报废保存按钮 + async saveSubmit() { this.uploadKey = Date.now(); - scrapRowData; + if(this.fileList.length!=0){ + await this.getImaUpload(), + await this.addWaitRepairPic(this.scrapForm); + }else{ + await this.addWaitRepairPic(this.scrapForm); + } + this.scrapRowData.repairType = 3 + this.scrapRowData.codeScrapRepairPartList.push(this.scrapForm) + this.openScrap = false; - this.fileList = []; this.reset(); }, - // 取消按钮 + //上传文件库 + async getImaUpload(){ + this.fileListTemp = []; + const reqData = new FormData() + const {fileTwo} = await this.getFileData() + let res = await imgUpLoadThree(fileTwo); + console.log('res',res) + if (res.code === 200) { + res.data.forEach(item=>{ + let objTwo = { 'name': item.name, 'url': item.url,}; + this.fileListTemp.push(objTwo); + }) + } else { + this.$modal.msgError(res.msg); + } + }, + + //提交时循环fileList 获取raw文件 + async getFileData() { + const fileTwo = [] + this.fileList.forEach(item => { + if (item?.hasOwnProperty('raw')) { + fileTwo.push(item.raw) + } + }) + return { fileTwo } + }, + + async addWaitRepairPic(scrapForm){ + this.scrapForm.fileList=this.fileListTemp + this.openScrap = false; + + }, + + // 待报废取消按钮 saveCancel() { this.uploadKey = Date.now(); this.openScrap = false; this.fileList = []; - this.reset(); + this.fileListTemp = []; + this.resetForm("scrapForm"); }, + //内部维修 openInnerDialog(row) { - console.log("index", row.index); - console.log("index2", row); this.innerRowData = row; this.partTableList = []; if ( @@ -1558,8 +1645,6 @@ export default { }, //内部维修- 弹窗保存 saveInnerDialog() { - console.log(this.innerRowData); - console.log(this.partTableList); const isNum = this.partTableList.some( (item) => item.partNum == 0 || item.partNum == undefined ); @@ -1619,8 +1704,6 @@ export default { }, //返场维修- 弹窗保存 saveBackDialog() { - console.log(this.backRowData); - console.log(this.backTableList); if (this.backTableList.length > 0) { this.$refs["backForm"].validate((valid) => { if (valid) { @@ -1672,11 +1755,7 @@ export default { // 待报废-打开 openScrapDialog(row) { this.scrapRowData = row; - // if(this.scrapRowData.backTableList&&this.scrapRowData.backTableList.length>0){ - // this.scrapForm = this.scrapRowData.scrapForm; - // }else{ this.scrapForm = {}; - // } this.openScrap = true; }, // 待报废弹窗文件上传成功处理-编码弹窗上传 @@ -1716,6 +1795,8 @@ export default { //数量管理保存 saveNumAll() { + this.$refs["formLeft","formMiddle","formRight"].validate(async(valid)=>{ + if(valid){ for (let i = 0; i < this.partItems.length; i++) { this.innerRowData.repairDeviceList[0].numberInRepairPartList.push({ isCharge: this.partItems[i].isCharge, @@ -1734,24 +1815,47 @@ export default { repairNum: this.formMiddle.repairNum, }); } - this.innerRowData.repairDeviceList[0].numberScrapRepairPartList.push({ - scrapReason: this.formRight.scrapReason, - scrapNum: this.formRight.scrapNum, - scrapType: this.formRight.scrapType, - otherReason: this.formRight.otherReason, - }) + this.uploadKey = Date.now(); + if(this.fileList.length!=0){ + await this.getImaUpload(), + this.formRight.fileList = this.fileListTemp; + }else{ + this.formRight.fileList = this.fileListTemp; + } + console.log('this.formRight',this.formRight) + this.innerRowData.repairDeviceList[0].numberScrapRepairPartList.push(this.formRight) this.innerRowData.repairDeviceList[0].repairType = 1; saveCodeList(this.innerRowData.repairDeviceList).then((response) => { if (response.code == 200) { this.$modal.msgSuccess("保存成功"); + this.fileList=[]; + this.fileListTemp=[]; this.openNum=false; } }); + } + }) }, //数量管理取消 saveCancelAll(){ + this.fileList=[]; + this.fileListTemp=[]; this.openNum=false; - } + }, + + //待维修数量限制统计 + waitRepairCount(){ + console.log('this.formLeft.repairNum',this.formLeft.repairNum) + console.log('this.formMiddle.repairNum',this.formMiddle.repairNum) + console.log('this.formRight.scrapNum',this.formRight.scrapNum) + console.log('this.disrepairNumTemp',this.disrepairNumTemp) + if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum)) >this.disrepairNumTemp){ + this.flagSave = true; + this.$message.error("输入的数字之和大于"+this.disrepairNumTemp); + }else{ + this.flagSave = false; + } + }, }, }; diff --git a/src/views/material/repair/repairManage/component/home.vue b/src/views/material/repair/repairManage/component/home.vue index 1a5f6677..6ec3ef6e 100644 --- a/src/views/material/repair/repairManage/component/home.vue +++ b/src/views/material/repair/repairManage/component/home.vue @@ -30,7 +30,8 @@ placeholder="请选择" > 新增 --> - 提交 + 提交 退回 @@ -89,15 +90,15 @@ - + @@ -341,15 +342,16 @@ import { getRepairTaskList, - rejectRepair + rejectRepair, + sendList, } from '@/api/repair/repair.js' import { getInfo, h } from '@/api/login' - import vueEasyPrint from "vue-easy-print"; +import vueEasyPrint from "vue-easy-print"; export default { name: '', - dicts: ['back_task_status'], + dicts: ['repair_task_status'], data() { return { type: '', @@ -392,6 +394,10 @@ export default { proList: [], //维修单显示 openPrint:false, + printData: {}, + //选择的taskId数组 + ids:[], + taskList:[], } }, created() { @@ -438,12 +444,12 @@ export default { this.$refs.queryForm.resetFields() this.handleQuery() }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map((item) => item.taskId) - this.single = selection.length != 1 - this.multiple = !selection.length - }, + // // 多选框选中数据 + // handleSelectionChange(selection) { + // this.ids = selection.map((item) => item.taskId) + // this.single = selection.length != 1 + // this.multiple = !selection.length + // }, /** 新增按钮操作 */ handleAdd() { this.$emit('handelAdd') @@ -479,13 +485,40 @@ export default { `维修任务单_${new Date().getTime()}.xlsx`, ) }, - //查看维修任务单 + //查看维修任务单 handlePrint(row) { this.openPrint = true; this.title = "机具设备维修任务单"; }, + //提交 + handleSend(row){ + if (this.ids.length == 0) { + this.$alert("请至少勾选一条要提交的数据", "提示", { + type: "warning", + confirmButtonText: "确定", + }); + return; + } else { + sendList(this.taskList).then((response) => { + if (response.code == 200) { + this.$modal.msgSuccess("通过成功"); + } + this.getList() + }); + } + }, - }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.taskList = []; + this.ids = selection.map((item) => item.taskId); + selection.forEach((item) => { + this.taskList.push({ taskId: item.taskId }); + }); + this.single = selection.length != 1; + this.multiple = !selection.length; + }, + }, }