From 0752000f248ff57cc8fc1186f883ecc9bf24da96 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 21 Nov 2024 13:27:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:coding=E4=BA=A4=E6=8E=A5=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_gx/handover_form.vue | 213 ++++++++++++++++++++++------- 1 file changed, 167 insertions(+), 46 deletions(-) diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index a40c8648..52d4f5a1 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -113,6 +113,11 @@ + + + + + @@ -121,7 +126,58 @@ + + + + + + + + + + + + + + + + + {{ listItem.count_cando }} + + + + + + + + + + + + + +
总计:{{ totalCount }}
+
+ 确定 @@ -273,18 +329,50 @@ export default { }, ], }, + listParams:{ + + }, + totalCount: 0, + optionNames:[""], + optionItems:[], deptID:'', userList: [], userList2: [], deptOptions:[], mgroupOptions: [], materialOptions: [], + addShow: false, visible: false, scanVisible:false, isSaveing: false, setFiltersVisible: false, + listApiObj:this.$API.wpm.wmaterial.list, }; }, + watch: { + optionItems: { + handler: function (val) { + let that = this; + that.optionNames = []; + that.form.handoverb = []; + let totalCount = 0; + val.forEach(item=>{ + let obj = new Object(); + obj.wm = item.id; + obj.batch = item.batch; + obj.name = item.material_name; + obj.count_cando = item.count_cando; + obj.count = item.count_cando; + obj.notok_sign = item.notok_sign; + that.form.handoverb.push(obj); + that.optionNames.push(item.id) + totalCount += item.count_cando; + }) + that.totalCount = totalCount; + }, + deep: true, + }, + }, mounted() { let that = this; that.form.type = that.type; @@ -347,51 +435,53 @@ export default { count_xtest__isnull:1 }; if(that.mgroupName=="size"){ - that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => { - if(res.length>0){ - req.belong_dept=res[0].id; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - let arr = []; - res.forEach(item=>{ - let obj = {}; - Object.assign(obj,item); - obj.label = item.batch; - arr.push(obj); - }) - that.materialOptions = arr; - }); - } - }) - }else if(that.mgroupName=="facade"){ - that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => { - if(res.length>0){ - req.belong_dept=res[0].id; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - let arr = []; - res.forEach(item=>{ - let obj = {}; - Object.assign(obj,item); - obj.label = item.batch; - arr.push(obj); - }) - that.materialOptions = arr; - }); - } - }) - }else{ - req.mgroupx = that.mgroupId; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - let arr = []; - res.forEach(item=>{ - let obj = {}; - Object.assign(obj,item); - obj.label = item.batch; - arr.push(obj); + that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => { + if(res.length>0){ + req.belong_dept=res[0].id; + that.listParams = req; + this.$API.wpm.wmaterial.list.req(req).then((res) => { + let arr = []; + res.forEach(item=>{ + let obj = {}; + Object.assign(obj,item); + obj.label = item.batch; + arr.push(obj); + }) + that.materialOptions = arr; + }); + } }) - that.materialOptions = arr; - }); - } - + }else if(that.mgroupName=="facade"){ + that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => { + if(res.length>0){ + req.belong_dept=res[0].id; + that.listParams = req; + this.$API.wpm.wmaterial.list.req(req).then((res) => { + let arr = []; + res.forEach(item=>{ + let obj = {}; + Object.assign(obj,item); + obj.label = item.batch; + arr.push(obj); + }) + that.materialOptions = arr; + }); + } + }) + }else{ + req.mgroupx = that.mgroupId; + that.listParams = req; + this.$API.wpm.wmaterial.list.req(req).then((res) => { + let arr = []; + res.forEach(item=>{ + let obj = {}; + Object.assign(obj,item); + obj.label = item.batch; + arr.push(obj); + }) + that.materialOptions = arr; + }); + } }, //获取车间不合格物料 getMaterialNotok() { @@ -402,6 +492,7 @@ export default { notok_sign__isnull : 0, count_xtest__isnull:1 }; + that.listParams = req; this.$API.wpm.wmaterial.list.req(req).then((res) => { let arr = []; res.forEach(item=>{ @@ -451,10 +542,12 @@ export default { }); }, addMaterial(){ - this.form.handoverb.push({wm:'',count:'',counts:null}); + this.addShow = true; + // this.form.handoverb.push({wm:'',count:'',counts:null}); }, delMaterial(index){ this.form.handoverb.splice(index,1); + this.countChange(); }, //显示 open(mode = "add") { @@ -471,6 +564,28 @@ export default { this.form.handoverb[index].counts = data[0].count; this.form.handoverb[index].count = data[0].count; }, + countChange(){ + let that = this; + let totalCount = 0; + if(this.form.handoverb.length>0){ + this.form.handoverb.forEach(item=>{ + totalCount += item.count; + }) + that.totalCount = totalCount; + } + }, + //初始化 + init() { + this.form = { + handoverb: [], + handovera: [], + handoverc: [], + handoverd: [], + } + this.form.handoverb.forEach(item=>{ + + }) + }, //提交 submit() { let that = this; @@ -577,4 +692,10 @@ export default { margin-bottom: 10px; font-weight: 600; } +.total-count{ + width: 100%; + text-align: right; + height: 50px; + line-height: 50px; +}