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
2d7e7247
Commit
2d7e7247
authored
Apr 01, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改强制生产逻辑
parent
f47fda21
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
52 deletions
+74
-52
src/server/entity/function.js
+18
-12
src/server/utils/index.js
+16
-6
src/views/design/head/index.vue
+27
-10
src/views/design/main/index.vue
+13
-24
No files found.
src/server/entity/function.js
View file @
2d7e7247
...
...
@@ -158,38 +158,44 @@ 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
,
processDesign
;
if
(
data
.
data
)
{
path
=
data
.
data
.
path
;
processDesign
=
data
.
data
.
processDesign
;
}
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
,
processDesign
);
console
.
log
(
"result200"
,
result
);
res
.
json
({
code
:
200
,
data
:
result
});
}
catch
(
err
)
{
...
...
src/server/utils/index.js
View file @
2d7e7247
...
...
@@ -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,25 @@ export const downloadImage = (list) => {
if
(
isArchive
)
{
// 处理压缩文件
item
.
list
=
await
zip
(
filePath
,
dirPath
);
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
)
{
item
.
list
.
push
({
fileName
,
productionFile
:
filePath
,
designId
:
originalName
.
split
(
"_GCPS"
)[
0
],
isForcedProduction
:
isForcedProduction
,
});
}
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 @
2d7e7247
...
...
@@ -74,6 +74,7 @@ export default {
cacheVisible
:
false
,
showPrintDialog
:
false
,
productionNo
:
""
,
templateProductionNo
:
""
,
setting
:
{
gridShow
:
1
,
gridValue
:
0
,
...
...
@@ -408,7 +409,11 @@ export default {
}
},
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
,
bool
)
{
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
,
bool
,
isForcedProduction
,
)
{
let
imageResList
=
[];
// 当adjustable有值时 直接赋值宽高
...
...
@@ -473,15 +478,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
)
{
//如果有本地数据 则直接获取本地数据同图片
...
...
@@ -547,7 +555,7 @@ export default {
}
},
async getDataInfo() {
async getDataInfo(
e, isForcedProduction
) {
//查询后先检查当前是否有数据,有则先走生产完成
if (
this.detail &&
...
...
@@ -616,7 +624,7 @@ export default {
this.$store.commit("
setOrderType
", str);
}
this.templateProductionNo = this.productionNo;
try {
//查询当前生产单号是否在本地数据
let localItem = null;
...
...
@@ -658,6 +666,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);
...
...
@@ -849,10 +858,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;
...
...
@@ -1088,11 +1103,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>
...
...
@@ -1183,10 +1198,12 @@ 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
@
click
=
"forcedProductionFN"
>
强制生产
<
/el-button>
<
el
-
button
@
click
=
"(e) => forcedProductionFN(e, true)"
style
=
"color: red;"
>
自动强制生产
<
/el-button
>
-->
>
<
/span>
<
/el-dialog>
<
/div>
...
...
src/views/design/main/index.vue
View file @
2d7e7247
...
...
@@ -1826,12 +1826,20 @@ export default {
detail.productMark
"
>
<!-- <b
style="color:red"
v-if="!selectImgList.length && !isForcedProduction"
<b
style=
"color:#f2e403"
v-if=
"
selectImgList.some((el) => el.isForcedProduction) &&
selectImgList.length
"
>
该生产单素材已经被强制调整适配台版大小,请关注
</b
> -->
<b
style=
"color:green"
v-if=
"selectImgList.length"
>
<b
style=
"color:green"
v-if=
"
!selectImgList.some((el) => el.isForcedProduction) &&
selectImgList.length
"
>
该单无需拖动设计,直接打印
</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