diff --git a/src/views/inm/mioitem_form.vue b/src/views/inm/mioitem_form.vue index 7ee5c7b8..1f52f301 100644 --- a/src/views/inm/mioitem_form.vue +++ b/src/views/inm/mioitem_form.vue @@ -90,6 +90,7 @@ v-model="selectBatch" value-key="id" clearable + :multiple="project_code=='gz'&&form.type == 'sale_out'" filterable remote = "true" :style="divStyle" @@ -581,6 +582,13 @@ export default { that.form.count = Number(that.selectObj.count_canmio); that.mTracking = that.selectObj.material_.tracking; that.selectBatchChange(that.selectObj) + }else if(that.type == "sale_out"&&that.project_code=='gz'){ + that.form.material = that.selectObj.id; + that.form.unit = that.selectObj.unit; + that.form.unit_price = that.selectObj.unit_price; + that.mTracking = that.selectObj.tracking; + that.selectBatch = []; + that.getBatchOptions(); }else{ var type = this.form.type; that.form.material = that.selectObj.id; @@ -616,6 +624,26 @@ export default { let that = this; that.wprList = []; that.mioitems = []; + // gz 销售发货:多选批次 + if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(items)){ + if(items.length === 0){ + that.form.batch = ""; + that.form.mb = ""; + that.form.count = 0; + that.batchcount = 0; + that.form.warehouse = ""; + that.inputBatchDisable = false; + return; + } + let totalCount = items.reduce((sum, it) => sum + Number(it.count_canmio || 0), 0); + that.form.batch = items.map(it => it.batch).join(','); + that.form.mb = items.map(it => it.id).join(','); + that.form.count = totalCount; + that.batchcount = totalCount; + that.form.warehouse = items[0].warehouse; + that.inputBatchDisable = true; + return; + } if(items){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ let count = 0; @@ -876,7 +904,21 @@ export default { try { let res; if (that.mode == "add") { - res = await that.$API.inm.mioitem.create.req(that.form); + if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(that.selectBatch) && that.selectBatch.length > 0){ + let payload = that.selectBatch.map(b => ({ + mio: that.mioId, + material: that.form.material, + batch: b.batch, + mb: b.id, + count: Number(b.count_canmio), + warehouse: b.warehouse, + unit_price: that.form.unit_price, + note: that.form.note || '' + })); + res = await that.$API.inm.mioitem.create.req(payload); + } else { + res = await that.$API.inm.mioitem.create.req(that.form); + } } else if (that.mode == "edit") { res = await that.$API.inm.mioitem.update.req(that.form.id,that.form); }