fix:车间领料和入库mioitem可多选
This commit is contained in:
parent
1524f6f414
commit
fdb7dbb8e8
|
@ -46,6 +46,7 @@
|
||||||
filterable
|
filterable
|
||||||
value-key="id"
|
value-key="id"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
|
multiple
|
||||||
@change="selectwmChange"
|
@change="selectwmChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -77,7 +78,6 @@
|
||||||
style="width:150px;margin-left: 4px;"
|
style="width:150px;margin-left: 4px;"
|
||||||
@keyup.enter="codeTextChange(codeText)"
|
@keyup.enter="codeTextChange(codeText)"
|
||||||
></el-input>
|
></el-input>
|
||||||
<!-- <scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog> -->
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="批次" v-if="cate == 'do_out'">
|
<el-form-item label="批次" v-if="cate == 'do_out'">
|
||||||
<el-select
|
<el-select
|
||||||
|
@ -85,8 +85,10 @@
|
||||||
value-key="id"
|
value-key="id"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
|
multiple
|
||||||
@change="selectBatchChange"
|
@change="selectBatchChange"
|
||||||
@clear="selectBatchClear"
|
@clear="selectBatchClear"
|
||||||
|
style="width: 60%;"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in batchOptions"
|
v-for="item in batchOptions"
|
||||||
|
@ -114,9 +116,52 @@
|
||||||
style="width:150px;margin-left: 4px;"
|
style="width:150px;margin-left: 4px;"
|
||||||
@keyup.enter="codeTextChange(codeText)"
|
@keyup.enter="codeTextChange(codeText)"
|
||||||
></el-input>
|
></el-input>
|
||||||
<!-- <scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog> -->
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="仓库" prop="warehouse">
|
<template v-if="cate == 'do_out'&&mode == 'add'">
|
||||||
|
<el-row v-for="item in selectList" :key="item.mb">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="批次号">
|
||||||
|
<el-input v-model="item.batch" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="仓库" label-width="60px">
|
||||||
|
<el-select
|
||||||
|
v-model="item.warehouse"
|
||||||
|
disabled
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in warehouseOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="数量" label-width="60px">
|
||||||
|
<el-input v-model="item.count" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
<template v-if="cate == 'do_in'&&mode == 'add'">
|
||||||
|
<el-row v-for="item in selectList" :key="item.mb">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="批次号">
|
||||||
|
<el-input v-model="item.batch" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="数量" label-width="60px">
|
||||||
|
<el-input v-model="item.count" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
<el-form-item label="仓库" prop="warehouse" v-if="(cate == 'do_in'&&mode == 'add')||mode == 'edit'" >
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.warehouse"
|
v-model="form.warehouse"
|
||||||
clearable
|
clearable
|
||||||
|
@ -130,7 +175,7 @@
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数量">
|
<el-form-item label="数量" v-if="mode == 'edit'">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="form.count"
|
v-model="form.count"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
@ -177,6 +222,7 @@ export default {
|
||||||
codeText: "",
|
codeText: "",
|
||||||
visible: false,
|
visible: false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
|
selectList: [],
|
||||||
materialOptions: [],
|
materialOptions: [],
|
||||||
batchOptions: [],
|
batchOptions: [],
|
||||||
inputBatchDisable: false,
|
inputBatchDisable: false,
|
||||||
|
@ -282,7 +328,6 @@ export default {
|
||||||
if(data==''||data==undefined||data==null){
|
if(data==''||data==undefined||data==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// data = data.replace(' ','');
|
|
||||||
let id = data.split('#')[1];
|
let id = data.split('#')[1];
|
||||||
this.$API.cm.labelmat.item.req(id).then((res) => {
|
this.$API.cm.labelmat.item.req(id).then((res) => {
|
||||||
console.log('res',res);
|
console.log('res',res);
|
||||||
|
@ -294,42 +339,37 @@ export default {
|
||||||
}
|
}
|
||||||
console.log('arr',arr);
|
console.log('arr',arr);
|
||||||
if(arr.length>0){
|
if(arr.length>0){
|
||||||
that.form.material = arr[0].material;
|
// that.selectBatch = arr[0].id;
|
||||||
that.selectBatch = arr[0].id;
|
if(that.mode == "add"){
|
||||||
that.form.batch = arr[0].batch;
|
that.selectBatch.push(arr[0].id);
|
||||||
that.form.count = arr[0].count;
|
let obj = {};
|
||||||
if(this.cate == 'do_out'){
|
obj.batch = arr[0].batch;
|
||||||
that.form.mb = arr[0].id;
|
obj.warehouse = arr[0].warehouse;
|
||||||
that.form.warehouse = arr[0].warehouse;
|
obj.mb = arr[0].id;
|
||||||
|
obj.count = Number(arr[0].count);
|
||||||
|
if(this.cate == 'do_out'){
|
||||||
|
obj.mb = arr[0].id;
|
||||||
|
obj.warehouse = arr[0].warehouse;
|
||||||
|
}else{
|
||||||
|
obj.wm = arr[0].id;
|
||||||
|
}
|
||||||
|
that.selectList.push(obj);
|
||||||
}else{
|
}else{
|
||||||
that.form.wm = arr[0].id;
|
that.selectBatch = arr[0].id;
|
||||||
|
that.form.material = arr[0].material;
|
||||||
|
that.form.batch = arr[0].batch;
|
||||||
|
that.form.count = arr[0].count;
|
||||||
|
if(this.cate == 'do_out'){
|
||||||
|
that.form.mb = arr[0].id;
|
||||||
|
that.form.warehouse = arr[0].warehouse;
|
||||||
|
}else{
|
||||||
|
that.form.wm = arr[0].id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
that.$message.error("该批次不存在")
|
that.$message.error("该批次不存在")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// that.form.batch = id;
|
|
||||||
// let arr = [];
|
|
||||||
// if(this.cate == 'do_out'){//领料---仓库
|
|
||||||
// arr = this.batchOptions.filter(item => item.batch == that.codeText);
|
|
||||||
// }else{//入库----工段
|
|
||||||
// arr = this.wbatchOptions.filter(item => item.batch == that.codeText);
|
|
||||||
// }
|
|
||||||
// console.log('arr',arr);
|
|
||||||
// if(arr.length>0){
|
|
||||||
// that.form.material = arr[0].material
|
|
||||||
// that.selectBatch = arr[0].id;
|
|
||||||
// that.form.batch = arr[0].batch;
|
|
||||||
// that.form.count = arr[0].count;
|
|
||||||
// if(this.cate == 'do_out'){
|
|
||||||
// that.form.mb = arr[0].id;
|
|
||||||
// that.form.warehouse = arr[0].warehouse;
|
|
||||||
// }else{
|
|
||||||
// that.form.wm = arr[0].id;
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// this.$message.warning("该物料没有库存");
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
selectMaterialChange() {
|
selectMaterialChange() {
|
||||||
this.getBatchOptions();
|
this.getBatchOptions();
|
||||||
|
@ -341,28 +381,53 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectBatchChange(id) {
|
selectBatchChange() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
console.log('selectBatch',that.selectBatch);
|
||||||
|
that.selectList = [];
|
||||||
that.batchOptions.forEach((item) => {
|
that.batchOptions.forEach((item) => {
|
||||||
if(item.id == id){
|
console.log('indexOfselectBatch',that.selectBatch.indexOf(item.id));
|
||||||
console.log('item',item);
|
if(that.mode == "add"){//领料
|
||||||
this.form.batch = item.batch;
|
if(that.selectBatch.indexOf(item.id)>-1){
|
||||||
this.form.warehouse = item.warehouse;
|
let obj = {};
|
||||||
this.form.mb = item.id;
|
console.log('item',item);
|
||||||
that.form.count = Number(item.count);
|
obj.batch = item.batch;
|
||||||
|
obj.warehouse = item.warehouse;
|
||||||
|
obj.mb = item.id;
|
||||||
|
obj.count = Number(item.count);
|
||||||
|
that.selectList.push(obj);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(item.id == id){
|
||||||
|
that.form.batch = item.batch;
|
||||||
|
that.form.warehouse = item.warehouse;
|
||||||
|
that.form.mb = item.id;
|
||||||
|
that.form.count = Number(item.count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//选择车间库存物料后的处理
|
//选择车间库存物料后的处理
|
||||||
selectwmChange(id){
|
selectwmChange(id){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.selectList = [];
|
||||||
that.wbatchOptions.forEach((item) => {
|
that.wbatchOptions.forEach((item) => {
|
||||||
if(item.id == id){
|
if(that.mode == "add"){//领料
|
||||||
console.log('item',item);
|
if(that.selectBatch.indexOf(item.id)>-1){
|
||||||
that.form.batch = item.batch;
|
let obj = {};
|
||||||
that.form.wm = item.id;
|
console.log('item',item);
|
||||||
that.form.count = Number(item.count);
|
obj.batch = item.batch;
|
||||||
}
|
obj.wm = item.id;
|
||||||
|
obj.count = Number(item.count);
|
||||||
|
that.selectList.push(obj);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(item.id == id){
|
||||||
|
that.form.batch = item.batch;
|
||||||
|
that.form.wm = item.id;
|
||||||
|
that.form.count = Number(item.count);
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
selectBatchClear() {
|
selectBatchClear() {
|
||||||
|
@ -380,25 +445,37 @@ export default {
|
||||||
},
|
},
|
||||||
//提交
|
//提交
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs.dialogForm.validate(async (valid) => {
|
let that = this;
|
||||||
|
that.$refs.dialogForm.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.isSaveing = true;
|
that.isSaveing = true;
|
||||||
this.form.mio = this.mioId;
|
that.form.mio = that.mioId;
|
||||||
try {
|
if(that.mode == "add"){
|
||||||
var res;
|
that.selectList.forEach((item) => {
|
||||||
if (this.mode == "add") {
|
let obj = {};
|
||||||
res = await this.$API.inm.mioitem.create.req(this.form);
|
obj = item;
|
||||||
} else if (this.mode == "edit") {
|
obj.mio = that.mioId;
|
||||||
res = await this.$API.inm.mioitem.update.req(this.form.id,this.form);
|
if(that.cate == 'do_out'){
|
||||||
}
|
obj.material = that.form.material;
|
||||||
this.isSaveing = false;
|
}else{
|
||||||
this.$emit("success");
|
obj.warehouse = that.form.warehouse;
|
||||||
this.visible = false;
|
}
|
||||||
this.$message.success("操作成功");
|
that.$API.inm.mioitem.create.req(obj).then((res) => {
|
||||||
} catch (err) {
|
that.isSaveing = false;
|
||||||
//可以处理校验错误
|
that.$emit("success");
|
||||||
this.isSaveing = false;
|
that.visible = false;
|
||||||
return err;
|
})
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
that.$API.inm.mioitem.update.req(that.form.id,that.form).then((res) => {
|
||||||
|
that.isSaveing = false;
|
||||||
|
that.$emit("success");
|
||||||
|
that.visible = false;
|
||||||
|
that.$message.success("操作成功");
|
||||||
|
}).then(() => {
|
||||||
|
that.isSaveing = false;
|
||||||
|
return err;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue