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
e301fc30
Commit
e301fc30
authored
Apr 13, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:适配新流程
parent
3dcb6d83
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
124 deletions
+31
-124
src/config/index.js
+11
-25
src/server/entity/function.js
+10
-83
src/server/routes/index.js
+0
-5
src/views/design/head/index.vue
+10
-11
No files found.
src/config/index.js
View file @
e301fc30
export
const
pathMap
=
{
//查询接口
findByPodProductionNo
:
{
CN
:
"factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber"
,
US
:
"factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber"
,
GC
:
"factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber"
,
},
findByPodProductionNo
:
"factory/podOrderOperation/getByOperationNo"
,
//下载素材接口
downloadBySubOrderNumber
:
{
CN
:
"factory/podJomallOrderProductCn/downloadDesignImages"
,
US
:
"factory/podJomallOrderProductUs/downloadDesignImages"
,
GC
:
"factory/podJomallOrder/downloadByProduction"
,
USHLC
:
"factory/podJomallOrderProductUs/downloadCompatibleDesignImages"
,
CNHLC
:
"factory/podJomallOrderProductCn/downloadCompatibleDesignImages"
,
XD
:
"factory/podOrderOperation/downloadDesignImages"
,
HLC
:
"factory/podOrderOperation/downloadCompatibleDesignImages"
,
},
//生产完成接口
completeDelivery
:
{
CN
:
"factory/podJomallOrderProductCn/completeDelivery"
,
US
:
"factory/podJomallOrderProductUs/completeDelivery"
,
GC
:
"factory/podJomallOrderProduct/completeDelivery"
,
},
//惠立彩素材下载接口
processTransparentBackground
:
{
CN
:
"factory/podJomallOrderProductCn/processTransparentBackground"
,
US
:
"factory/podJomallOrderProductUs/processTransparentBackground"
,
},
completeDelivery
:
"factory/podOrderOperation/printerCompleteDelivery"
,
};
export
function
autoRegisterRouter
(
router
,
funcKey
,
handler
)
{
const
configGroup
=
pathMap
[
funcKey
];
const
config
=
pathMap
[
funcKey
];
const
pathList
=
typeof
config
===
"string"
?
[
config
]
:
Object
.
values
(
config
);
// 遍历配置自动注册路由
Object
.
values
(
configGroup
).
forEach
((
el
)
=>
{
router
.
post
(
`/
${
el
}
`
,
(
req
,
res
)
=>
{
handler
(
req
,
res
)
;
}
);
pathList
.
forEach
((
path
)
=>
{
// 拼接完整路径(兼容首尾斜杠)
const
fullPath
=
`/
${
path
.
replace
(
/^
\/
/
,
""
)}
`
;
router
.
post
(
fullPath
,
handler
);
});
}
src/server/entity/function.js
View file @
e301fc30
...
...
@@ -157,16 +157,14 @@ export default {
const
forceProduction
=
params
.
forceProduction
||
false
;
const
downloadBySubOrderNumber
=
pathMap
[
"downloadBySubOrderNumber"
];
try
{
let
url
=
downloadBySubOrderNumber
[
params
.
orderType
];
let
url
=
downloadBySubOrderNumber
[
"XD"
];
let
postUrl
=
`
${
env
}
/
${
url
}
`
;
if
(
params
.
device
==
3
)
{
url
=
params
.
orderType
==
"CN"
?
downloadBySubOrderNumber
[
"CNHLC"
]
:
downloadBySubOrderNumber
[
"USHLC"
];
url
=
downloadBySubOrderNumber
[
"HLC"
];
postUrl
=
`
${
env
}
/
${
url
}
?forceProduction=
${
forceProduction
}
`
;
}
console
.
log
(
"postUrl"
,
postUrl
);
const
{
data
}
=
await
axios
.
post
(
postUrl
,
[...
params
.
ids
],
{
headers
:
{
"jwt-token"
:
token
},
});
...
...
@@ -174,7 +172,7 @@ export default {
if
(
data
.
code
!==
200
)
{
return
res
.
json
(
data
);
}
console
.
log
(
"data"
,
data
);
console
.
log
(
"data
200
"
,
data
);
let
path
,
processDesignA
,
processDesignB
;
if
(
data
.
data
)
{
path
=
data
.
data
.
path
||
data
.
data
[
0
];
...
...
@@ -214,29 +212,11 @@ export default {
const
params
=
req
.
body
;
try
{
const
urlArr
=
{
CN
:
{
field
:
"factorySubOrderNumber"
,
url
:
"factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber"
,
},
US
:
{
field
:
"factorySubOrderNumber"
,
url
:
"factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber"
,
},
GC
:
{
field
:
"thirdSubOrderNumber"
,
url
:
"factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber"
,
},
};
let
url
=
urlArr
[
params
.
orderType
].
url
;
let
paramsField
=
urlArr
[
params
.
orderType
].
field
;
let
url
=
pathMap
[
"findByPodProductionNo"
];
let
{
data
}
=
await
axios
.
get
(
`
${
env
}
/
${
url
}
`
,
{
params
:
{
[
paramsField
]:
params
.
thirdSubOrderNumber
,
resizable
:
params
.
resizable
,
operationNo
:
params
.
thirdSubOrderNumber
,
},
headers
:
{
"jwt-token"
:
token
},
});
...
...
@@ -262,30 +242,10 @@ export default {
completeDelivery
:
async
(
req
,
res
)
=>
{
env
=
getHostApi
().
apiApiHost
;
const
token
=
req
.
headers
[
"jwt-token"
];
const
params
=
req
.
body
;
const
urlArr
=
{
CN
:
{
data
:
{
id
:
params
.
id
,
podJomallOrderCnId
:
params
.
podJomallOrderCnId
||
""
,
},
url
:
"factory/podJomallOrderProductCn/completeDelivery"
,
},
US
:
{
data
:
{
id
:
params
.
id
,
podJomallOrderUsId
:
params
.
podJomallOrderUsId
||
""
,
},
url
:
"factory/podJomallOrderProductUs/completeDelivery"
,
},
GC
:
{
data
:
{
id
:
params
.
id
},
url
:
"factory/podJomallOrderProduct/completeDelivery"
,
},
};
let
url
=
urlArr
[
params
.
orderType
].
url
;
const
postData
=
req
.
body
;
let
url
=
pathMap
[
"completeDelivery"
];
let
postData
=
urlArr
[
params
.
orderType
].
data
;
// console.log("postData", postData);
// console.log("240url", url);
...
...
@@ -597,37 +557,4 @@ export default {
res
.
json
({
code
:
500
,
msg
:
error
});
}
},
processTransparentBackground
:
async
(
req
,
res
)
=>
{
env
=
getHostApi
().
apiApiHost
;
const
token
=
req
.
headers
[
"jwt-token"
];
const
{
imgUrl
,
subOrderNumber
,
orderType
}
=
req
.
body
;
const
processTransparentBackground
=
pathMap
[
"processTransparentBackground"
];
let
url
=
processTransparentBackground
[
orderType
];
let
postData
=
{
url
:
imgUrl
,
subOrderNumber
};
try
{
let
{
data
}
=
await
axios
.
get
(
`
${
env
}
/
${
url
}
`
,
{
params
:
postData
,
headers
:
{
"jwt-token"
:
token
},
});
console
.
log
(
"processTransparentBackground"
,
data
);
if
(
data
.
message
)
{
data
.
message
=
encodeURIComponent
(
data
.
message
);
}
let
files
=
data
.
data
||
[
data
.
message
];
files
=
files
.
map
((
el
)
=>
({
url
:
`
${
fileEnv
}${
el
}
`
}));
console
.
log
(
"processTransparentBackground,files"
,
files
);
const
result
=
await
downloadImage
(
files
);
res
.
json
({
code
:
200
,
data
:
result
});
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
json
({
code
:
500
,
msg
:
err
});
}
},
};
src/server/routes/index.js
View file @
e301fc30
...
...
@@ -58,9 +58,4 @@ router.post("/copySingleImageFn", fn.copySingleImageFn);
// 根据生产单号查询详情
autoRegisterRouter
(
router
,
"findByPodProductionNo"
,
fn
.
findByPodProductionNo
);
autoRegisterRouter
(
router
,
"processTransparentBackground"
,
fn
.
processTransparentBackground
,
);
export
{
router
as
default
};
src/views/design/head/index.vue
View file @
e301fc30
...
...
@@ -232,8 +232,7 @@ export default {
async
setData
(
data
)
{
if
(
!
data
)
return
this
.
$message
.
warning
(
"请扫描生产单号"
);
const
params
=
{
id
:
data
.
id
,
orderType
:
this
.
orderType
,
...
this
.
detail
,
};
if
(
this
.
orderType
===
"CN"
)
{
params
.
podJomallOrderCnId
=
data
.
podJomallOrderCnId
;
...
...
@@ -485,16 +484,18 @@ export default {
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
if
(
!
imageResList
.
length
&&
!
bool
)
{
try
{
let
newType
=
this
.
orderType
;
if
(
this
.
orderType
==
"CN"
&&
this
.
desktopDevice
==
3
)
{
newType
=
this
.
orderType
==
"CN"
?
"CNHLC"
:
"US
HLC"
;
let
newType
=
"XD"
;
if
(
this
.
desktopDevice
==
3
)
{
newType
=
"
HLC"
;
}
console
.
log
(
"this.detail"
,
this
.
detail
);
let
res
=
await
this
.
$api
.
post
(
pathMap
[
"downloadBySubOrderNumber"
][
newType
],
{
ids
:
[
this
.
detail
.
i
d
],
ids
:
[
this
.
detail
.
podOrderProductI
d
],
device
:
this
.
desktopDevice
,
orderType
:
this
.
orderType
,
forceProduction
:
this
.
isForcedProduction
||
isForcedProduction
||
false
,
},
...
...
@@ -649,8 +650,6 @@ export default {
let findByPodProductionNo;
const apiRequestParams = {
thirdSubOrderNumber: this.productionNo,
orderType: this.orderType,
resizable: this.desktopDevice == 3 ? true : false,
};
//判断是否为惠立彩
...
...
@@ -662,12 +661,12 @@ export default {
findByPodProductionNo =
localItem ||
(await this.$api.post(
pathMap["
findByPodProductionNo
"]
[this.orderType]
,
pathMap["
findByPodProductionNo
"],
apiRequestParams,
));
} else {
findByPodProductionNo = await this.$api.post(
pathMap["
findByPodProductionNo
"]
[this.orderType]
,
pathMap["
findByPodProductionNo
"],
apiRequestParams,
);
}
...
...
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