Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
electron-printer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhuzhequan
electron-printer
Commits
e6246077
Commit
e6246077
authored
Aug 26, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加正反面对照
parent
c52d287d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
256 additions
and
109 deletions
+256
-109
logs/2025-08-26/api.log
+0
-0
src/server/utils/store.js
+5
-0
src/utils/index.js
+34
-0
src/views/design/head/index.vue
+76
-44
src/views/design/main/imgSetting.vue
+1
-1
src/views/design/main/index.vue
+140
-64
No files found.
logs/2025-08-26/api.log
0 → 100644
View file @
e6246077
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/server/utils/store.js
View file @
e6246077
...
@@ -7,4 +7,9 @@ module.exports = {
...
@@ -7,4 +7,9 @@ module.exports = {
console
.
log
(
"store"
,
store
.
get
(
"desktoVersion"
));
console
.
log
(
"store"
,
store
.
get
(
"desktoVersion"
));
},
},
getVersion
:
()
=>
store
.
get
(
"desktoVersion"
)
||
"print"
,
getVersion
:
()
=>
store
.
get
(
"desktoVersion"
)
||
"print"
,
setBoard
:
(
version
)
=>
{
store
.
set
(
"desktoBoard"
,
version
);
console
.
log
(
"store"
,
store
.
get
(
"desktoBoard"
));
},
getBoard
:
()
=>
store
.
get
(
"desktoBoard"
)
||
3
,
};
};
src/utils/index.js
View file @
e6246077
...
@@ -233,3 +233,37 @@ function insertAfter(newElement, targetElement) {
...
@@ -233,3 +233,37 @@ function insertAfter(newElement, targetElement) {
parent
.
insertBefore
(
newElement
,
targetElement
.
nextSibling
);
parent
.
insertBefore
(
newElement
,
targetElement
.
nextSibling
);
}
}
}
}
export
function
extractValue
(
str
,
delimiter
=
"_"
,
positionType
=
"last"
)
{
// 如果字符串不包含分隔符,返回空字符串
if
(
!
str
.
includes
(
delimiter
))
return
""
;
// 分割字符串
const
parts
=
str
.
split
(
delimiter
);
let
position
;
// 根据位置类型确定要提取的位置
switch
(
positionType
)
{
case
"first"
:
position
=
0
;
break
;
case
"second"
:
position
=
1
;
break
;
case
"third"
:
position
=
2
;
break
;
case
"last"
:
position
=
parts
.
length
-
2
;
break
;
default
:
position
=
parts
.
length
-
1
;
}
// 检查位置是否有效
if
(
position
<
0
||
position
>=
parts
.
length
)
return
""
;
// 返回指定位置的值
return
parts
[
position
];
}
src/views/design/head/index.vue
View file @
e6246077
...
@@ -8,7 +8,7 @@ import UpdateDialog from "@/views/design/updateDialog.vue";
...
@@ -8,7 +8,7 @@ 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"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
extractValue
}
from
"@/utils/index.js"
;
const
uuid
=
require
(
"uuid"
);
const
uuid
=
require
(
"uuid"
);
const
fs
=
require
(
"fs"
);
const
fs
=
require
(
"fs"
);
import
{
mapState
}
from
"vuex"
;
import
{
mapState
}
from
"vuex"
;
...
@@ -308,6 +308,7 @@ export default {
...
@@ -308,6 +308,7 @@ export default {
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
)
{
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
)
{
let
imageResList
=
[];
let
imageResList
=
[];
if
(
if
(
!
this
.
checked
&&
this
.
detail
.
diyId
&&
this
.
detail
.
diyId
&&
this
.
detail
.
adjustable
&&
this
.
detail
.
adjustable
&&
designImagesCanvasJsonList
designImagesCanvasJsonList
...
@@ -375,13 +376,44 @@ export default {
...
@@ -375,13 +376,44 @@ export default {
}, 500);
}, 500);
}
}
} else {
} else {
let obj = {
const newImgList = imageResList
type: "
sendFile
",
.map((el, index) => {
value: imageResList.map((el, index) => {
el.designId = el.designId || index;
el.designId = el.designId || index;
el.title = extractValue(el.designId);
return el;
return el;
}),
})
.sort((a, b) => {
const titleA = a.title;
const titleB = b.title;
// 检查是否为空值(null、undefined、空字符串)
const isEmptyA =
titleA === null || titleA === undefined || titleA === "";
const isEmptyB =
titleB === null || titleB === undefined || titleB === "";
// 处理空值情况(空值排在最后)
if (isEmptyA && isEmptyB) return 0; // 两个都为空,保持原顺序
if (isEmptyA) return 1; // A为空,B不为空,A排在后面
if (isEmptyB) return -1; // B为空,A不为空,B排在后面
// 处理非空值比较(不区分大小写)
const valueA =
typeof titleA === "
string
" ? titleA.toUpperCase() : titleA;
const valueB =
typeof titleB === "
string
" ? titleB.toUpperCase() : titleB;
// 升序比较(A-Z)
if (valueA < valueB) return -1;
if (valueA > valueB) return 1;
return 0;
});
let obj = {
type: "
sendFile
",
value: [...newImgList],
};
};
console.log(387, obj);
if (
if (
this.detail.mssWidth &&
this.detail.mssWidth &&
this.detail.adjustable &&
this.detail.adjustable &&
...
@@ -395,6 +427,7 @@ export default {
...
@@ -395,6 +427,7 @@ export default {
bus.$emit("
busEmit
", obj);
bus.$emit("
busEmit
", obj);
}
}
},
},
async getDataInfo() {
async getDataInfo() {
if (
if (
this.detail &&
this.detail &&
...
@@ -418,51 +451,50 @@ export default {
...
@@ -418,51 +451,50 @@ export default {
} catch (error) {
} catch (error) {
console.error("
清理目录时发生错误
:
", error.msg);
console.error("
清理目录时发生错误
:
", error.msg);
}
}
if (this.factoryType !== "
US
") {
if (this.factoryType !== "
US
") {
if (this.factoryType !== "
US
") {
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
if (regex.test(this.productionNo)) {
if (regex.test(this.productionNo)) {
this.productionNo =
this.productionNo =
this.productionNo.split("
_
")[0] +
this.productionNo.split("
_
")[0] +
"
-
" +
"
-
" +
this.productionNo.split("
_
")[
this.productionNo.split("
_
")[
this.productionNo.split("
_
").length - 1
this.productionNo.split("
_
").length - 1
];
];
}
}
}
}
console.log(423, this.productionNo);
console.log(423, this.productionNo);
try {
try {
//查找生产单号信息传给第二个显示器
//查找生产单号信息传给第二个显示器
const findByPodProductionNo = await this.$api.post(
const findByPodProductionNo = await this.$api.post(
"
/
findByPodProductionNo
",
"
/
findByPodProductionNo
",
{
{
thirdSubOrderNumber: this.productionNo,
thirdSubOrderNumber: this.productionNo,
type: this.factoryType,
type: this.factoryType,
}
);
this.detail = findByPodProductionNo.data;
this.imgList = [];
let designImagesCanvasJsonList = this.detail.drParam;
await this.hasDesignImagesCanvasJsonList(designImagesCanvasJsonList);
this.$store.commit("
setProductDetail
", findByPodProductionNo.data);
ipcRenderer.send("
win
-
subScreen
", findByPodProductionNo.data);
this.$dataStore.set("
production_no
", this.productionNo);
this.productionNo = "";
this.$refs.searchRef.focus();
} catch (err) {
console.log(err);
if (!err.data) {
this.$message.error(
"
未使用英文输入法输入
/
扫码,或该生产单号未拣胚或已完成
"
);
}
}
this.productionNo = "";
);
this.$refs.searchRef.focus();
this.detail = findByPodProductionNo.data;
} finally {
this.imgList = [];
this.isFirst = false;
let designImagesCanvasJsonList = this.detail.drParam;
await this.hasDesignImagesCanvasJsonList(designImagesCanvasJsonList);
this.$store.commit("
setProductDetail
", findByPodProductionNo.data);
ipcRenderer.send("
win
-
subScreen
", findByPodProductionNo.data);
this.$dataStore.set("
production_no
", this.productionNo);
this.productionNo = "";
this.$refs.searchRef.focus();
} catch (err) {
console.log(err);
if (!err.data) {
this.$message.error(
"
未使用英文输入法输入
/
扫码,或该生产单号未拣胚或已完成
"
);
}
}
this.productionNo = "";
this.$refs.searchRef.focus();
} finally {
this.isFirst = false;
}
}
},
},
// // 聚焦资源管理器窗口(Windows)
// // 聚焦资源管理器窗口(Windows)
...
...
src/views/design/main/imgSetting.vue
View file @
e6246077
...
@@ -341,7 +341,7 @@ export default {
...
@@ -341,7 +341,7 @@ export default {
}
}
.drawer
{
.drawer
{
width
:
438
px
;
width
:
500
px
;
//
bottom
:
0
;
//
bottom
:
0
;
//
top
:
50px
;
//
top
:
50px
;
padding
:
10px
;
padding
:
10px
;
...
...
src/views/design/main/index.vue
View file @
e6246077
...
@@ -8,7 +8,7 @@ const { ipcRenderer } = require("electron");
...
@@ -8,7 +8,7 @@ const { ipcRenderer } = require("electron");
import
ImgSetting
from
"./imgSetting.vue"
;
import
ImgSetting
from
"./imgSetting.vue"
;
import
bus
from
"@/bus"
;
import
bus
from
"@/bus"
;
import
PrintDialog
from
"@/views/design/head/printDialog.vue"
;
import
PrintDialog
from
"@/views/design/head/printDialog.vue"
;
import
{
mmToPx
}
from
"@/utils"
;
import
{
mmToPx
,
extractValue
}
from
"@/utils"
;
const
path
=
require
(
"path"
);
const
path
=
require
(
"path"
);
const
fs
=
require
(
"fs"
);
const
fs
=
require
(
"fs"
);
...
@@ -831,6 +831,10 @@ export default {
...
@@ -831,6 +831,10 @@ export default {
},
},
async
cutImgFn
()
{
async
cutImgFn
()
{
console
.
log
(
"detail"
,
this
.
detail
);
if
(
this
.
detail
.
diyId
)
{
await
this
.
downloadImg
(
1
);
}
this
.
checkList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectImgList
));
this
.
checkList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectImgList
));
try
{
try
{
console
.
log
(
"checkList"
,
this
.
checkList
);
console
.
log
(
"checkList"
,
this
.
checkList
);
...
@@ -911,7 +915,7 @@ export default {
...
@@ -911,7 +915,7 @@ export default {
this
.
$store
.
commit
(
"setIsPreView"
,
this
.
isView
);
this
.
$store
.
commit
(
"setIsPreView"
,
this
.
isView
);
},
},
async
downloadImg
()
{
async
downloadImg
(
type
)
{
let
res
=
await
this
.
$api
.
post
(
"/downloadBySubOrderNumber"
,
{
let
res
=
await
this
.
$api
.
post
(
"/downloadBySubOrderNumber"
,
{
ids
:
[
this
.
detail
.
id
],
ids
:
[
this
.
detail
.
id
],
device
:
this
.
$store
.
state
.
desktopDevice
,
device
:
this
.
$store
.
state
.
desktopDevice
,
...
@@ -930,10 +934,16 @@ export default {
...
@@ -930,10 +934,16 @@ export default {
});
});
}
}
});
});
res
.
data
=
arr
.
filter
((
el
)
=>
el
.
type
!==
1
);
res
.
data
=
arr
.
filter
((
el
)
=>
el
.
type
!==
1
)
.
map
((
el
,
index
)
=>
{
el
.
designId
=
el
.
designId
||
index
;
el
.
title
=
extractValue
(
el
.
designId
);
return
el
;
});
this
.
selectImgList
=
[...
res
.
data
];
this
.
selectImgList
=
[...
res
.
data
];
console
.
log
(
823
,
this
.
selectImgList
);
console
.
log
(
823
,
this
.
selectImgList
);
if
(
type
==
1
)
return
;
this
.
imgList
=
[];
this
.
imgList
=
[];
this
.
selectIndex
=
-
1
;
this
.
selectIndex
=
-
1
;
this
.
selectImgIndex
=
0
;
this
.
selectImgIndex
=
0
;
...
@@ -1127,25 +1137,69 @@ export default {
...
@@ -1127,25 +1137,69 @@ export default {
>
>
<template
#
content
>
<template
#
content
>
<div
class=
"information-content"
>
<div
class=
"information-content"
>
<
PicScrollbarBox
<
div
class=
"main"
>
boxTitle=
"效果图"
<div
class=
"boxTitle"
>
效果图
</div>
emptyTitle=
"效果图为空"
<div
style=
"border-bottom: 1px solid #ececec;
"
v-if=
"detail?.imageAry?.length
"
>
class=
"boxImg"
<template
#
mainContent
v-if=
"detail.imageAry?.length"
>
style=
"width: 100%;"
<div
style=
"width: 100%;"
>
>
<div
<div
v-for=
"(img, index) in detail.imageAry"
v-for=
"(img, index) in detail.imageAry"
:key=
"index"
:key=
"index"
class=
"img-item"
class=
"img-item"
style=
"width: 50%;"
style=
"width: 50%;"
>
>
<img
:src=
"img.url"
/>
<img
:src=
"img.url"
/>
</div>
<
div
v-if=
"img.title"
class=
"imgTitle"
>
{{
img
.
title
}}
<
/div>
</div>
</div>
</
template
>
</div>
</PicScrollbarBox>
<el-empty
v-else
description=
"效果图为空"
></el-empty>
<PicScrollbarBox
boxTitle=
"素材图"
emptyTitle=
"素材图为空"
>
</div>
<div
class=
"main"
>
<div
class=
"boxTitle"
style=
"display: flex;justify-content: space-between;align-items: center;padding: 0 10px;"
>
<div>
素材图
</div>
<div>
<el-button
type=
"primary"
size=
"small"
v-if=
"selectImgList.length"
style=
"margin: 5px;"
@
click=
"downloadImg"
>
下载原素材
</el-button>
<el-button
type=
"primary"
size=
"small"
v-if=
"selectImgList.length"
style=
"margin: 5px;"
@
click=
"cutImgFn"
>
裁切
</el-button>
</div>
</div>
<div
v-if=
"selectImgList.length"
class=
"boxImg"
style=
"width: 100%;"
>
<div
v-for=
"(img, i) in selectImgList"
:key=
"i"
class=
"img-item"
style=
"width: 50%;"
@
click
.
stop
.
prevent=
"selectImg(img, i)"
>
<img
:src=
"img.productionFile"
/>
<div
v-if=
"img.title"
class=
"imgTitle"
>
{{
img
.
title
}}
</div>
</div>
</div>
<el-empty
v-else
description=
"素材图为空"
></el-empty>
</div>
<!--
<PicScrollbarBox
boxTitle=
"素材图"
emptyTitle=
"素材图为空"
>
<template
#
titleRight
>
<template
#
titleRight
>
<div>
<div>
<el-button
<el-button
...
@@ -1178,10 +1232,10 @@ export default {
...
@@ -1178,10 +1232,10 @@ export default {
style=
"width: auto;max-height: 190px;max-width: 200px;"
style=
"width: auto;max-height: 190px;max-width: 200px;"
:src=
"img.productionFile"
:src=
"img.productionFile"
/>
/>
<!--
<span>
{{
img
.
designId
}}
</span>
-->
</div>
</div>
</
template
>
</
template
>
</PicScrollbarBox>
</PicScrollbarBox>
-->
</div>
</div>
<div
class=
"product-information"
>
<div
class=
"product-information"
>
<div
class=
"title"
>
<div
class=
"title"
>
...
@@ -1706,42 +1760,11 @@ img {
...
@@ -1706,42 +1760,11 @@ img {
}
}
.showImg
{
.showImg
{
max-height
:
194px
!important
;
//
max-height
:
194px
!important
;
text-align
:
center
;
//
text-align
:
center
;
width
:
auto
!important
;
//
width
:
auto
!important
;
}
width
:
100%
;
height
:
auto
;
.img-item
{
//
height
:
150px
;
width
:
180px
;
height
:
215px
;
overflow
:
hidden
;
padding
:
5px
;
box-sizing
:
border-box
;
background
:
#ececec
;
display
:
inline-block
;
cursor
:
pointer
;
//
margin-bottom
:
20px
;
margin-right
:
5px
;
box-sizing
:
border-box
;
img
{
width
:
100%
;
height
:
auto
;
}
span
{
font-size
:
14px
;
//
margin
:
5px
0
;
width
:
100%
;
color
:
black
;
display
:
inline-block
;
/* 使 span 成为块级元素,这样可以设置宽度 */
//
max-width
:
270px
;
/* 限制宽度 */
word-wrap
:
break-word
;
/* 或者使用 overflow-wrap: break-word; */
white-space
:
normal
;
/* 确保正常换行 */
text-align
:
center
;
}
}
}
.sucaitu-img
{
.sucaitu-img
{
...
@@ -1814,12 +1837,58 @@ img {
...
@@ -1814,12 +1837,58 @@ img {
border
:
1px
solid
#ececec
;
border
:
1px
solid
#ececec
;
border-top
:
none
;
border-top
:
none
;
width
:
100%
;
width
:
100%
;
box-sizing
:
border-box
;
.main
{
.main
{
margin
:
5px
;
border-bottom
:
1px
solid
#ececec
;
border
:
1px
solid
#ececec
;
min-height
:
250px
;
height
:
100%
;
&:last-child
{
border
:
none
;
}
.boxTitle
{
padding
:
5px
10px
;
font-weight
:
700
;
font-size
:
20px
;
}
.boxImg
{
display
:
flex
;
padding
:
5px
;
box-sizing
:
border-box
;
.img-item
{
position
:
relative
;
overflow
:
hidden
;
padding
:
5px
;
box-sizing
:
border-box
;
background
:
#ececec
;
display
:
inline-block
;
cursor
:
pointer
;
box-sizing
:
border-box
;
text-align
:
center
;
&:first-child
{
margin-right
:
5px
;
}
img
{
width
:
auto
;
height
:
auto
;
max-height
:
210px
;
}
.imgTitle
{
font-weight
:
700
;
font-size
:
18px
;
position
:
absolute
;
top
:
8px
;
left
:
8px
;
width
:
25px
;
height
:
25px
;
color
:
#fff
;
text-align
:
center
;
border-radius
:
50%
;
background-color
:
#409eff
;
}
}
}
.effectPic
{
.effectPic
{
.img
{
.img
{
width
:
100%
;
width
:
100%
;
...
@@ -1930,4 +1999,11 @@ img {
...
@@ -1930,4 +1999,11 @@ img {
pointer-events
:
none
;
/* 允许穿透操作 */
pointer-events
:
none
;
/* 允许穿透操作 */
z-index
:
2
;
/* 确保在元素上方 */
z-index
:
2
;
/* 确保在元素上方 */
}
}
::v-deep
.el-empty
{
padding-top
:
0
;
padding-bottom
:
25px
;
.el-empty__image
{
width
:
100px
!important
;
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment