Commit d1c42c47 by linjinhong

修改裁剪问题

parent 4fe89b0a
...@@ -78,11 +78,13 @@ export default { ...@@ -78,11 +78,13 @@ export default {
{ headers: { "jwt-token": token } } { headers: { "jwt-token": token } }
); );
let files = []; let files = [];
console.log(81, data);
if (data.code === 200) { if (data.code === 200) {
files = data.data; files = data.data;
files = files.map((el) => { files = files.map((el) => {
return { url: `${fileEnv}${el}` }; return { url: `${fileEnv}${el}` };
// return { url: `${el}` };
}); });
if (req.body[1] === 1) { if (req.body[1] === 1) {
...@@ -139,7 +141,7 @@ export default { ...@@ -139,7 +141,7 @@ export default {
res.json({ code: 500, msg: err }); res.json({ code: 500, msg: err });
} }
}, },
commitApply: async (req, res) => {}, commitApply: async () => {},
completeDelivery: async (req, res) => { completeDelivery: async (req, res) => {
const token = req.headers["jwt-token"]; const token = req.headers["jwt-token"];
try { try {
...@@ -272,7 +274,7 @@ export default { ...@@ -272,7 +274,7 @@ export default {
console.log(249, body); console.log(249, body);
toSend(body) toSend(body)
.then((r) => { .then(() => {
res.send({ code: 200, msg: "操作成功" }); res.send({ code: 200, msg: "操作成功" });
}) })
.catch((err) => { .catch((err) => {
......
...@@ -257,12 +257,21 @@ export const toSend = (body) => { ...@@ -257,12 +257,21 @@ export const toSend = (body) => {
); );
resolve("操作成功"); resolve("操作成功");
} else { } else {
reject("打印机参数错误"); const errorDetails = `打印命令失败: ${err2.message}`;
return reject(`打印机错误: ${errorDetails}`);
} }
} }
); );
} else { } else {
reject("生成arxp文件失败"); const errorCode = err.code || "UNKNOWN_ERROR";
const errorDetails = [
`生成命令失败: ${body.cmd}`,
`错误代码: ${errorCode}`,
`错误信息: ${err.message}`,
`标准错误输出: ${stderr}`,
].join("\n");
return reject(errorDetails);
} }
} }
); );
......
...@@ -350,7 +350,10 @@ export default { ...@@ -350,7 +350,10 @@ export default {
if (imageResList && imageResList.length) { if (imageResList && imageResList.length) {
let obj = { let obj = {
type: "sendFile", type: "sendFile",
value: imageResList, value: imageResList.map((el, index) => {
el.designId = el.designId || index;
return el;
}),
}; };
if ( if (
this.detail.mssWidth && this.detail.mssWidth &&
...@@ -411,7 +414,10 @@ export default { ...@@ -411,7 +414,10 @@ export default {
console.log(260, res.data); console.log(260, res.data);
let obj = { let obj = {
type: "sendFile", type: "sendFile",
value: newImgList, value: newImgList.map((el, index) => {
el.designId = el.designId || index;
return el;
}),
}; };
if ( if (
this.detail.mssWidth && this.detail.mssWidth &&
......
...@@ -780,6 +780,8 @@ export default { ...@@ -780,6 +780,8 @@ export default {
async cutImgFn() { async cutImgFn() {
this.checkList = JSON.parse(JSON.stringify(this.selectImgList)); this.checkList = JSON.parse(JSON.stringify(this.selectImgList));
try { try {
console.log("checkList", this.checkList);
const processQueue = await Promise.all( const processQueue = await Promise.all(
this.checkList.map(async (el) => { this.checkList.map(async (el) => {
try { try {
...@@ -802,10 +804,12 @@ export default { ...@@ -802,10 +804,12 @@ export default {
} }
}) })
); );
console.log("processQueue", processQueue);
// 等待所有异步操作完成 // 等待所有异步操作完成
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise((resolve) => setTimeout(resolve, 100));
const newMap = new Map(processQueue.map((el) => [el.designId, el])); const newMap = new Map(processQueue.map((el) => [el.designId, el]));
console.log("newMap", newMap);
this.selectImgList.forEach((el) => { this.selectImgList.forEach((el) => {
if (newMap.has(el.designId)) { if (newMap.has(el.designId)) {
el.fileName = newMap.get(el.designId).fileName; el.fileName = newMap.get(el.designId).fileName;
......
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