fix:库存交接时新增表单验证
This commit is contained in:
parent
f83983578f
commit
f16f649dc4
|
@ -12,7 +12,7 @@
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="120px"
|
label-width="120px"
|
||||||
>
|
>
|
||||||
<el-form-item label="物料" v-if="cate == 'do_out'">
|
<el-form-item label="物料" v-if="cate == 'do_out'" prop="material">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.material"
|
v-model="form.material"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="物料批次" v-else>
|
<el-form-item label="物料批次" v-else prop="batch">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.batch"
|
v-model="form.batch"
|
||||||
filterable
|
filterable
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
|
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="仓库">
|
<el-form-item label="仓库" prop="warehouse">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.warehouse"
|
v-model="form.warehouse"
|
||||||
clearable
|
clearable
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
<el-form-item label="数量">
|
<el-form-item label="数量">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="form.count"
|
v-model="form.count"
|
||||||
:min="0"
|
:min="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
|
@ -144,9 +144,13 @@ export default {
|
||||||
do_out: "生产领料",
|
do_out: "生产领料",
|
||||||
do_in: "生产入库",
|
do_in: "生产入库",
|
||||||
},
|
},
|
||||||
form: {},
|
form: {
|
||||||
|
count:1
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
material: [{required: true,message: "请选择物料",trigger: "blur",},],
|
material: [{required: true,message: "请选择物料",trigger: "blur"}],
|
||||||
|
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
|
||||||
|
warehouse: [{required: true,message: "请选择仓库",trigger: "blur"}],
|
||||||
},
|
},
|
||||||
visible: false,
|
visible: false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
|
@ -158,6 +162,7 @@ export default {
|
||||||
selectBatchDisable: false,
|
selectBatchDisable: false,
|
||||||
selectMaterial: null,
|
selectMaterial: null,
|
||||||
selectBatch: null,
|
selectBatch: null,
|
||||||
|
mioitemlist:[],
|
||||||
wbatchOptions: [],//工段物料批次
|
wbatchOptions: [],//工段物料批次
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -168,6 +173,7 @@ export default {
|
||||||
this.inputBatchDisable = true;
|
this.inputBatchDisable = true;
|
||||||
this.getMaterialOptions();
|
this.getMaterialOptions();
|
||||||
this.getBatchOptions();
|
this.getBatchOptions();
|
||||||
|
this.getList();
|
||||||
}else{//入库----工段
|
}else{//入库----工段
|
||||||
this.getMgroupWmaterial();
|
this.getMgroupWmaterial();
|
||||||
}
|
}
|
||||||
|
@ -180,6 +186,14 @@ export default {
|
||||||
this.warehouseOptions = res;
|
this.warehouseOptions = res;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getList(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.inm.mioitem.list.req({mio:that.mioId,page:0}).then(res=>{
|
||||||
|
console.log('mioitemlist',res);
|
||||||
|
that.mioitemlist = res;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
//获取物料列表
|
//获取物料列表
|
||||||
getMaterialOptions() {
|
getMaterialOptions() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -240,9 +254,21 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectBatchChange(item) {
|
selectBatchChange(item) {
|
||||||
this.form.batch = item.batch;
|
let that = this;
|
||||||
this.form.mb = item.id;
|
if(item&&item.batch){
|
||||||
this.form.warehouse = item.warehouse;
|
let arr = this.mioitemlist.filter((mioitem) => {
|
||||||
|
return mioitem.batch == item.batch;
|
||||||
|
});
|
||||||
|
console.log('arr',arr);
|
||||||
|
if(arr.length > 0){
|
||||||
|
this.$message.error('该批次已存在');
|
||||||
|
that.selectBatchClear();
|
||||||
|
}else{
|
||||||
|
this.form.batch = item.batch;
|
||||||
|
this.form.mb = item.id;
|
||||||
|
this.form.warehouse = item.warehouse;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//选择车间库存物料后的处理
|
//选择车间库存物料后的处理
|
||||||
selectwmChange(val){
|
selectwmChange(val){
|
||||||
|
@ -254,6 +280,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
selectBatchClear() {
|
selectBatchClear() {
|
||||||
|
this.selectBatch = "";
|
||||||
this.form.batch = "";
|
this.form.batch = "";
|
||||||
this.form.mb = "";
|
this.form.mb = "";
|
||||||
this.form.warehouse = "";
|
this.form.warehouse = "";
|
||||||
|
@ -266,24 +293,25 @@ 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 {
|
try {
|
||||||
var res;
|
var res;
|
||||||
if (this.mode == "add") {
|
if (that.mode == "add") {
|
||||||
res = await this.$API.inm.mioitem.create.req(this.form);
|
res = await that.$API.inm.mioitem.create.req(that.form);
|
||||||
} else if (this.mode == "edit") {
|
} else if (that.mode == "edit") {
|
||||||
res = await this.$API.inm.mioitem.update.req(this.form.id,this.form);
|
res = await that.$API.inm.mioitem.update.req(that.form.id,that.form);
|
||||||
}
|
}
|
||||||
this.isSaveing = false;
|
that.isSaveing = false;
|
||||||
this.$emit("success");
|
that.$emit("success");
|
||||||
this.visible = false;
|
that.visible = false;
|
||||||
this.$message.success("操作成功");
|
that.$message.success("操作成功");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//可以处理校验错误
|
//可以处理校验错误
|
||||||
this.isSaveing = false;
|
that.isSaveing = false;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue