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
f03769d1
Commit
f03769d1
authored
Apr 07, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
b02a9b32
b753e82f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
53 deletions
+101
-53
src/server/entity/function.js
+22
-12
src/server/utils/index.js
+33
-6
src/views/design/head/index.vue
+33
-11
src/views/design/main/index.vue
+13
-24
No files found.
src/server/entity/function.js
View file @
f03769d1
...
...
@@ -158,38 +158,48 @@ export default {
const
downloadBySubOrderNumber
=
pathMap
[
"downloadBySubOrderNumber"
];
try
{
let
url
=
downloadBySubOrderNumber
[
params
.
orderType
];
let
postUrl
=
`
${
env
}
/
${
url
}
`
;
if
(
params
.
device
==
3
)
{
url
=
params
.
orderType
==
"CN"
?
downloadBySubOrderNumber
[
"CNHLC"
]
:
downloadBySubOrderNumber
[
"USHLC"
];
postUrl
=
`
${
env
}
/
${
url
}
?forceProduction=
${
forceProduction
}
`
;
}
const
{
data
}
=
await
axios
.
post
(
`
${
env
}
/
${
url
}
?forceProduction=
${
forceProduction
}
`
,
[...
params
.
ids
],
{
headers
:
{
"jwt-token"
:
token
},
},
);
console
.
log
(
"postUrl"
,
postUrl
);
const
{
data
}
=
await
axios
.
post
(
postUrl
,
[...
params
.
ids
],
{
headers
:
{
"jwt-token"
:
token
},
});
if
(
data
.
code
!==
200
)
{
return
res
.
json
(
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
)
{
data
.
message
=
encodeURIComponent
(
data
.
message
);
if
(
path
)
{
path
=
encodeURIComponent
(
path
);
}
let
files
=
data
.
data
||
[
data
.
message
];
let
files
=
[
path
];
files
=
files
.
map
((
el
)
=>
({
url
:
`
${
fileEnv
}${
el
}
`
}));
const
downloadFunc
=
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
});
}
catch
(
err
)
{
...
...
src/server/utils/index.js
View file @
f03769d1
...
...
@@ -62,7 +62,7 @@ function zip(from, to) {
});
}
export
const
downloadImage
=
(
list
)
=>
{
export
const
downloadImage
=
(
list
,
isForcedProduction
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
try
{
const
desktopDevice
=
getCurrentDesktopDevice
();
...
...
@@ -141,15 +141,42 @@ export const downloadImage = (list) => {
if
(
isArchive
)
{
// 处理压缩文件
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
{
// 处理普通图片文件
if
(
!
item
.
list
)
item
.
list
=
[];
const
originalName
=
item
.
url
.
split
(
"/"
).
pop
();
item
.
list
.
push
({
fileName
,
productionFile
:
filePath
,
designId
:
originalName
.
split
(
"_GCPS"
)[
0
],
});
if
(
isForcedProduction
.
processDesignA
||
isForcedProduction
.
processDesignB
)
{
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
)
{
console
.
error
(
`处理失败:
${
item
.
url
}
`
,
error
);
...
...
src/views/design/head/index.vue
View file @
f03769d1
...
...
@@ -74,6 +74,7 @@ export default {
cacheVisible
:
false
,
showPrintDialog
:
false
,
productionNo
:
""
,
templateProductionNo
:
""
,
setting
:
{
gridShow
:
1
,
gridValue
:
0
,
...
...
@@ -105,6 +106,7 @@ export default {
],
faceType
:
"A"
,
dialogVisible
:
false
,
showforcedProduc
:
false
,
};
},
computed
:
{
...
...
@@ -408,10 +410,14 @@ export default {
}
},
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
,
bool
)
{
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
,
bool
,
isForcedProduction
,
)
{
let
imageResList
=
[];
console
.
log
(
431
,
designImagesCanvasJsonList
);
this
.
showforcedProduc
=
false
;
// 当adjustable有值时 直接赋值宽高
if
(
!
this
.
checked
&&
...
...
@@ -456,6 +462,7 @@ export default {
designImagesCanvasJsonList
=
JSON
.
parse
(
designImagesCanvasJsonList
);
// 惠立彩 带黄点摸的订单直接展示错误弹窗
if
(
!
designImagesCanvasJsonList
[
0
].
images
)
{
this
.
showforcedProduc
=
true
;
this
.
dialogVisible
=
true
;
return
;
}
...
...
@@ -475,15 +482,18 @@ export default {
ids
:
[
this
.
detail
.
id
],
device
:
this
.
desktopDevice
,
orderType
:
this
.
orderType
,
forceProduction
:
this
.
isForcedProduction
||
isForcedProduction
||
false
,
},
);
console
.
log
(
"downloadBySubOrderNumber"
,
res
);
if
(
!
res
.
data
.
length
)
return
this
.
$message
.
warning
(
"未找到素材图!"
);
res
.
data
.
forEach
((
el
)
=>
{
imageResList
=
imageResList
.
concat
(
el
.
list
||
[]);
});
}
catch
(
error
)
{
this
.
dialogVisible
=
true
;
if
(
this
.
desktopDevice
==
3
)
this
.
dialogVisible
=
true
;
}
}
else
if
(
bool
)
{
//如果有本地数据 则直接获取本地数据同图片
...
...
@@ -549,7 +559,7 @@ export default {
}
},
async getDataInfo() {
async getDataInfo(
e, isForcedProduction
) {
//查询后先检查当前是否有数据,有则先走生产完成
if (
this.detail &&
...
...
@@ -618,7 +628,7 @@ export default {
this.$store.commit("
setOrderType
", str);
}
this.templateProductionNo = this.productionNo;
try {
//查询当前生产单号是否在本地数据
let localItem = null;
...
...
@@ -660,6 +670,7 @@ export default {
await this.hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList,
this.desktopDevice === 3 ? (localItem ? true : false) : false,
isForcedProduction,
);
this.$store.commit("
setProductDetail
", this.detail);
ipcRenderer.send("
win
-
subScreen
", findByPodProductionNo.data);
...
...
@@ -851,10 +862,16 @@ export default {
clearArray() {
setOrderInfo([]);
},
forcedProductionFN(bool) {
forcedProductionFN(_, bool) {
this.detail = null;
if (bool) this.isForcedProduction = true;
this.productionNo = this.templateProductionNo;
this.templateProductionNo = "";
this.getDataInfo(null, true);
this.dialogVisible = false;
},
closeDialog() {
this.templateProductionNo = "";
this.detail = null;
this.$store.commit("
setProductDetail
", {});
this.dialogVisible = false;
...
...
@@ -1090,11 +1107,11 @@ export default {
<div
style=
"margin-left: 10px;"
>
<el-checkbox
v-model=
"isAutoFinish"
>
自动完成上一单
</el-checkbox>
</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
>
</div>
-->
</div>
<div
style=
"margin-left: 10px;"
v-show=
"desktopDevice != 3"
>
<el-checkbox
v-model=
"checked"
>
自动裁切
</el-checkbox>
</div>
...
...
@@ -1185,10 +1202,15 @@ export default {
<
span
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"closeDialog"
>
取消
<
/el-button>
<!--
<
el
-
button
@
click
=
"forcedProductionFN"
>
强制生产
<
/el-button>
<
el
-
button
@
click
=
"forcedProductionFN(true)"
style
=
"color: red;"
<
el
-
button
v
-
if
=
"!showforcedProduc"
@
click
=
"forcedProductionFN"
>
强制生产
<
/el-button
>
<
el
-
button
v
-
if
=
"!showforcedProduc"
@
click
=
"(e) => forcedProductionFN(e, true)"
style
=
"color: red;"
>
自动强制生产
<
/el-button
>
-->
>
<
/span>
<
/el-dialog>
<
/div>
...
...
src/views/design/main/index.vue
View file @
f03769d1
...
...
@@ -1826,12 +1826,20 @@ export default {
detail.productMark
"
>
<!-- <b
style="color:red"
v-if="!selectImgList.length && !isForcedProduction"
<b
style=
"color:#f2e403"
v-if=
"
selectImgList.length &&
selectImgList[selectImgIndex].isForcedProduction
"
>
该生产单素材已经被强制调整适配台版大小,请关注
</b
> -->
<b
style=
"color:green"
v-if=
"selectImgList.length"
>
<b
style=
"color:green"
v-if=
"
selectImgList.length &&
!selectImgList[selectImgIndex].isForcedProduction
"
>
该单无需拖动设计,直接打印
</b
>
</div>
...
...
@@ -1921,25 +1929,6 @@ export default {
</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>
</template>
...
...
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