Commit b05935fc by linjinhong

fix:修改惠立彩生产图片逻辑

parent e654a4f1
......@@ -451,7 +451,6 @@ export default {
async hasDesignImagesCanvasJsonList(designImagesCanvasJsonList, bool) {
let imageResList = [];
let urlList = [];
// 当adjustable有值时 直接赋值宽高
if (
......@@ -493,27 +492,39 @@ export default {
// }
}
}
if (this.desktopDevice == 3) {
designImagesCanvasJsonList = JSON.parse(designImagesCanvasJsonList);
console.log("designImagesCanvasJsonList", designImagesCanvasJsonList);
if (!designImagesCanvasJsonList[0].images) {
this.dialogVisible = true;
return;
}
}
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
if (!imageResList.length && !bool) {
let newType = this.orderType;
if (this.orderType == "CN" && this.desktopDevice == 3) {
newType = this.orderType == "CN" ? "CNHLC" : "USHLC";
}
let res = await this.$api.post(
pathMap["downloadBySubOrderNumber"][newType],
{
ids: [this.detail.id],
device: this.desktopDevice,
orderType: this.orderType,
},
);
try {
let newType = this.orderType;
if (this.orderType == "CN" && this.desktopDevice == 3) {
newType = this.orderType == "CN" ? "CNHLC" : "USHLC";
}
let res = await this.$api.post(
pathMap["downloadBySubOrderNumber"][newType],
{
ids: [this.detail.id],
device: this.desktopDevice,
orderType: this.orderType,
},
);
if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => {
imageResList = imageResList.concat(el.list || []);
});
if (this.desktopDevice == 3) urlList = res.data.map((el) => el.url);
if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => {
imageResList = imageResList.concat(el.list || []);
});
} catch (error) {
this.dialogVisible = true;
}
} else if (bool) {
//如果有本地数据 则直接获取本地数据同图片
imageResList = this.detail?.saveImgList || [];
......@@ -546,7 +557,6 @@ export default {
type: "sendFile",
value: [...newImgList],
productMark: this.detail.productMark,
urls: urlList,
};
if (
......@@ -891,6 +901,14 @@ export default {
clearArray() {
setOrderInfo([]);
},
forcedProductionFN(bool) {
if (bool) this.isForcedProduction = true;
},
closeDialog() {
this.detail = null;
this.$store.commit("setProductDetail", {});
this.dialogVisible = false;
},
},
};
</script>
......@@ -1122,11 +1140,11 @@ export default {
<div style="margin-left: 10px;">
<el-checkbox v-model="isAutoFinish">自动完成上一单</el-checkbox>
</div>
<div style="margin-left: 10px;" v-if="desktopDevice == 3">
<!-- <div style="margin-left: 10px;" v-if="desktopDevice == 3">
<el-checkbox v-model="isForcedProduction" style="color: red;"
>自动强制生产</el-checkbox
>
</div>
</div> -->
<div style="margin-left: 10px;" v-show="desktopDevice != 3">
<el-checkbox v-model="checked">自动裁切</el-checkbox>
</div>
......@@ -1184,6 +1202,25 @@ export default {
<el-button @click="clearCache" type="primary">清除</el-button>
</template>
</el-dialog>
<el-dialog
title="警告:无法直接生产"
:visible.sync="dialogVisible"
width="30%"
>
<div>
素材效果已经超出台版范围,无法直接打印。请更换打印设
备,或者进行强制生产
</div>
<div>:“自动强制生产”会让每次生产都强制生产</div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取消</el-button>
<!-- <el-button @click="forcedProductionFN">强制生产</el-button>
<el-button @click="forcedProductionFN(true)" style="color: red;"
>自动强制生产</el-button
> -->
</span>
</el-dialog>
</div>
</template>
......
......@@ -273,36 +273,44 @@ export default {
productDetail(newValue) {
this.detail = { ...newValue };
console.log(325, this.detail);
if (this.newDesktopDevice == 3) {
this.logList.unshift(
`订单:${this.detail.newId}-${
this.selectImgList.length > 1 ? this.faceType : "S"
}面 已查询`,
);
}
try {
if (typeof this.detail.imageAry == "string") {
this.detail.imageAry = JSON.parse(this.detail.imageAry);
if (Object.keys(this.detail).length) {
if (this.newDesktopDevice == 3) {
this.logList.unshift(
`订单:${this.detail.newId}-${
this.selectImgList.length > 1 ? this.faceType : "S"
}面 已查询`,
);
}
} catch (error) {
console.log(error);
try {
if (typeof this.detail.imageAry == "string") {
this.detail.imageAry = JSON.parse(this.detail.imageAry);
}
} catch (error) {
console.log(error);
this.detail.imageAry = [{ title: "正", url: this.detail.imageAry }];
}
this.detail.imageAry = [{ title: "正", url: this.detail.imageAry }];
}
this.detail.imageAry = this.detail.imageAry.sort((a, b) => {
// 检查 a.title 是否为 '正' 或 'A'
const isAPriority = a.title === "正" || a.title === "A";
// 检查 b.title 是否为 '正' 或 'A'
const isBPriority = b.title === "正" || b.title === "A";
// 如果 a 是优先项而 b 不是,a 排前面
if (isAPriority && !isBPriority) return -1;
// 如果 b 是优先项而 a 不是,b 排前面
if (!isAPriority && isBPriority) return 1;
// 其他情况保持原顺序(稳定排序)
return 0;
});
this.detail.imageAry = this.detail.imageAry.sort((a, b) => {
// 检查 a.title 是否为 '正' 或 'A'
const isAPriority = a.title === "正" || a.title === "A";
// 检查 b.title 是否为 '正' 或 'A'
const isBPriority = b.title === "正" || b.title === "A";
// 如果 a 是优先项而 b 不是,a 排前面
if (isAPriority && !isBPriority) return -1;
// 如果 b 是优先项而 a 不是,b 排前面
if (!isAPriority && isBPriority) return 1;
// 其他情况保持原顺序(稳定排序)
return 0;
});
} else {
this.imgList = [];
this.selectImgList = [];
this.selectIndex = -1;
this.selectImgIndex = 0;
}
// console.log(249, this.detail.imageAry);
},
......@@ -778,7 +786,7 @@ export default {
rate = height_px / width_px;
// }
if (this.newDesktopDevice == 3 && imgType) {
if (this.newDesktopDevice == 3) {
const scale = bh / data.height;
width_px = data.width * scale;
height_px = data.height * scale;
......@@ -1807,7 +1815,8 @@ export default {
selectImgList.length &&
!isOver &&
!isMove &&
!selectImgList.some((el) => el.isCut)
!selectImgList.some((el) => el.isCut) &&
newDesktopDevice !== 3
"
>
<b style="color:green">该单无需拖动设计,直接打印</b>
......@@ -1816,27 +1825,31 @@ export default {
class="print-tip"
:style="{ left: isView ? '' : '6%' }"
v-if="
productMark == 'custom_part' && selectImgList.length && isOver
productMark == 'custom_part' &&
selectImgList.length &&
isOver &&
newDesktopDevice !== 3
"
>
<b style="color:red"
>素材效果已经超出台版范围,请更换更大台版或和客户协调沟通</b
>
</div>
<div class="print-tip" :style="{ left: isView ? '' : '22%' }">
<b
<div
class="print-tip"
:style="{ left: isView ? '' : '22%' }"
v-if="
newDesktopDevice == 3 &&
productMark == 'custom_part' &&
detail.productMark
"
>
<!-- <b
style="color:red"
v-if="
selectImgList.length &&
newDesktopDevice == 3 &&
isOver &&
!isForcedProduction
"
v-if="!selectImgList.length && !isForcedProduction"
>该生产单素材已经被强制调整适配台版大小,请关注</b
>
<b
style="color:green"
v-if="selectImgList.length && newDesktopDevice == 3 && !isOver"
> -->
<b style="color:green" v-if="selectImgList.length"
>该单无需拖动设计,直接打印</b
>
</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