fix:成品检验时批次选择实用xselect组件
This commit is contained in:
parent
25cd8c215a
commit
4c39c13007
|
@ -16,24 +16,19 @@
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :md="12" :sm="24">
|
<el-col :md="12" :sm="24">
|
||||||
<el-form-item label="物料批次" prop="batch">
|
<el-form-item label="物料批次" required="true">
|
||||||
<el-select
|
<xtSelect
|
||||||
v-model="form.batch"
|
:apiObj="apiObjBatch"
|
||||||
placeholder="物料批次"
|
v-model="form.batch"
|
||||||
clearable
|
v-model:obj="selectBatch"
|
||||||
filterable
|
:valueField="'batch'"
|
||||||
style="width: 100%"
|
:labelField="'batch'"
|
||||||
@change="handleChange"
|
style="width:100%"
|
||||||
:disabled="mode != 'add'"
|
@change="handleBatchChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-table-column label="物料批次" prop="batch"></el-table-column>
|
||||||
v-for="item in options"
|
<el-table-column label="数量" prop="count"></el-table-column>
|
||||||
:key="item.id"
|
</xtSelect>
|
||||||
:label="item.batch"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="12" :sm="24">
|
<el-col :md="12" :sm="24">
|
||||||
|
@ -104,6 +99,7 @@ export default {
|
||||||
emits: ["success", "closed"],
|
emits: ["success", "closed"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
apiObjBatch:this.$API.inm.warehouse.batch,
|
||||||
apiUserObj: this.$API.system.user.list,
|
apiUserObj: this.$API.system.user.list,
|
||||||
loading: false,
|
loading: false,
|
||||||
form: {
|
form: {
|
||||||
|
@ -126,6 +122,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
selectBatch:null,
|
||||||
visible: false,
|
visible: false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
options: [],
|
options: [],
|
||||||
|
@ -170,46 +167,38 @@ export default {
|
||||||
that.options = res;
|
that.options = res;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChange(val) {
|
handleBatchChange() {
|
||||||
let that = this;
|
let that = this;
|
||||||
console.log(val);
|
that.form.count = that.selectBatch.count;
|
||||||
that.options.forEach((item) => {
|
that.form.batch = that.selectBatch.batch;
|
||||||
if (item.id == val) {
|
that.form.material = that.selectBatch.material;
|
||||||
that.form.count = item.count;
|
that.form.mb = that.selectBatch.id;
|
||||||
that.form.batch = item.batch;
|
|
||||||
that.form.material = item.material;
|
|
||||||
that.form.mb = item.id;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
//提交
|
//提交
|
||||||
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;
|
||||||
try {
|
try {
|
||||||
if (this.mode == "add") {
|
if (that.mode == "add") {
|
||||||
this.$API.qm.ftestwork.create
|
that.$API.qm.ftestwork.create.req(that.form).then((res) => {
|
||||||
.req(this.form)
|
that.isSaveing = false;
|
||||||
.then((res) => {
|
that.visible = false;
|
||||||
this.isSaveing = false;
|
that.$emit("success");
|
||||||
this.visible = false;
|
that.$message.success("操作成功");
|
||||||
this.$emit("success");
|
}).catch(err => {that.isSaveing = false;});
|
||||||
this.$message.success("操作成功");
|
} else if (that.mode == "edit") {
|
||||||
});
|
that.$API.qm.ftestwork.update.req(that.form.id, that.form).then((res) => {
|
||||||
} else if (this.mode == "edit") {
|
that.isSaveing = false;
|
||||||
this.$API.qm.ftestwork.update
|
that.visible = false;
|
||||||
.req(this.form.id, this.form)
|
that.$emit("success");
|
||||||
.then((res) => {
|
that.$message.success("操作成功");
|
||||||
this.isSaveing = false;
|
}).catch(err => {that.isSaveing = false;});
|
||||||
this.visible = false;
|
|
||||||
this.$emit("success");
|
|
||||||
this.$message.success("操作成功");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//可以处理校验错误
|
//可以处理校验错误
|
||||||
this.isSaveing = false;
|
that.isSaveing = false;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue