Commit 59322509 by linjinhong

fix:修改简洁代码

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