diff --git a/src/views/wpm_bx/mlogb_check.vue b/src/views/wpm_bx/mlogb_check.vue index bbc3281b..6f23e431 100644 --- a/src/views/wpm_bx/mlogb_check.vue +++ b/src/views/wpm_bx/mlogb_check.vue @@ -26,109 +26,17 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ({{ item.note }}) - - - - @@ -156,32 +64,7 @@ export default { batch: null, count_real: 0, count_ok: 0, - count_notok: 0, - count_n_hs: 0, - count_n_qp: 0, - count_n_swen: 0, - count_n_bb: 0, - count_n_xbb:0, - count_n_md: 0, - count_n_xh: 0, - count_n_ps: 0, - count_n_qt: 0, - count_n_wm: 0, - count_n_zq:0 }, - notokOptions:[ - {name:"划伤",value:'count_n_hs'}, - {name:"气泡",value:'count_n_qp'}, - {name:"水纹",value:'count_n_swen'}, - {name:"崩边",value:'count_n_bb'}, - {name:"小崩边",value:'count_n_xbb'}, - {name:"麻点",value:'count_n_md'}, - {name:"划伤",value:'count_n_xh'}, - {name:"破损",value:'count_n_ps'}, - {name:"其他",value:'count_n_qt'}, - {name:"雾面",value:'count_n_wm'}, - {name:"棕圈",value:'count_n_zq'}, - ], //验证规则 rules: { batch: [ @@ -191,108 +74,28 @@ export default { trigger: "blur", }, ], - count_use: [ + count_real: [ { required: true, - message: "请填写领用数量", + message: "请填写生产数量", trigger: "blur", }, ], }, - options: [], - qct_defects:[], - qct_testitems:[], - count_notok_json:[], - materialOptions: [], visible: false, isSaveing: false, batchDisabled: false, }; }, mounted() { - if (this.form.batch != null) { - this.batchDisabled = true; - } - console.log(this.material); - this.getQctDetail(); }, methods: { open(data) { this.visible = true; Object.assign(this.form, data); - this.mgroupName = data.mgroup_name; - console.log(this.form); - }, - //根据物料关联的检测表获取检测项和不合格项 - getQctDetail(){ - let that = this; - that.$API.qm.qct.list.req({ qctmat__material: that.material,page:0 }).then((res) => { - if(res.length>0){ - that.qctId = res[0].id; - that.$API.qm.qct.item.req(that.qctId).then((res0) => { - //这里可以得到testitem和defectitem - that.qct_defects = []; - that.qct_testitems = []; - if(res0.qct_defects.length>0){ - res0.qct_defects.forEach((item1) => { - let obj = Object.assign({}, item1); - obj.value = ''; - that.qct_defects.push(obj); - }) - }else{ - that.qct_defects = []; - } - if(res0.qct_testitems.length>0){ - res0.qct_testitems.forEach((item2) => { - let obj2 = Object.assign({}, item2); - obj2.value = ''; - if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){ - let str = obj2.testitem_choices.replace(/'/g, '"'); - let arr = JSON.parse(str); - obj2.testitem_choices = arr; - } - that.qct_testitems.push(obj2); - }) - }else{ - that.qct_testitems = []; - } - that.defectCountSun(); - }) - } - }); - }, - defectCountSun(){ - let that = this; - that.qct_defects.forEach(item => { - let str = item.rule_expression.replace(/`/g, ''); - str = str.replace(/\${(.*?)}/g, 'this.form.\$1') - let judge = eval(str); - that.form['defect-'+item.defect_name] = judge; - }); - }, - notok_add(){ - this.count_notok_json.push({notok:'qt',count:null,floor:null,count_sampling:null}); - }, - notok_del(index){ - this.count_notok_json.splice(index, 1) - }, - countChange() { - this.form.count_notok = - this.form.count_n_hs + - this.form.count_n_qp + - this.form.count_n_swen + - this.form.count_n_bb + - this.form.count_n_xbb + - this.form.count_n_md + - this.form.count_n_xh + - this.form.count_n_ps + - this.form.count_n_zq + - this.form.count_n_qt + - this.form.count_n_wm; - this.form.count_ok = this.form.count_real - this.form.count_notok; }, countChanges(){ - this.form.count_ok = this.form.count_real - this.form.count_notok; + this.form.count_ok = this.form.count_real; }, //表单提交方法 submit() { @@ -301,44 +104,15 @@ export default { if (valid) { that.isSaveing = true; that.form.mlog = that.mlog; - let sum = 0; - if(that.mgroupName=='黑化'||that.mgroupName=='退火'){ - let total = 0; - that.count_notok_json.forEach(item => { - total+=item.count; - }); - this.form.count_notok = total; - this.form.count_notok_json = this.count_notok_json; - }else{ - this.form.count_notok = - this.form.count_n_hs + - this.form.count_n_qp + - this.form.count_n_swen + - this.form.count_n_bb + - this.form.count_n_xbb + - this.form.count_n_md + - this.form.count_n_xh + - this.form.count_n_ps + - this.form.count_n_zq + - this.form.count_n_qt + - this.form.count_n_wm; - } - sum = this.form.count_ok + this.form.count_notok; - if (sum - this.form.count_real == 0) { - that.$API.wpm.mlogb.updateOut - .req(that.form.id, that.form) - .then((res) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }) - .catch((err) => { - that.isSaveing = false; - }); - } else { - this.$message.error("使用数量与合格数不合格数数量不对等"); - } + that.form.count_ok = that.form.count_real; + that.$API.wpm.mlogb.updateOut.req(that.form.id, that.form).then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + }); } }); },