Commit ee10b4cf by linjinhong

更改主体展示以及一些bug

parent d5c6e8b5
{
"apiApiHost":"http://10.168.31.142:8060/api",
"apiApiHost":"http://10.168.31.142:8060/api",
"fileApiUrl":"http://10.168.31.142:80/upload/factory",
"visionUrl":"https://console.jomalls.com"
}
......
......@@ -77,7 +77,7 @@ export default {
data,
} = await axios.post(
`${env}/factory/podJomallOrder/downloadByProduction`,
params,
[req.body[0]],
{ headers: { "jwt-token": token } }
);
let files = [];
......@@ -86,8 +86,8 @@ export default {
files = files.map((el) => {
return { url: `${fileEnv}${el}` };
});
console.log(89, files);
// res.json({ code: 200, data: "" });
// return;
if (req.body[1] === 1) {
downloadImage(files)
.then((data) => {
......
......@@ -5,8 +5,10 @@ import { ipcRenderer } from "electron";
import { grid } from "../data";
import pkg from "../../../../package.json";
import UpdateDialog from "@/views/design/updateDialog.vue";
// import path from "path"; // 引入 path 模块
import path from "path"; // 引入 path 模块
import store from "@/store/index.js";
const uuid = require("uuid");
const fs = require("fs");
export default {
components: { PrintDialog, UpdateDialog },
......@@ -23,6 +25,7 @@ export default {
return {
checkList: [],
desktopDevice: 1,
checked: false,
cacheList: [
{
label: "清除当前登录信息",
......@@ -243,7 +246,12 @@ export default {
}
});
res.data = arr.filter((el) => el.type !== 1);
let newImgList;
if (this.checked) {
newImgList = await this.cutImgFn(res.data);
} else {
newImgList = res.data;
}
// 延迟后强制激活窗口
if (this.desktopDevice !== 1) {
if (this.imgList.length) {
......@@ -261,7 +269,7 @@ export default {
} else {
bus.$emit("busEmit", {
type: "sendFile",
value: res.data,
value: newImgList,
// size: { width: this.detail.mssWidth || 500, height: this.detail.mssHeight || 500 },
});
}
......@@ -353,6 +361,48 @@ export default {
this.$store.commit("changeImgList", []);
console.log(347, store.state.desktopDevice);
},
async cutImgFn(arr) {
if (!arr.length) return;
try {
const processQueue = await Promise.all(
arr.map(async (el) => {
try {
const outputDir = path.dirname(el.productionFile);
const outputFileName = `${uuid.v4()}.png`;
const outputPath = path.join(outputDir, outputFileName);
const params = {
inputPath: el.productionFile,
outputPath: outputPath,
};
const res = await this.$api.post("/processImage", params);
fs.unlinkSync(el.productionFile);
return {
fileName: outputFileName,
productionFile: res.msg[0]?.outputPath,
designId: el.designId,
};
} catch (error) {
console.error(`处理失败: ${el.productionFile}`, error);
}
})
);
// 等待所有异步操作完成
await new Promise((resolve) => setTimeout(resolve, 100));
const newMap = new Map(processQueue.map((el) => [el.designId, el]));
processQueue.forEach((el) => {
if (newMap.has(el.designId)) {
el.fileName = newMap.get(el.designId).fileName;
el.productionFile = newMap.get(el.designId).productionFile;
}
});
console.log("processQueue", processQueue);
return processQueue;
} catch (error) {
console.error("错误", error);
return [];
}
},
},
};
</script>
......@@ -593,6 +643,9 @@ export default {
<el-checkbox v-model="isAutoFinish">自动完成上一单</el-checkbox>
</div>
</div>
<div style="margin-left: 10px;">
<el-checkbox v-model="checked">自动裁切素材</el-checkbox>
</div>
<el-button
@click="downloadImage"
size="medium"
......
......@@ -145,7 +145,7 @@ export default {
</script>
<template>
<el-scrollbar>
<el-scrollbar class="scrollbarDrawer">
<div class="drawer">
<div class="img-form">
<div class="title">
......@@ -329,7 +329,7 @@ export default {
}
.drawer {
width: 400px;
width: 438px;
// bottom: 0;
// top: 50px;
padding: 10px;
......@@ -348,8 +348,8 @@ export default {
z-index: 1;
.title {
padding-bottom: 10px;
// font-weight: 600;
font-size: 18px;
font-weight: 700;
font-size: 20px;
margin-bottom: 8px;
// border-bottom: 1px solid #ececec;
}
......
......@@ -136,7 +136,18 @@ export default {
systemSetting: {},
detail: {},
imgHeight: 0,
selectImgList: [],
selectImgList: [
// {
// url: "file:///D:work/electron-printer/print/Input/1.png",
// productionFile: "file:///D:work/electron-printer/print/Input/1.png",
// designId: "1",
// },
// {
// url: "file:///D:work/electron-printer/print/Input/2.png",
// productionFile: "file:///D:work/electron-printer/print/Input/2.png",
// designId: "2",
// },
],
bus: 0,
grid,
PreViewGrid: {
......@@ -214,11 +225,21 @@ export default {
productDetail(newValue) {
this.detail = { ...newValue };
if (typeof this.detail.imageAry == "string") {
this.detail.imageAry = JSON.parse(this.detail.imageAry).filter(
(el) => !el.title
);
this.detail.imageAry = JSON.parse(this.detail.imageAry).map((el) => {
if (!el.title) el.title = 1;
return el;
});
const otherArr = this.detail.imageAry.filter((el) => el.title == 1);
this.detail.AimageAry = [
...this.detail.imageAry.filter((el) => el.title === "正"),
...otherArr,
];
this.detail.BimageAry = [
...this.detail.imageAry.filter((el) => el.title === "反"),
...otherArr,
];
}
console.log(161, this.detail);
console.log("detail", this.detail);
},
},
methods: {
......@@ -567,7 +588,7 @@ export default {
h: bw * (2 / 3) * rate,
r: 0,
});
console.log(that.imgList);
console.log(570, that.imgList);
that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true;
callback && callback(file);
......@@ -727,7 +748,7 @@ export default {
console.log(723, this.isView);
}
}
if (currentElement.closest(".drawer")) {
if (currentElement.closest(".scrollbarDrawer")) {
this.isView = false;
}
this.$store.commit("setIsPreView", this.isView);
......@@ -749,8 +770,6 @@ export default {
break;
case "bg":
this.changeImageColor(value, (res) => {
console.log(7777);
this.img = res;
});
break;
......@@ -763,11 +782,11 @@ export default {
});
break;
case "sendFile":
if (size.width && size.height) {
this.hasSize = true;
} else {
this.hasSize = false;
}
// if (size.width && size.height) {
// this.hasSize = true;
// } else {
// this.hasSize = false;
// }
this.imgList = [];
this.selectIndex = -1;
if (value.length > 0) {
......@@ -840,28 +859,24 @@ export default {
</el-col>
<el-row class="border-row">
<el-col
:span="6"
class="text-center"
style="align-items: stretch;flex-grow: 1"
>A面</el-col
>
<el-col
:span="9"
class="border-col"
style="align-items: stretch;flex-grow: 1"
>
<el-col :span="6" class="text-center"><div>A面</div></el-col>
<el-col :span="9" class="border-col text-center">
<el-carousel
height="150px"
v-if="detail.AimageAry?.length"
height="170px"
:autoplay="false"
indicator-position="none"
style="width: 100%;"
>
<el-carousel-item v-for="item in 4" :key="item">
<img class="full-width" src="#" alt="" />
<el-carousel-item
v-for="(item, index) in detail.AimageAry"
:key="index"
>
<img class="full-width" :src="item.url" alt="" />
</el-carousel-item>
</el-carousel>
<div v-else>&nbsp;</div>
</el-col>
<div class="boxLine"></div>
<el-col
:span="9"
style="overflow: hidden;align-items: stretch;flex-grow: 1"
......@@ -892,17 +907,23 @@ export default {
</el-row>
<el-row class="border-row">
<el-col :span="6" class="text-center">B面</el-col>
<el-col :span="9" class="border-col">
<el-col :span="6" class="text-center"><div>B面</div></el-col>
<el-col :span="9" class="border-col text-center">
<el-carousel
height="150px"
v-if="detail.BimageAry?.length"
height="170px"
:autoplay="false"
indicator-position="none"
style="width: 100%;"
>
<el-carousel-item v-for="item in 4" :key="item">
<img class="full-width" src="#" alt="" />
<el-carousel-item
v-for="(item, index) in detail.BimageAry"
:key="index"
>
<img class="full-width" :src="item.url" alt="" />
</el-carousel-item>
</el-carousel>
<div v-else>&nbsp;</div>
</el-col>
<el-col :span="9" style="overflow: hidden;">
<el-checkbox-group
......@@ -1068,7 +1089,7 @@ export default {
<div v-if="isView" id="img">
<div
id="line"
style="left: 26%;top: 57%;background-color: transparent;overflow: hidden;cursor: none;"
style="left: 22%;top: 57%;background-color: transparent;overflow: hidden;cursor: none;"
>
<div
class="sucaitu vieWsucaitu"
......@@ -1209,7 +1230,7 @@ export default {
draggable="false"
:src="img"
alt=""
style="position: absolute;width: 1040px;left: 4%"
style="position: absolute;width: 1000px;left: 3%;height: 100%;"
:style="{ 'z-index': isView ? '0' : '-1' }"
/>
</div>
......@@ -1254,7 +1275,7 @@ export default {
#line {
position: absolute;
// z-index: 2;
left: 10%;
left: 5%;
top: 50%;
transform: translate(0, -50%);
......@@ -1394,10 +1415,11 @@ img {
}
.img-item {
// height: 150px;
padding: 5px;
display: flex;
cursor: pointer;
margin-bottom: 20px;
// margin-bottom: 20px;
border: 2px dashed transparent;
flex-direction: column;
align-items: center;
......@@ -1405,7 +1427,8 @@ img {
box-sizing: border-box;
span {
font-size: 14px;
margin: 5px 0;
// margin: 5px 0;
width: 100%;
color: black;
display: inline-block; /* 使 span 成为块级元素,这样可以设置宽度 */
max-width: 270px; /* 限制宽度 */
......@@ -1432,7 +1455,7 @@ img {
width: 100%;
margin: 0;
margin-bottom: 5px;
// margin-bottom: 5px;
::v-deep .el-checkbox__input {
position: absolute;
top: 5px;
......@@ -1520,6 +1543,8 @@ img {
}
.title {
padding: 10px;
font-size: 20px;
font-weight: 700;
}
.border-row {
border-top: 1px solid #ececec;
......@@ -1527,13 +1552,16 @@ img {
display: flex;
width: 100%;
height: 100%;
align-items: center;
// align-items: center;
}
.full-width {
width: 100%;
}
.text-center {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.border-col {
border-left: 1px solid #ececec;
......
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