Commit 59322509 by linjinhong

fix:修改简洁代码

parent d3a903ba
......@@ -135,6 +135,7 @@ export default {
}
});
this.$store.commit("changeDesktopDevice", getDesktopDevice());
this.isAutoFinish = false;
},
created() {
localStorage.setItem("desktoVersion", "print");
......@@ -234,32 +235,16 @@ export default {
},
// 判断是否可完成生产
canCompleteProduction(data) {
console.log("saveImgList", data.saveImgList);
console.log(
"saveImgList",
data.saveImgList?.every(el => el.power)
);
if (!data?.saveImgList?.length) return false;
return data.saveImgList?.every(el => el.power) ?? false;
},
// 校验并执行数据赋值
async checkAndCompleteProduction(data) {
const { desktopDevice } = this;
console.log("desktopDevice", desktopDevice);
console.log("canCompleteProduction", this.canCompleteProduction(data));
await this.$nextTick();
if (
desktopDevice !== 3 ||
(desktopDevice == 3 && this.canCompleteProduction(data))
) {
if (this.canCompleteProduction(data)) {
await this.setData(data);
}
},
// 扫码后直接调用scanProduce转至生产中(惠立彩需确保所有面下载完成)
// 点击生产完成按钮,调用completeDelivery转至待配货
async setData(data, type) {
if (!data) return this.$message.warning("请扫描生产单号/操作单号");
......@@ -292,25 +277,19 @@ export default {
try {
console.log("生产完成");
console.log("本地数据removeFromOrderInfo:", getOrderInfoMap());
if (type == "btn") {
await this.$api.post(
pathMap["completeDelivery"][this.orderType],
params
);
await removeFromOrderInfo(data.newId);
bus.$emit("busEmit", {
value: data.newId,
type: "completeMessage"
});
this.$message.success("操作成功");
} else if (this.orderType == "OP") {
bus.$emit("busEmit", {
value: data.newId,
type: "productingMessage"
});
// if (this.orderType !== "OP" && type == "btn") {
// await this.$api.post(
// pathMap["completeDelivery"][this.orderType],
// params
// );
// await removeFromOrderInfo(data.newId);
// bus.$emit("busEmit", {
// value: data.newId,
// type: "completeMessage"
// });
// this.$message.success("操作成功");
// } else
if (this.orderType == "OP") {
const { code, data: resData } = await this.$api.post(
pathMap["scanProduce"][this.orderType],
{ id: params.id, status: params.data.status }
......@@ -337,6 +316,12 @@ export default {
this.$refs.searchRef?.focus();
return;
}
if (this.desktopDevice == 3) {
bus.$emit("busEmit", {
value: data.newId,
type: "productingMessage"
});
}
} else {
await this.$api.post(
pathMap["completeDelivery"][this.orderType],
......@@ -349,8 +334,8 @@ export default {
type: "completeMessage"
});
}
this.$message.success("操作成功");
}
this.$message.success("操作成功");
} catch (error) {
console.error("setData 执行失败", error);
}
......@@ -769,9 +754,7 @@ export default {
}
this.detail = findByPodProductionNo.data;
if (this.orderType == "OP" && this.desktopDevice !== 3) {
await this.setData(this.detail);
}
//赋值当前扫码为生产单号的标识
if (!this.detail["newId"]) {
this.detail["newId"] = this.productionNo;
......@@ -825,6 +808,10 @@ export default {
}
}
if (this.orderType == "OP" && this.desktopDevice !== 3) {
await this.setData(this.detail);
}
let designImagesCanvasJsonList = this.detail.drParam;
//获取下载素材
await this.hasDesignImagesCanvasJsonList(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment