Commit f03769d1 by linjinhong

Merge branch 'test'

parents b02a9b32 b753e82f
...@@ -158,38 +158,48 @@ export default { ...@@ -158,38 +158,48 @@ export default {
const downloadBySubOrderNumber = pathMap["downloadBySubOrderNumber"]; const downloadBySubOrderNumber = pathMap["downloadBySubOrderNumber"];
try { try {
let url = downloadBySubOrderNumber[params.orderType]; let url = downloadBySubOrderNumber[params.orderType];
let postUrl = `${env}/${url}`;
if (params.device == 3) { if (params.device == 3) {
url = url =
params.orderType == "CN" params.orderType == "CN"
? downloadBySubOrderNumber["CNHLC"] ? downloadBySubOrderNumber["CNHLC"]
: downloadBySubOrderNumber["USHLC"]; : downloadBySubOrderNumber["USHLC"];
postUrl = `${env}/${url}?forceProduction=${forceProduction}`;
} }
console.log("postUrl", postUrl);
const { data } = await axios.post( const { data } = await axios.post(postUrl, [...params.ids], {
`${env}/${url}?forceProduction=${forceProduction}`, headers: { "jwt-token": token },
[...params.ids], });
{
headers: { "jwt-token": token },
},
);
if (data.code !== 200) { if (data.code !== 200) {
return res.json(data); return res.json(data);
} }
console.log("data", data); console.log("data", data);
let path, processDesignA, processDesignB;
if (data.data) {
path = data.data.path;
processDesignA = data.data.processDesignA;
processDesignB = data.data.processDesignB;
} else {
path = data.message;
}
// 转义中文 // 转义中文
if (data.message) { if (path) {
data.message = encodeURIComponent(data.message); path = encodeURIComponent(path);
} }
let files = data.data || [data.message]; let files = [path];
files = files.map((el) => ({ url: `${fileEnv}${el}` })); files = files.map((el) => ({ url: `${fileEnv}${el}` }));
const downloadFunc = const downloadFunc =
params.device === 2 ? downloadOtherImage : downloadImage; params.device === 2 ? downloadOtherImage : downloadImage;
const result = await downloadFunc(files); const result = await downloadFunc(files, {
processDesignA,
processDesignB,
});
console.log("result200", result);
res.json({ code: 200, data: result }); res.json({ code: 200, data: result });
} catch (err) { } catch (err) {
......
...@@ -62,7 +62,7 @@ function zip(from, to) { ...@@ -62,7 +62,7 @@ function zip(from, to) {
}); });
} }
export const downloadImage = (list) => { export const downloadImage = (list, isForcedProduction) => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const desktopDevice = getCurrentDesktopDevice(); const desktopDevice = getCurrentDesktopDevice();
...@@ -141,15 +141,42 @@ export const downloadImage = (list) => { ...@@ -141,15 +141,42 @@ export const downloadImage = (list) => {
if (isArchive) { if (isArchive) {
// 处理压缩文件 // 处理压缩文件
item.list = await zip(filePath, dirPath); item.list = await zip(filePath, dirPath);
if (Object.keys(isForcedProduction).length > 0) {
item.list = item.list.map((el) => {
if (el.designId.includes("A")) {
el.isForcedProduction = isForcedProduction.processDesignA;
} else if (el.designId.includes("B")) {
el.isForcedProduction = isForcedProduction.processDesignB;
}
return { ...el };
});
}
console.log("list", item.list);
} else { } else {
// 处理普通图片文件 // 处理普通图片文件
if (!item.list) item.list = []; if (!item.list) item.list = [];
const originalName = item.url.split("/").pop(); const originalName = item.url.split("/").pop();
item.list.push({ if (
fileName, isForcedProduction.processDesignA ||
productionFile: filePath, isForcedProduction.processDesignB
designId: originalName.split("_GCPS")[0], ) {
}); item.list.push({
fileName,
productionFile: filePath,
designId: originalName.split("_GCPS")[0],
isForcedProduction: originalName
.split("_GCPS")[0]
.includes("A")
? isForcedProduction.processDesignA || false
: isForcedProduction.processDesignB || false,
});
} else {
item.list.push({
fileName,
productionFile: filePath,
designId: originalName.split("_GCPS")[0],
});
}
} }
} catch (error) { } catch (error) {
console.error(`处理失败: ${item.url}`, error); console.error(`处理失败: ${item.url}`, error);
......
...@@ -74,6 +74,7 @@ export default { ...@@ -74,6 +74,7 @@ export default {
cacheVisible: false, cacheVisible: false,
showPrintDialog: false, showPrintDialog: false,
productionNo: "", productionNo: "",
templateProductionNo: "",
setting: { setting: {
gridShow: 1, gridShow: 1,
gridValue: 0, gridValue: 0,
...@@ -105,6 +106,7 @@ export default { ...@@ -105,6 +106,7 @@ export default {
], ],
faceType: "A", faceType: "A",
dialogVisible: false, dialogVisible: false,
showforcedProduc: false,
}; };
}, },
computed: { computed: {
...@@ -408,10 +410,14 @@ export default { ...@@ -408,10 +410,14 @@ export default {
} }
}, },
async hasDesignImagesCanvasJsonList(designImagesCanvasJsonList, bool) { async hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList,
bool,
isForcedProduction,
) {
let imageResList = []; let imageResList = [];
console.log(431, designImagesCanvasJsonList); console.log(431, designImagesCanvasJsonList);
this.showforcedProduc = false;
// 当adjustable有值时 直接赋值宽高 // 当adjustable有值时 直接赋值宽高
if ( if (
!this.checked && !this.checked &&
...@@ -456,6 +462,7 @@ export default { ...@@ -456,6 +462,7 @@ export default {
designImagesCanvasJsonList = JSON.parse(designImagesCanvasJsonList); designImagesCanvasJsonList = JSON.parse(designImagesCanvasJsonList);
// 惠立彩 带黄点摸的订单直接展示错误弹窗 // 惠立彩 带黄点摸的订单直接展示错误弹窗
if (!designImagesCanvasJsonList[0].images) { if (!designImagesCanvasJsonList[0].images) {
this.showforcedProduc = true;
this.dialogVisible = true; this.dialogVisible = true;
return; return;
} }
...@@ -475,15 +482,18 @@ export default { ...@@ -475,15 +482,18 @@ export default {
ids: [this.detail.id], ids: [this.detail.id],
device: this.desktopDevice, device: this.desktopDevice,
orderType: this.orderType, orderType: this.orderType,
forceProduction:
this.isForcedProduction || isForcedProduction || false,
}, },
); );
console.log("downloadBySubOrderNumber", res);
if (!res.data.length) return this.$message.warning("未找到素材图!"); if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => { res.data.forEach((el) => {
imageResList = imageResList.concat(el.list || []); imageResList = imageResList.concat(el.list || []);
}); });
} catch (error) { } catch (error) {
this.dialogVisible = true; if (this.desktopDevice == 3) this.dialogVisible = true;
} }
} else if (bool) { } else if (bool) {
//如果有本地数据 则直接获取本地数据同图片 //如果有本地数据 则直接获取本地数据同图片
...@@ -549,7 +559,7 @@ export default { ...@@ -549,7 +559,7 @@ export default {
} }
}, },
async getDataInfo() { async getDataInfo(e, isForcedProduction) {
//查询后先检查当前是否有数据,有则先走生产完成 //查询后先检查当前是否有数据,有则先走生产完成
if ( if (
this.detail && this.detail &&
...@@ -618,7 +628,7 @@ export default { ...@@ -618,7 +628,7 @@ export default {
this.$store.commit("setOrderType", str); this.$store.commit("setOrderType", str);
} }
this.templateProductionNo = this.productionNo;
try { try {
//查询当前生产单号是否在本地数据 //查询当前生产单号是否在本地数据
let localItem = null; let localItem = null;
...@@ -660,6 +670,7 @@ export default { ...@@ -660,6 +670,7 @@ export default {
await this.hasDesignImagesCanvasJsonList( await this.hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList, designImagesCanvasJsonList,
this.desktopDevice === 3 ? (localItem ? true : false) : false, this.desktopDevice === 3 ? (localItem ? true : false) : false,
isForcedProduction,
); );
this.$store.commit("setProductDetail", this.detail); this.$store.commit("setProductDetail", this.detail);
ipcRenderer.send("win-subScreen", findByPodProductionNo.data); ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
...@@ -851,10 +862,16 @@ export default { ...@@ -851,10 +862,16 @@ export default {
clearArray() { clearArray() {
setOrderInfo([]); setOrderInfo([]);
}, },
forcedProductionFN(bool) { forcedProductionFN(_, bool) {
this.detail = null;
if (bool) this.isForcedProduction = true; if (bool) this.isForcedProduction = true;
this.productionNo = this.templateProductionNo;
this.templateProductionNo = "";
this.getDataInfo(null, true);
this.dialogVisible = false;
}, },
closeDialog() { closeDialog() {
this.templateProductionNo = "";
this.detail = null; this.detail = null;
this.$store.commit("setProductDetail", {}); this.$store.commit("setProductDetail", {});
this.dialogVisible = false; this.dialogVisible = false;
...@@ -1090,11 +1107,11 @@ export default { ...@@ -1090,11 +1107,11 @@ export default {
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<el-checkbox v-model="isAutoFinish">自动完成上一单</el-checkbox> <el-checkbox v-model="isAutoFinish">自动完成上一单</el-checkbox>
</div> </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 v-model="isForcedProduction" style="color: red;"
>自动强制生产</el-checkbox >自动强制生产</el-checkbox
> >
</div> --> </div>
<div style="margin-left: 10px;" v-show="desktopDevice != 3"> <div style="margin-left: 10px;" v-show="desktopDevice != 3">
<el-checkbox v-model="checked">自动裁切</el-checkbox> <el-checkbox v-model="checked">自动裁切</el-checkbox>
</div> </div>
...@@ -1185,10 +1202,15 @@ export default { ...@@ -1185,10 +1202,15 @@ export default {
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取消</el-button> <el-button @click="closeDialog">取消</el-button>
<!-- <el-button @click="forcedProductionFN">强制生产</el-button> <el-button v-if="!showforcedProduc" @click="forcedProductionFN"
<el-button @click="forcedProductionFN(true)" style="color: red;" >强制生产</el-button
>
<el-button
v-if="!showforcedProduc"
@click="(e) => forcedProductionFN(e, true)"
style="color: red;"
>自动强制生产</el-button >自动强制生产</el-button
> --> >
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
......
...@@ -1826,12 +1826,20 @@ export default { ...@@ -1826,12 +1826,20 @@ export default {
detail.productMark detail.productMark
" "
> >
<!-- <b <b
style="color:red" style="color:#f2e403"
v-if="!selectImgList.length && !isForcedProduction" v-if="
selectImgList.length &&
selectImgList[selectImgIndex].isForcedProduction
"
>该生产单素材已经被强制调整适配台版大小,请关注</b >该生产单素材已经被强制调整适配台版大小,请关注</b
> --> >
<b style="color:green" v-if="selectImgList.length" <b
style="color:green"
v-if="
selectImgList.length &&
!selectImgList[selectImgIndex].isForcedProduction
"
>该单无需拖动设计,直接打印</b >该单无需拖动设计,直接打印</b
> >
</div> </div>
...@@ -1921,25 +1929,6 @@ export default { ...@@ -1921,25 +1929,6 @@ export default {
</div> </div>
</div> </div>
</div> </div>
<el-dialog
title="警告:无法直接生产"
:visible.sync="dialogVisible"
width="30%"
>
<div>
素材效果已经超出台版范围,无法直接打印。请更换打印设
备,或者进行强制生产
</div>
<div>注:“自动强制生产”会让每次生产都强制生产</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button @click="forcedProductionFN">强制生产</el-button>
<el-button @click="forcedProductionFN(true)" style="color: red;"
>自动强制生产</el-button
>
</span>
</el-dialog>
</div> </div>
</template> </template>
......
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