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
79810b7c
Commit
79810b7c
authored
Jul 19, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改查询参数的问题
parent
ed22eae2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
142 deletions
+30
-142
logs/2025-07-19/print.json
+2
-0
src/server/utils/log.js
+15
-138
src/views/design/head/index.vue
+11
-2
src/views/design/main/index.vue
+2
-2
No files found.
logs/2025-07-19/print.json
0 → 100644
View file @
79810b7c
[{
"head_setting"
:{
"gridShow"
:
1
,
"gridValue"
:
0
,
"unit"
:
"inch"
,
"language"
:
"cn"
,
"autoPrint"
:
false
,
"gridSpacing"
:
1
},
"version"
:
"1.0.16"
,
"print_setting"
:{
"printer"
:
""
,
"xy"
:
""
,
"byInk"
:
2
,
"byInkVolume"
:
1
,
"byDoublePrint"
:
3
,
"bEcoMode"
:
false
,
"bMaterialBlack"
:
false
,
"byHighlight"
:
5
,
"printNum"
:
1
,
"bFastMode"
:
false
,
"bUniPrint"
:
false
,
"bDivide"
:
false
,
"bPause"
:
false
,
"byMask"
:
3
,
"bTransColor"
:
false
,
"byChoke"
:
2
,
"minWhiteInkType"
:
0
,
"bySaturation"
:
5
,
"byBrightness"
:
5
,
"byContrast"
:
5
,
"iCyanBalance"
:
0
,
"iMagentaBalance"
:
0
,
"iBlackBalance"
:
0
,
"iYellowBalance"
:
0
,
"byMinWhite"
:
1
,
"bMultiple"
:
false
},
"production_no"
:
"GCPSC2507193437"
,
"print_time"
:
"2025-07-19 15:12:08"
,
"position_unit"
:{
"x"
:
408.8
,
"rate"
:
1.396341463414634
,
"sx"
:
0
,
"zIndex"
:
0
,
"sh"
:
0
,
"sw"
:
0
,
"sy"
:
0
,
"y"
:
458.6
,
"w"
:
594.4
,
"h"
:
826.7
,
"r"
:
0
},
"position_after_px"
:{
"x"
:
"0.4"
,
"rate"
:
1.0410958904109588
,
"sx"
:
0
,
"zIndex"
:
0
,
"sh"
:
0
,
"sw"
:
0
,
"sy"
:
0
,
"y"
:
"1.5"
,
"w"
:
"26.4"
,
"h"
:
"27.4"
,
"r"
:
0
},
"position_before_px"
:{
"url"
:
"D:
\\
work
\\
electron-printer
\\
print
\\
Input
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"fileName"
:
"fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"rate"
:
1.0410958904109588
,
"w"
:
795.3157894736843
,
"zIndex"
:
0
,
"x"
:
11.342105263157862
,
"y"
:
46
,
"h"
:
828
,
"r"
:
0
},
"send_api_data"
:{
"printer"
:
""
,
"xy"
:
""
,
"byInk"
:
2
,
"byInkVolume"
:
1
,
"byDoublePrint"
:
3
,
"bEcoMode"
:
false
,
"bMaterialBlack"
:
false
,
"byHighlight"
:
5
,
"printNum"
:
1
,
"bFastMode"
:
false
,
"bUniPrint"
:
false
,
"bDivide"
:
false
,
"bPause"
:
false
,
"byMask"
:
3
,
"bTransColor"
:
false
,
"byChoke"
:
2
,
"minWhiteInkType"
:
0
,
"bySaturation"
:
5
,
"byBrightness"
:
5
,
"byContrast"
:
5
,
"iCyanBalance"
:
0
,
"iMagentaBalance"
:
0
,
"iBlackBalance"
:
0
,
"iYellowBalance"
:
0
,
"byMinWhite"
:
1
,
"bMultiple"
:
false
,
"byPlatenSize"
:
1
,
"cmd"
:
"GTXproCMD.exe print -X
\"
Profile
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.xml
\"
-I
\"
Input
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.png
\"
-A
\"
Output
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp
\"
-S 39374100 -L 00610233 -D 0 -W 1"
,
"fileName"
:
"fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"print_cmd"
:
"GTXproCMD.exe send -A
\"
Output
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp
\"
-P
\"
Brother GTX pro FileOutput"
}},{
"head_setting"
:{
"gridShow"
:
1
,
"gridValue"
:
0
,
"unit"
:
"inch"
,
"language"
:
"cn"
,
"autoPrint"
:
false
,
"gridSpacing"
:
1
},
"version"
:
"1.0.16"
,
"print_setting"
:{
"printer"
:
""
,
"xy"
:
""
,
"byInk"
:
2
,
"byInkVolume"
:
1
,
"byDoublePrint"
:
3
,
"bEcoMode"
:
false
,
"bMaterialBlack"
:
false
,
"byHighlight"
:
5
,
"printNum"
:
1
,
"bFastMode"
:
false
,
"bUniPrint"
:
false
,
"bDivide"
:
false
,
"bPause"
:
false
,
"byMask"
:
3
,
"bTransColor"
:
false
,
"byChoke"
:
2
,
"minWhiteInkType"
:
0
,
"bySaturation"
:
5
,
"byBrightness"
:
5
,
"byContrast"
:
5
,
"iCyanBalance"
:
0
,
"iMagentaBalance"
:
0
,
"iBlackBalance"
:
0
,
"iYellowBalance"
:
0
,
"byMinWhite"
:
1
,
"bMultiple"
:
false
},
"production_no"
:
"GCPSC2507193437"
,
"print_time"
:
"2025-07-19 15:12:00"
,
"position_unit"
:{
"x"
:
408.8
,
"rate"
:
1.396341463414634
,
"sx"
:
0
,
"zIndex"
:
0
,
"sh"
:
0
,
"sw"
:
0
,
"sy"
:
0
,
"y"
:
458.6
,
"w"
:
594.4
,
"h"
:
826.7
,
"r"
:
0
},
"position_after_px"
:{
"x"
:
"0.4"
,
"rate"
:
1.0410958904109588
,
"sx"
:
0
,
"zIndex"
:
0
,
"sh"
:
0
,
"sw"
:
0
,
"sy"
:
0
,
"y"
:
"1.5"
,
"w"
:
"26.4"
,
"h"
:
"27.4"
,
"r"
:
0
},
"position_before_px"
:{
"url"
:
"D:
\\
work
\\
electron-printer
\\
print
\\
Input
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"fileName"
:
"fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"rate"
:
1.0410958904109588
,
"w"
:
795.3157894736843
,
"zIndex"
:
0
,
"x"
:
11.342105263157862
,
"y"
:
46
,
"h"
:
828
,
"r"
:
0
},
"send_api_data"
:{
"printer"
:
""
,
"xy"
:
""
,
"byInk"
:
2
,
"byInkVolume"
:
1
,
"byDoublePrint"
:
3
,
"bEcoMode"
:
false
,
"bMaterialBlack"
:
false
,
"byHighlight"
:
5
,
"printNum"
:
1
,
"bFastMode"
:
false
,
"bUniPrint"
:
false
,
"bDivide"
:
false
,
"bPause"
:
false
,
"byMask"
:
3
,
"bTransColor"
:
false
,
"byChoke"
:
2
,
"minWhiteInkType"
:
0
,
"bySaturation"
:
5
,
"byBrightness"
:
5
,
"byContrast"
:
5
,
"iCyanBalance"
:
0
,
"iMagentaBalance"
:
0
,
"iBlackBalance"
:
0
,
"iYellowBalance"
:
0
,
"byMinWhite"
:
1
,
"bMultiple"
:
false
,
"byPlatenSize"
:
1
,
"cmd"
:
"GTXproCMD.exe print -X
\"
Profile
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.xml
\"
-I
\"
Input
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.png
\"
-A
\"
Output
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp
\"
-S 39374100 -L 00610233 -D 0 -W 1"
,
"fileName"
:
"fe1efecb-506e-4400-b264-c8e2d87adc5e.png"
,
"print_cmd"
:
"GTXproCMD.exe send -A
\"
Output
\\
fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp
\"
-P
\"
导出为WPS PDF"
}}]
\ No newline at end of file
src/server/utils/log.js
View file @
79810b7c
...
...
@@ -3,91 +3,42 @@ const moment = require("moment");
const
fs
=
require
(
"fs"
);
const
path
=
require
(
"path"
);
// 获取日志文件路径
function
returnLogFilePath
()
{
export
function
returnLogFilePath
()
{
const
today
=
moment
(
new
Date
()).
format
(
"YYYY-MM-DD"
);
const
low_path
=
process
.
cwd
();
let
log_dir
=
path
.
join
(
low_path
,
"logs"
);
if
(
!
fs
.
existsSync
(
log_dir
))
{
fs
.
mkdirSync
(
log_dir
,
{
recursive
:
true
});
fs
.
mkdirSync
(
log_dir
);
// 创建日志文件夹
}
const
dir
=
path
.
join
(
low_path
,
`/logs/
${
today
}
`
);
if
(
!
fs
.
existsSync
(
dir
))
{
fs
.
mkdirSync
(
dir
);
}
return
path
.
join
(
dir
,
"api.log"
);
}
// 获取错误日志文件路径
function
returnErrorLogFilePath
()
{
const
today
=
moment
(
new
Date
()).
format
(
"YYYY-MM-DD"
);
const
low_path
=
process
.
cwd
();
let
log_dir
=
path
.
join
(
low_path
,
"logs"
);
if
(
!
fs
.
existsSync
(
log_dir
))
{
fs
.
mkdirSync
(
log_dir
,
{
recursive
:
true
});
}
const
dir
=
path
.
join
(
low_path
,
`/logs/
${
today
}
`
);
if
(
!
fs
.
existsSync
(
dir
))
{
fs
.
mkdirSync
(
dir
);
}
return
path
.
join
(
dir
,
"error.log"
);
}
// 初始化日志系统
function
initLogger
()
{
//日志对象
const
logger
=
(
name
)
=>
{
const
logFilePath
=
returnLogFilePath
();
const
errorLogFilePath
=
returnErrorLogFilePath
();
log4js
.
configure
({
appenders
:
{
console
:
{
type
:
"console"
},
fil
e
:
{
out
:
{
type
:
"console"
},
//在控制台输出日志
chees
e
:
{
type
:
"file"
,
filename
:
logFilePath
,
maxLogSize
:
1024
*
1000
*
10
,
backups
:
5
,
compress
:
true
,
},
errorFile
:
{
type
:
"file"
,
filename
:
errorLogFilePath
,
maxLogSize
:
1024
*
1000
*
5
,
backups
:
10
,
compress
:
true
,
},
errors
:
{
type
:
"logLevelFilter"
,
appender
:
"errorFile"
,
level
:
"error"
,
maxLogSize
:
1024
*
1000
*
10
,
//10M
},
},
categories
:
{
default
:
{
appenders
:
[
"console"
,
"file"
,
"errors"
],
level
:
"debug"
,
},
//需要在控制台输出日志时:appenders: ['cheese', 'out']
default
:
{
appenders
:
[
"cheese"
],
level
:
log4js
.
levels
.
DEBUG
},
},
});
return
log4js
.
getLogger
(
name
);
};
return
log4js
.
getLogger
();
}
// 创建全局日志实例
const
logger
=
initLogger
();
// 添加请求日志
//添加日志
const
addFormatLog
=
function
(
req
,
res
,
data
)
{
// 检查是否需要屏蔽此URL
if
(
shouldSkipLogging
(
req
.
url
))
{
return
;
}
const
now
=
new
Date
();
const
resTime
=
now
-
req
.
_startTime
;
...
...
@@ -101,7 +52,6 @@ const addFormatLog = function(req, res, data) {
httpVersion
,
res
:
{
statusCode
,
_headers
},
}
=
req
;
let
logInfo
=
{
ip
,
host
:
headers
.
host
,
...
...
@@ -116,8 +66,8 @@ const addFormatLog = function(req, res, data) {
userAgent
:
headers
[
"user-agent"
],
data
:
data
[
0
],
};
logger
.
info
(
`
// ${JSON.stringify(logInfo)}
logger
(
"log"
)
.
info
(
`
时间:
${
moment
(
new
Date
()).
format
(
"YYYY-MM-DD HH:mm:ss"
)}
ip :
${
logInfo
.
ip
}
host :
${
logInfo
.
host
}
...
...
@@ -131,25 +81,9 @@ const addFormatLog = function(req, res, data) {
`
);
};
// 判断是否需要跳过日志记录
function
shouldSkipLogging
(
url
)
{
// 定义需要屏蔽的URL列表
const
skippedUrls
=
[
"/getAllCountry"
,
// 您想要屏蔽的接口
// 可以添加更多需要屏蔽的URL
];
return
skippedUrls
.
some
((
skippedUrl
)
=>
url
.
includes
(
skippedUrl
));
}
// 日志中间件
//日志中间件
export
const
logMiddleWare
=
()
=>
{
return
function
(
req
,
res
,
next
)
{
// 检查是否需要跳过此请求的日志记录
if
(
shouldSkipLogging
(
req
.
url
))
{
return
next
();
}
req
.
_startTime
=
new
Date
();
const
oldSend
=
res
.
send
;
...
...
@@ -163,60 +97,3 @@ export const logMiddleWare = () => {
return
next
();
};
};
// ================= 错误捕获增强 =================
// 捕获未处理的异常
process
.
on
(
"uncaughtException"
,
(
error
)
=>
{
logger
.
fatal
(
`
====== 未捕获的异常 ======
时间:
${
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
)}
错误信息:
${
error
.
message
}
堆栈跟踪:
${
error
.
stack
}
========================
`
);
});
// 捕获未处理的Promise拒绝
process
.
on
(
"unhandledRejection"
,
(
reason
,
promise
)
=>
{
logger
.
fatal
(
`
====== 未处理的Promise拒绝 ======
时间:
${
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
)}
拒绝原因:
${
reason
}
Promise对象:
${
promise
}
===============================
`
);
});
// 导出增强的日志系统
export
default
{
logger
,
logMiddleWare
,
// 添加错误日志函数
logError
:
(
error
,
context
=
{})
=>
{
logger
.
error
(
`
====== 错误日志 ======
时间:
${
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
)}
错误信息:
${
error
.
message
}
堆栈跟踪:
${
error
.
stack
}
上下文信息:
${
JSON
.
stringify
(
context
,
null
,
2
)}
=====================
`
);
},
// 添加致命错误日志函数
logFatal
:
(
error
,
context
=
{})
=>
{
logger
.
fatal
(
`
====== 致命错误 ======
时间:
${
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
)}
错误信息:
${
error
.
message
}
堆栈跟踪:
${
error
.
stack
}
上下文信息:
${
JSON
.
stringify
(
context
,
null
,
2
)}
=====================
`
);
},
};
src/views/design/head/index.vue
View file @
79810b7c
...
...
@@ -304,8 +304,8 @@ export default {
},
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
)
{
let
imageResList
=
[];
//
let debug = false;
if
(
this
.
detail
.
adjustable
&&
designImagesCanvasJsonList
)
{
let
debug
=
false
;
if
(
debug
&&
this
.
detail
.
adjustable
&&
designImagesCanvasJsonList
)
{
designImagesCanvasJsonList
=
JSON
.
parse
(
designImagesCanvasJsonList
);
if
(
designImagesCanvasJsonList
[
0
].
images
)
{
designImagesCanvasJsonList
.
forEach
((
el
)
=>
{
...
...
@@ -413,6 +413,15 @@ export default {
console.error("
清理目录时发生错误
:
", error.message);
}
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
if (regex.test(this.productionNo)) {
this.productionNo =
this.productionNo.split("
_
")[0] +
"
-
" +
this.productionNo.split("
_
")[this.productionNo.split("
_
").length - 1];
}
console.log(423, this.productionNo);
try {
//查找生产单号信息传给第二个显示器
const findByPodProductionNo = await this.$api.post(
...
...
src/views/design/main/index.vue
View file @
79810b7c
...
...
@@ -1468,7 +1468,7 @@ export default {
</div>
<!-- <div class="imgBox" style=""></div> -->
</div>
<div
<
!-- <
div
class="print-tip"
:style="{ left: isView ? '' : '22%' }"
v-if="
...
...
@@ -1482,7 +1482,7 @@ export default {
>该生产单无需拖动设计,直接打印</b
>
<b style="color: red" v-else>该生产单需要拖动设计打印</b>
</div>
</div>
-->
</div>
<img
...
...
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