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