diff --git a/src/api/model/inm.js b/src/api/model/inm.js index 0bd7190d..c4f8c30c 100644 --- a/src/api/model/inm.js +++ b/src/api/model/inm.js @@ -138,5 +138,13 @@ export default { data); } }, + testpurin: { + name: "入场检验", + req: async function(id,data){ + return await http.post( + `${config.API_URL}/inm/mioitem/${id}/test_pur_in/`, + data); + } + }, } } \ No newline at end of file diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue index add29f99..aaf8f267 100644 --- a/src/views/inm/mioitem.vue +++ b/src/views/inm/mioitem.vue @@ -66,6 +66,7 @@ @success="handleSaveSuccess" @closed="dialog.save = false"> @@ -100,12 +101,14 @@ export default { 'other_in': '其他入库', 'other_out': '其他出库', }, - mioitemId:'', +mioitemId:'', type:'', cate:'', + objitem:{}, }; }, mounted() { + this.type = this.$route.query.type; this.cate = this.$route.query.cate; this.mioId = this.$route.query.mio; this.params.mio = this.$route.query.mio; @@ -155,15 +158,17 @@ export default { }).catch(() => { }); }, table_check(row){ - this.dialog.check = true; this.mioitemId = row.id; + this.objitem = row; + this.dialog.check = true; this.$nextTick(() => { this.$refs.checkDialog.open("add"); }); }, check_Show(row){ - this.dialog.check = true; this.mioitemId = row.id; + this.objitem = row; + this.dialog.check = true; this.$nextTick(() => { this.$refs.checkDialog.open("show").setData(row); }); diff --git a/src/views/inm/mioitem_check.vue b/src/views/inm/mioitem_check.vue index 630c5788..3ff3fbab 100644 --- a/src/views/inm/mioitem_check.vue +++ b/src/views/inm/mioitem_check.vue @@ -12,9 +12,9 @@ ref="dialogForm" :model="form" :rules="rules" - label-width="100px" + label-width="140px" > - + + + + + + {{ objitem.material_name }} + + + + + {{ objitem.batch }} + + + + + {{ objitem.count }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -123,16 +226,23 @@ export default { emits: ["success", "closed"], props: { mioitemId: { type: String, default: "" }, + type: { type: String, default: "" }, + cate: { type: String, default: "" }, + objitem: { type: Object, default: () => {}}, }, data() { return { loading: false, - form: {}, + form: { + weight_kgs:[], + }, rules: { test_date: [{required: true, message: "请选择检验日期", trigger: "blur"}], test_user: [{required: true, message: "请选择检验人", trigger: "blur"}], count_notok: [{required: true, message: "请填写不合格数", trigger: "blur"}], }, + mioItem: {}, + weight_kgs:[{value:0}], visible: false, isSaveing: false, userList:[], @@ -146,6 +256,12 @@ export default { }, mounted() { this.getUserList(); + let that = this; + if(that.type=='pur_in'){ + that.form.material_name = that.objitem.material_name; + that.form.batch = that.objitem.batch; + that.form.count_bag = that.objitem.count; + } }, methods: { //显示 @@ -161,18 +277,58 @@ export default { that.userList = res.results; }); }, + addWeight(){ + this.weight_kgs.push({value:0}); + this.form.weight_kgs_count = this.weight_kgs.length; + }, + delWeight(index){ + this.weight_kgs.splice(index,1); + this.form.weight_kgs_count = this.weight_kgs.length; + }, + countSun(){ + let that = this; + let sum = 0; + console.log('change') + that.weight_kgs.forEach(item=>{ + sum = sum+item.value; + }) + that.form.count_bag_weight_all = sum/that.weight_kgs.length*that.objitem.count; + }, //提交 submit() { - this.$refs.dialogForm.validate(async (valid) => { + let that = this; + that.$refs.dialogForm.validate(async (valid) => { if (valid) { - this.isSaveing = true; + that.isSaveing = true; try { - this.$API.inm.mioitem.test.req(this.mioitemId,this.form).then(res=>{ - this.isSaveing = false; - this.$emit("success"); - this.visible = false; - this.$message.success("操作成功"); - }) + if(that.type=='pur_in'){ + console.log(that.form); + let arr = []; + that.weight_kgs.forEach(item=>{ + arr.push(item.value); + }) + let obj = {}; + obj.test_date = that.form.test_date; + obj.test_user = that.form.test_user; + obj.count_bag = that.objitem.count; + obj.weight_kgs = arr; + obj.is_testok = that.form.is_testok; + console.log(obj) + that.$API.inm.mioitem.testpurin.req(that.mioitemId,obj).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; @@ -183,8 +339,23 @@ export default { }, //表单注入数据 setData(data) { - Object.assign(this.form, data); - this.form.test_group = this.form.split(',') + let that = this; + Object.assign(that.form, data); + // that.form.test_group = that.form.split(','); + that.weight_kgs = []; + console.log(data.weight_kgs) + if(data.weight_kgs.length>0){ + that.form.weight_kgs_count = data.weight_kgs.length; + let sum = 0; + data.weight_kgs.forEach((item)=>{ + sum = sum+item; + let obj = {}; + obj.value = item; + that.weight_kgs.push(obj) + }) + that.form.count_bag_weight_all =sum/data.weight_kgs.length*data.count; + } + }, //设置过滤项 setFilters(filters) { diff --git a/src/views/qm/income.vue b/src/views/qm/income.vue index 90d563b4..86638aa7 100644 --- a/src/views/qm/income.vue +++ b/src/views/qm/income.vue @@ -2,7 +2,7 @@
-
+
- + - + - + - + - + - + - + - + - + + + + + + + + + +