diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index 52d4f5a1..9b1cc372 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -123,25 +123,38 @@ 手动添加 - - - - - - - - - - + + + + + + {{ item.batch }} +
+ {{ item.count }} + + ({{ item.notok_sign_name }}) + +
+
+
+
+
+
@@ -177,61 +190,6 @@
总计:{{ totalCount }}
- 确定 @@ -262,6 +220,7 @@ export default { }, data() { return { + selectItems:[], yseorno: ["是", "否"], loading: false, mode: "add", @@ -333,8 +292,6 @@ export default { }, totalCount: 0, - optionNames:[""], - optionItems:[], deptID:'', userList: [], userList2: [], @@ -346,33 +303,8 @@ export default { 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; @@ -440,14 +372,7 @@ export default { 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 = res; }); } }) @@ -457,14 +382,7 @@ export default { 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 = res; }); } }) @@ -472,14 +390,7 @@ export default { 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; + that.materialOptions = res; }); } }, @@ -494,14 +405,7 @@ export default { }; 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+'('+item.notok_sign_name+')'; - arr.push(obj); - }) - that.materialOptions = arr; + that.materialOptions = res; }); }, //获取交送工段人员 @@ -515,9 +419,9 @@ export default { getCkUserList() { let that = this; this.$API.system.user.list.req({ page: 0, posts__code: "inm&check" }) - .then((res) => { - that.userList2 = res; - }); + .then((res) => { + that.userList2 = res; + }); }, //获取接收工段人员 getUserList2() { @@ -543,7 +447,6 @@ export default { }, addMaterial(){ this.addShow = true; - // this.form.handoverb.push({wm:'',count:'',counts:null}); }, delMaterial(index){ this.form.handoverb.splice(index,1); @@ -555,14 +458,19 @@ export default { this.visible = true; return this; }, - materialChange(index) { - let val = this.form.handoverb[index].wm; - let data = this.materialOptions.filter((item) => { - return item.id == val; + materialChange() { + let that = this; + let totalCount = 0; + let data = that.materialOptions.filter((item) => { + return that.selectItems.indexOf(item.id)>-1; }); - this.form.handoverb[index].batch = data[0].batch; - this.form.handoverb[index].counts = data[0].count; - this.form.handoverb[index].count = data[0].count; + data.forEach(item=>{ + item.vm = item.id; + item.count = item.count_cando; + totalCount += item.count_cando; + }) + that.totalCount = totalCount; + that.form.handoverb = data; }, countChange(){ let that = this; @@ -574,18 +482,6 @@ export default { that.totalCount = totalCount; } }, - //初始化 - init() { - this.form = { - handoverb: [], - handovera: [], - handoverc: [], - handoverd: [], - } - this.form.handoverb.forEach(item=>{ - - }) - }, //提交 submit() { let that = this; @@ -647,9 +543,6 @@ export default { scanCode(){ let that = this; that.scanVisible = true; - // that.$nextTick(() => { - // that.$refs.scanDialog.open(); - // }); }, scanClose(data){ if(data==''||data==undefined||data==null){ @@ -659,17 +552,14 @@ export default { let id = data.split('#')[1]; console.log('id',id); this.$API.cm.labelmat.item.req(id).then((res) => { - // console.log('res',res); let arr = that.form.handoverb.filter((item) => { return item.batch == res.batch; }) - // console.log('arr',arr); if(arr.length>0){ that.$message.error("该批次已存在") }else{ that.materialOptions.forEach((item) => { if(item.batch == res.batch){ - // let arr = that.form.handoverb let obj = {}; obj.wm = item.id; obj.batch = item.batch;