Commit d3a903ba by linjinhong

fix:修改问题

parent 73b1e52c
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
selectGridIndex: 0, selectGridIndex: 0,
pkg, pkg,
actionIndex: -1, actionIndex: -1,
// isAutoFinish: true, isAutoFinish: true,
isForcedProduction: false, isForcedProduction: false,
cacheVisible: false, cacheVisible: false,
showPrintDialog: false, showPrintDialog: false,
...@@ -124,7 +124,6 @@ export default { ...@@ -124,7 +124,6 @@ export default {
]) ])
}, },
mounted() { mounted() {
// console.log(pkg, "pkg");
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.searchRef?.focus(); this.$refs.searchRef?.focus();
if (this.desktopDevice !== 3) { if (this.desktopDevice !== 3) {
...@@ -191,6 +190,9 @@ export default { ...@@ -191,6 +190,9 @@ export default {
//更新数据到本地数据 //更新数据到本地数据
updateOrderInfoItem(this.detail.newId, this.detail, this.faceType); updateOrderInfoItem(this.detail.newId, this.detail, this.faceType);
} }
if (this.orderType == "OP") {
this.checkAndCompleteProduction(this.detail);
}
console.log("updateOrderInfoItemitem", item); console.log("updateOrderInfoItemitem", item);
console.log("本地数据updateOrderInfoItem:", getOrderInfoMap()); console.log("本地数据updateOrderInfoItem:", getOrderInfoMap());
} }
...@@ -230,23 +232,38 @@ export default { ...@@ -230,23 +232,38 @@ export default {
break; break;
} }
}, },
// 判断是否可完成生产
canCompleteProduction(data) { canCompleteProduction(data) {
if (!data) return false; console.log("saveImgList", data.saveImgList);
if (this.desktopDevice !== 3) return true; console.log(
const list = data?.saveImgList; "saveImgList",
if (!list?.length) return false; data.saveImgList?.every(el => el.power)
return list.every(el => el.power); );
if (!data?.saveImgList?.length) return false;
return data.saveImgList?.every(el => el.power) ?? false;
}, },
checkAndCompleteProduction(data) {
if (this.desktopDevice !== 3 || !this.canCompleteProduction(data)) return; // 校验并执行数据赋值
this.setData(data); 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))
) {
await this.setData(data);
}
}, },
// 扫码后直接调用scanProduce转至生产中(惠立彩需确保所有面下载完成) // 扫码后直接调用scanProduce转至生产中(惠立彩需确保所有面下载完成)
// 点击生产完成按钮,调用completeDelivery转至待配货 // 点击生产完成按钮,调用completeDelivery转至待配货
async setData(data, type) { async setData(data, type) {
if (!data) return this.$message.warning("请扫描生产单号/操作单号"); if (!data) return this.$message.warning("请扫描生产单号/操作单号");
if (!this.canCompleteProduction(data)) { if (this.desktopDevice == 3 && !this.canCompleteProduction(data)) {
if (type == "btn") { if (type == "btn") {
const item = data.saveImgList?.find(el => !el.power); const item = data.saveImgList?.find(el => !el.power);
this.$message.warning( this.$message.warning(
...@@ -260,6 +277,7 @@ export default { ...@@ -260,6 +277,7 @@ export default {
id: data.id, id: data.id,
orderType: this.orderType orderType: this.orderType
}; };
if (this.orderType === "CN") { if (this.orderType === "CN") {
params.podJomallOrderCnId = data.podJomallOrderCnId; params.podJomallOrderCnId = data.podJomallOrderCnId;
} else if (this.orderType === "US") { } else if (this.orderType === "US") {
...@@ -287,6 +305,7 @@ export default { ...@@ -287,6 +305,7 @@ export default {
value: data.newId, value: data.newId,
type: "completeMessage" type: "completeMessage"
}); });
this.$message.success("操作成功");
} else if (this.orderType == "OP") { } else if (this.orderType == "OP") {
bus.$emit("busEmit", { bus.$emit("busEmit", {
value: data.newId, value: data.newId,
...@@ -330,9 +349,8 @@ export default { ...@@ -330,9 +349,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);
} }
...@@ -652,11 +670,13 @@ export default { ...@@ -652,11 +670,13 @@ export default {
async getDataInfo(e, isForcedProduction) { async getDataInfo(e, isForcedProduction) {
//查询后先检查当前是否有数据,有则先走生产完成 //查询后先检查当前是否有数据,有则先走生产完成
if ( if (
this.detail && this.detail &&
Object.keys(this.detail).length > 0 && Object.keys(this.detail).length > 0 &&
this.isAutoFinish && this.isAutoFinish &&
this.user.factory.countryCode === "US" this.factoryType === "US" &&
this.orderType !== "OP"
) { ) {
try { try {
await this.setData(this.detail); await this.setData(this.detail);
...@@ -685,7 +705,7 @@ export default { ...@@ -685,7 +705,7 @@ export default {
//判断上一单未勾选添加当天日期是否跳过(us) //判断上一单未勾选添加当天日期是否跳过(us)
if ( if (
this.user.factory.countryCode === "US" && this.factoryType === "US" &&
!this.isAutoFinish && !this.isAutoFinish &&
today != getNowDate() today != getNowDate()
) { ) {
...@@ -749,10 +769,9 @@ export default { ...@@ -749,10 +769,9 @@ export default {
} }
this.detail = findByPodProductionNo.data; this.detail = findByPodProductionNo.data;
if (this.orderType == "OP") { if (this.orderType == "OP" && this.desktopDevice !== 3) {
this.checkAndCompleteProduction(this.detail); await this.setData(this.detail);
} }
//赋值当前扫码为生产单号的标识 //赋值当前扫码为生产单号的标识
if (!this.detail["newId"]) { if (!this.detail["newId"]) {
this.detail["newId"] = this.productionNo; this.detail["newId"] = this.productionNo;
...@@ -1245,9 +1264,7 @@ export default { ...@@ -1245,9 +1264,7 @@ export default {
</el-button> </el-button>
</div> </div>
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<el-checkbox <el-checkbox v-if="factoryType === 'US'" v-model="isAutoFinish"
v-if="user.factory.countryCode === 'US'"
v-model="isAutoFinish"
>自动完成上一单</el-checkbox >自动完成上一单</el-checkbox
> >
</div> </div>
......
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