fix(tsoorder): 修复产线选择和表单验证逻辑问题
This commit is contained in:
parent
9592f36871
commit
dcd1833e0e
@ -134,8 +134,8 @@ export default {
|
||||
|
||||
const selectedData = this.selectedLines.map(line => ({
|
||||
lineId: line.id || line.lineId || '',
|
||||
lineCode: line.proLineCd,
|
||||
lineName: line.proLineName,
|
||||
lineCode: line.lineCode || line.proLineCd || '',
|
||||
lineName: line.lineName || line.proLineName || '',
|
||||
remark: line.remark || ""
|
||||
}));
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="baseForm.isAllLine" @change="handleisAllLineChange" />
|
||||
<el-checkbox v-model="baseForm.isAllLine" true-label="0" false-label="1" />
|
||||
<span style="margin-left: 5px;">所有产线</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -269,7 +269,7 @@ export default {
|
||||
planBgDate: "",
|
||||
processFlow: "",
|
||||
remark: "",
|
||||
isAllLine: false
|
||||
isAllLine: "1"
|
||||
},
|
||||
orderList: [],
|
||||
lineList: [],
|
||||
@ -451,44 +451,13 @@ export default {
|
||||
},
|
||||
|
||||
addLine() {
|
||||
this.baseForm.isAllLine = "0";
|
||||
this.baseForm.isAllLine = "1";
|
||||
this.lineModalVisible = true;
|
||||
},
|
||||
|
||||
handleisAllLineChange(val) {
|
||||
this.baseForm.isAllLine = val ? "1" : "0";
|
||||
if (val) {
|
||||
this.baseForm.isAllLine = val ? "0" : "1";
|
||||
this.lineList = [];
|
||||
request({
|
||||
url: "/api/example/proLine/getSelectList",
|
||||
method: "get"
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
const lines = res.data || [];
|
||||
if (lines.length > 10) {
|
||||
this.$message.warning("产线数量超过10条,请手动选择部分产线");
|
||||
this.baseForm.isAllLine = "0";
|
||||
return;
|
||||
}
|
||||
lines.forEach(line => {
|
||||
this.lineList.push({
|
||||
id: line.id,
|
||||
lineCode: line.lineCode,
|
||||
lineName: line.lineName,
|
||||
allocateQty: null,
|
||||
completedQty: null,
|
||||
planStartDate: "",
|
||||
planEndDate: "",
|
||||
remark: ""
|
||||
});
|
||||
});
|
||||
this.selectedLineCodes = this.lineList.map(item => item.lineCode);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.lineList = [];
|
||||
this.selectedLineCodes = [];
|
||||
}
|
||||
},
|
||||
|
||||
handleProLineConfirm(selectedLines) {
|
||||
@ -524,7 +493,11 @@ export default {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.validateOrderPlanQty()) return;
|
||||
if (this.lineList.length > 0 && !this.validateAllocateQty()) return;
|
||||
if (this.baseForm.isAllLine !== "0" && (!this.lineList || this.lineList.length === 0)) {
|
||||
this.$message.warning("请选择产线信息!");
|
||||
return;
|
||||
}
|
||||
if (this.baseForm.isAllLine !== "0" && this.lineList.length > 0 && !this.validateAllocateQty()) return;
|
||||
const submitData = this.prepareSubmitData();
|
||||
submitData.orderStatus = "0";
|
||||
this.generateCheck(submitData).then(() => {
|
||||
@ -537,7 +510,7 @@ export default {
|
||||
},
|
||||
|
||||
submit() {
|
||||
if (!this.lineList || this.lineList.length === 0) {
|
||||
if (this.baseForm.isAllLine !== "0" && (!this.lineList || this.lineList.length === 0)) {
|
||||
this.$message.warning("生产订单下发必须指定产线,请确认!");
|
||||
return;
|
||||
}
|
||||
@ -553,11 +526,17 @@ export default {
|
||||
if (res.code === 200) {
|
||||
resolve();
|
||||
} else {
|
||||
this.$message.error(res.msg || "检查失败");
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: res.msg || "检查失败!",
|
||||
});
|
||||
reject(res.msg);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error("检查接口调用失败");
|
||||
this.$message({
|
||||
type: "error",
|
||||
message: "检查接口调用失败!",
|
||||
});
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -570,8 +549,11 @@ export default {
|
||||
data: submitData
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
const message = submitData.orderStatus === "0" ? "保存成功" : "下发成功";
|
||||
this.$message.success(message);
|
||||
const message = submitData.orderStatus === "0" ? "保存成功!" : "下发成功!";
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: message,
|
||||
});
|
||||
this.goBack();
|
||||
}
|
||||
});
|
||||
@ -734,6 +716,12 @@ export default {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.base-form ::v-deep .el-input,
|
||||
.base-form ::v-deep .el-select,
|
||||
.base-form ::v-deep .el-date-picker {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -310,21 +310,29 @@ export default {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
})
|
||||
.then(() => {
|
||||
return request({
|
||||
url: "/api/example/proOrder/close",
|
||||
method: "post",
|
||||
data: { id: row.itemId }
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("关闭成功");
|
||||
this.initData();
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error("关闭失败");
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message.info('已取消关闭');
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: res.msg || "关闭成功!",
|
||||
});
|
||||
this.initData();
|
||||
} else {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: res.msg || "操作失败!",
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user