From 6b9962a8eee8b273ceee2adf7a11736247030705 Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 18 Aug 2025 11:08:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=8E=BB=E7=BA=A4=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E6=8A=A5=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/mlog_detail.vue | 373 ++++++++- src/views/wpm_bx/mlog_form2.vue | 292 +++++++ src/views/wpm_bx/mlogbw_check_table.vue | 991 ++++++++++++++++++++++++ src/views/wpm_bx/mlogs.vue | 36 +- 4 files changed, 1655 insertions(+), 37 deletions(-) create mode 100644 src/views/wpm_bx/mlog_form2.vue create mode 100644 src/views/wpm_bx/mlogbw_check_table.vue diff --git a/src/views/wpm_bx/mlog_detail.vue b/src/views/wpm_bx/mlog_detail.vue index 398d19cc..1bb84a73 100644 --- a/src/views/wpm_bx/mlog_detail.vue +++ b/src/views/wpm_bx/mlog_detail.vue @@ -311,8 +311,8 @@ > - - + + - - + + + + + + + + + + + + + --> + { that.mlogItem = res; + that.checkTableShow = true; + if(that.processType=='10'&&that.mlogItem.material_out_&&that.mlogItem.material_out_.tracking==20){ + that.getMlogbw(); + that.getdefects(that.mlogItem.qct); + } if(res.route!==null){ that.hasRoute = true; } @@ -613,9 +738,6 @@ export default { that.fileList = [{name:res.test_file,url:res.test_file}]; that.form.test_file = res.test_file; } - // that.mgroup = res.mgroup; - // that.paramsWm.mgroup = res.mgroup; - // that.paramsWm.search = that.batchContains; that.materialIn = res.material_in; that.deptId = res.belong_dept; that.apiObjWm = that.$API.wpm.wmaterial.list; @@ -643,6 +765,192 @@ export default { that.shiftOtions = res; }); }, + getdefects(qct){ + let that = this; + if(qct!==''&&qct!==null){//输出 + that.$API.qm.qct.item.req(qct).then((res) => { + that.qct_defects = []; + that.testdefectss(res); + }) + }else{ + that.$API.qm.qct.getQct.req({ material: that.mlogItem.material_out,type:'out',tag:'process' }).then((res) => { + that.testdefectss(res); + }).catch(()=>{ + // that.getList(); + }) + } + }, + testdefectss(res){ + let that = this; + res.qct_defects.forEach((item) => { + that.addTemplate[item.defect_name] = false; + let obj = Object.assign({}, item); + that.qct_defects.push(obj); + }) + that.qct_defects_origin = that.qct_defects; + that.qct_testitems = []; + res.qct_testitems.forEach((item2) => { + if(item2.testitem_type!=='20'){ + let obj2 = Object.assign({}, item2); + obj2.value = ''; + obj2.addto_wpr = item2.addto_wpr; + if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){ + obj2.value = null; + that.addTemplate[item2.testitem_name] = null; + } + if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){ + let str = obj2.testitem_choices.replace(/'/g, '"'); + let arr = JSON.parse(str); + obj2.testitem_choices = arr; + that.addTemplate[item2.testitem_name] = null; + } + that.qct_testitems.push(obj2); + } + }) + that.qct_testitems_origin = that.qct_testitems; + // that.getList(); + }, + //获取生产工序的mlogbw + getMlogbw(){ + let that = this; + let params = {}; + that.mlogbwlist = []; + params.page = 0; + params.type = 'out'; + params.mlogb__mlog = that.mlogId; + that.$API.wpm.mlogbw.list.req(params).then((res) => { + if(res.length>0){ + res.forEach((item) => { + let obj = {}; + obj = Object.assign({},item); + obj.isEdit = false; + if(item.ftest!=null){ + if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){ + item.ftest.ftestdefects.forEach((item1) => { + obj[item1.defect_name] = item1.has; + }) + } + if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){ + item.ftest.ftestitems.forEach((item2) => { + obj[item2.testitem_name] = item2.test_val_json; + }) + } + }else{ + that.qct_defects.forEach((item1) => { + obj[item1.defect_name] = false; + }) + that.qct_testitems.forEach((item2) => { + obj[item2.testitem_name] = null; + }) + } + that.mlogbwlist.push(obj); + }) + } + }) + }, + //输出编辑 + formTableEdit(row) { + let that = this; + that.mlogbwlist.forEach((item, index) => { + if (item.id == row.id) { + that.mlogbwlist[index].isEdit = true; + let date = new Date(); + if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){ + that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss'); + } + } + }); + }, + //输出保存 + formTableSave(row) { + let that = this; + let obj = {}; + obj.number = row.number; + obj.mlogb = row.mlogb; + obj.wpr = row.wpr; + obj.note = row.note; + //qct不为空,有检验表 + if(that.qct!==''&&that.qct!==null){ + that.qct_defects_origin.forEach(item => { + if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){ + let str = item.rule_expression.replace(/`/g, ''); + str = str.replace(/\${(.*?)}/g, 'row.\$1') + let judge = eval(str); + row[item.defect_name] = judge; + } + }); + obj.ftest = {}; + obj.ftest.ftestitems = []; + obj.ftest.ftestdefects = []; + obj.ftest.qct = that.qct; + obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate; + obj.ftest.test_user = that.handle_user; + if(that.qct_defects.length>0){ + that.qct_defects.forEach((item) => { + let itemObj = {}; + itemObj.defect = item.defect; + itemObj.test_user = that.handle_user; + itemObj.has = row[item.defect_name]?row[item.defect_name]:false; + obj.ftest.ftestdefects.push(itemObj); + }) + } + if(that.qct_testitems.length>0){ + that.qct_testitems.forEach((item1) => { + let itemObj1 = {}; + itemObj1.testitem = item1.testitem; + itemObj1.test_user = that.handle_user; + itemObj1.addto_wpr = item1.addto_wpr; + itemObj1.test_val_json = row[item1.testitem_name]; + obj.ftest.ftestitems.push(itemObj1); + }) + } + }else{ + obj.ftest = null; + } + if(row.id!==''&&row.id!==undefined&&row.id!==null){ + obj.id = row.id; + that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => { + that.$message.success("保存成功"); + that.getMlogbw(); + return res; + }).catch((err) => { + return err; + }); + }else{ + that.$API.wpm.mlogbw.create.req(obj).then((res) => { + that.$message.success("添加成功"); + that.getMlogbw(); + return res; + }).catch((err) => { + return err; + }); + } + }, + //输出取消编辑 + formTableCancel(row){ + this.mlogbwlist.forEach((item, index) => { + if (item.id == row.id) { + this.mlogbwlist[index].isEdit = false; + } + }); + }, + formTableDelet(row){ + this.mlogbwlist.pop(); + }, + //删除 + formTableDel(id) { + let that = this; + that.$confirm(`确定删除吗?`, "提示", { + type: "warning", + }).then(() => { + that.$API.wpm.mlogbw.delete.req(id).then((res) => { + // that.getList(); + that.$message.success("删除成功"); + }).catch((err) => { + return err; + }); + }).catch(() => {}); + }, //表单注入数据 setData(data) { Object.assign(this.form, data); @@ -734,6 +1042,7 @@ export default { that.$refs.checkDialogSingle.open(type,that.qct); }); }, + //表单提交方法 mlogSubmit() { let that = this; diff --git a/src/views/wpm_bx/mlog_form2.vue b/src/views/wpm_bx/mlog_form2.vue new file mode 100644 index 00000000..2668dfd8 --- /dev/null +++ b/src/views/wpm_bx/mlog_form2.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/src/views/wpm_bx/mlogbw_check_table.vue b/src/views/wpm_bx/mlogbw_check_table.vue new file mode 100644 index 00000000..a9298ad5 --- /dev/null +++ b/src/views/wpm_bx/mlogbw_check_table.vue @@ -0,0 +1,991 @@ + + + + diff --git a/src/views/wpm_bx/mlogs.vue b/src/views/wpm_bx/mlogs.vue index 4b47db13..d80d6a12 100644 --- a/src/views/wpm_bx/mlogs.vue +++ b/src/views/wpm_bx/mlogs.vue @@ -2,20 +2,24 @@
+ 快速报工 新增 + >新增 返工 + >返工
@@ -194,6 +198,18 @@ @closed="dialog.save = false" > + +