diff --git a/src/views/inm/mioitem_check.vue b/src/views/inm/mioitem_check.vue index 86f0a324..84b72d85 100644 --- a/src/views/inm/mioitem_check.vue +++ b/src/views/inm/mioitem_check.vue @@ -770,11 +770,11 @@ - + @@ -932,6 +932,13 @@ export default { trigger: "blur", }, ], + test_time: [ + { + required: true, + message: "请选择检验时间", + trigger: "blur", + }, + ], test_user: [ { required: true, @@ -956,6 +963,7 @@ export default { qct_testitems:[], qct_defects:[], qctId:'', + wproductId:'', }; }, watch: { @@ -989,6 +997,7 @@ export default { that.project_code = config_base.base_code; that.getUserList(); if(that.project_code=='bxerp'){ + that.wproductId = that.objitem.wproducts[0].id; this.getQctDetail(); }else{ if (that.type == "pur_in") { @@ -1185,88 +1194,124 @@ export default { //提交 submit() { let that = this; - if ( - (that.type == "do_in" && that.cate == "halfgood") || - that.type == "other_in" - ) { - this.form.count_notok = - this.form.count_n_zw + - this.form.count_n_tw + - this.form.count_n_qp + - this.form.count_n_wq + - this.form.count_n_dl + - this.form.count_n_pb + - this.form.count_n_dxt + - this.form.count_n_js + - this.form.count_n_qx + - this.form.count_n_hs + - this.form.count_n_ysq + - this.form.count_n_zz + - this.form.count_n_b + - this.form.count_n_qt; - } - if (that.type == "do_in" && that.cate == "good") { - this.form.count_notok = - this.form.count_n_hs + - this.form.count_n_cs + - this.form.count_n_zz + - this.form.count_n_tw + - this.form.count_n_d + - this.form.count_n_zdd + - this.form.count_n_zw + - this.form.count_n_dl + - //棒 - this.form.count_n_qp + - this.form.count_n_bl + - this.form.count_n_hw + - this.form.count_n_yp + - this.form.count_n_bp + - this.form.count_n_sc + - //管 - this.form.count_n_qx + - this.form.count_n_js + - this.form.count_n_tydd + - this.form.count_n_sw + - this.form.count_n_bhpcd + - this.form.count_n_wq; - } - that.$refs.dialogForm.validate(async (valid) => { - if (valid) { - that.isSaveing = true; - try { - if (that.type == "pur_in") { - console.log(that.form); - let arr = []; - that.weight_kgs.forEach((item) => { - arr.push(item.value); - }); - that.form.weight_kgs = arr; - console.log('that.form',that.form); - that.$API.inm.mioitem.testpurin - .req(that.mioitemId, that.form) - .then((res) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }); - } else { - that.$API.inm.mioitem.test - .req(that.mioitemId, that.form) - .then((res) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }); - } - } catch (err) { - //可以处理校验错误 - this.isSaveing = false; - return err; + if(that.project_code=='bxerp'){ + let defect_json = [],test_json = {}; + that.qct_testitems.forEach((item) => { + let val = that.form[item.testitem_name]; + let obj0 = {}; + obj0.val = val; + test_json[item.id] =obj0; + }) + that.qct_defects.forEach((item) => { + if(that.form[item.defect_name]){ + defect_json.push(item.id); } + }) + that.$refs.dialogForm.validate(async (valid) => { + if (valid) { + that.isSaveing = true; + let obj = {}; + obj.test_user = that.form.test_user; + obj.test_time = that.form.test_time; + obj.is_testok = that.form.is_testok; + obj.qct = that.qctId; + obj.note = that.form.test_note; + obj.test_json = test_json;// + obj.defect_json = defect_json;//defect为true的id数组 + that.$API.inm.mioitem.wtest.req(that.wproductId,obj).then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + }) + } + }) + }else{ + if ( + (that.type == "do_in" && that.cate == "halfgood") || + that.type == "other_in" + ) { + this.form.count_notok = + this.form.count_n_zw + + this.form.count_n_tw + + this.form.count_n_qp + + this.form.count_n_wq + + this.form.count_n_dl + + this.form.count_n_pb + + this.form.count_n_dxt + + this.form.count_n_js + + this.form.count_n_qx + + this.form.count_n_hs + + this.form.count_n_ysq + + this.form.count_n_zz + + this.form.count_n_b + + this.form.count_n_qt; } - }); + if (that.type == "do_in" && that.cate == "good") { + this.form.count_notok = + this.form.count_n_hs + + this.form.count_n_cs + + this.form.count_n_zz + + this.form.count_n_tw + + this.form.count_n_d + + this.form.count_n_zdd + + this.form.count_n_zw + + this.form.count_n_dl + + //棒 + this.form.count_n_qp + + this.form.count_n_bl + + this.form.count_n_hw + + this.form.count_n_yp + + this.form.count_n_bp + + this.form.count_n_sc + + //管 + this.form.count_n_qx + + this.form.count_n_js + + this.form.count_n_tydd + + this.form.count_n_sw + + this.form.count_n_bhpcd + + this.form.count_n_wq; + } + that.$refs.dialogForm.validate(async (valid) => { + if (valid) { + that.isSaveing = true; + try { + if (that.type == "pur_in") { + console.log(that.form); + let arr = []; + that.weight_kgs.forEach((item) => { + arr.push(item.value); + }); + that.form.weight_kgs = arr; + console.log('that.form',that.form); + that.$API.inm.mioitem.testpurin + .req(that.mioitemId, that.form) + .then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }); + } else { + that.$API.inm.mioitem.test + .req(that.mioitemId, that.form) + .then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }); + } + } catch (err) { + //可以处理校验错误 + this.isSaveing = false; + return err; + } + } + }); + } }, //表单注入数据 setData(data) {