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
a327daff
Commit
a327daff
authored
Jan 08, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:添加删除模式
parent
2c071741
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
33 deletions
+102
-33
logs/2025-12-31/print.json
+0
-0
print/send.bat
+2
-1
src/background.js
+6
-1
src/server/utils/index.js
+18
-1
src/server/utils/store.js
+4
-0
src/views/design/head/index.vue
+70
-28
src/views/design/head/printDialog.vue
+2
-2
No files found.
logs/2025-12-31/print.json
0 → 100644
View file @
a327daff
This diff is collapsed.
Click to expand it.
print/send.bat
View file @
a327daff
GTXproCMD.exe send -A "
D:\sample\
Output\pO12.arxp" -P "Brother GTX pro" -D 1
GTXproCMD.exe send -A "Output\pO12.arxp" -P "Brother GTX pro" -D 1
echo %errorlevel%
\ No newline at end of file
src/background.js
View file @
a327daff
...
...
@@ -7,7 +7,7 @@ import { autoUpdater } from "electron-updater";
import
path
from
"path"
;
// 引入 path 模块
const
{
exec
}
=
require
(
"child_process"
);
const
{
setVersion
}
=
require
(
"@/server/utils/store"
);
const
{
setVersion
,
setDeleteSetting
}
=
require
(
"@/server/utils/store"
);
Object
.
defineProperty
(
app
,
"isPackaged"
,
{
get
()
{
...
...
@@ -202,6 +202,11 @@ app.on("ready", async () => {
setVersion
(
version
);
// 保存到 electron-store
});
ipcMain
.
on
(
"update-deleteSetting"
,
(
_
,
version
)
=>
{
console
.
log
(
72
,
version
);
setDeleteSetting
(
version
);
// 保存到 electron-store
});
});
app
.
on
(
"will-quit"
,
()
=>
{
...
...
src/server/utils/index.js
View file @
a327daff
...
...
@@ -144,6 +144,13 @@ export const downloadImage = (list) => {
fs
.
mkdirSync
(
dirPath
,
{
recursive
:
true
});
}
try
{
await
fs
.
promises
.
access
(
dirPath
,
fs
.
constants
.
W_OK
);
}
catch
(
error
)
{
console
.
error
(
"没有目录写入权限:"
,
dirPath
);
// return reject(new Error('没有写入权限'));
}
// 过滤出有效的下载项
const
downloadItems
=
list
.
filter
(
(
item
)
=>
item
.
url
&&
item
.
url
.
includes
(
"http"
)
...
...
@@ -153,6 +160,7 @@ export const downloadImage = (list) => {
if
(
downloadItems
.
length
===
0
)
{
return
resolve
(
list
);
}
// 检查写入权限
// 并行处理所有下载
const
downloadPromises
=
downloadItems
.
map
((
item
)
=>
{
...
...
@@ -205,7 +213,16 @@ export const downloadImage = (list) => {
if
(
isArchive
)
{
// 处理压缩文件
item
.
list
=
await
zip
(
filePath
,
dirPath
);
try
{
// 添加await确保异步完成
const
result
=
await
zip
(
filePath
,
dirPath
);
// 显式赋值,确保引用正确
item
.
list
=
result
||
[];
console
.
log
(
"解压完成,文件数量:"
,
item
.
list
.
length
);
}
catch
(
zipError
)
{
console
.
error
(
"解压失败:"
,
zipError
);
item
.
list
=
[];
}
}
else
{
// 处理普通图片文件
if
(
!
item
.
list
)
item
.
list
=
[];
...
...
src/server/utils/store.js
View file @
a327daff
...
...
@@ -5,7 +5,11 @@ module.exports = {
setVersion
:
(
version
)
=>
{
store
.
set
(
"desktoVersion"
,
version
);
},
setDeleteSetting
:
(
setting
)
=>
{
store
.
set
(
"deleteSetting"
,
setting
);
},
getVersion
:
()
=>
store
.
get
(
"desktoVersion"
)
||
"print"
,
getDeleteSetting
:
()
=>
store
.
get
(
"deleteSetting"
)
||
"0"
,
setBoard
:
(
version
)
=>
{
store
.
set
(
"desktoBoard"
,
version
);
console
.
log
(
"store"
,
store
.
get
(
"desktoBoard"
));
...
...
src/views/design/head/index.vue
View file @
a327daff
...
...
@@ -12,7 +12,7 @@ import { extractValue } from "@/utils/index.js";
const
uuid
=
require
(
"uuid"
);
const
fs
=
require
(
"fs"
);
import
{
mapState
}
from
"vuex"
;
const
{
getVersion
}
=
require
(
"@/server/utils/store"
);
const
{
getVersion
,
getDeleteSetting
}
=
require
(
"@/server/utils/store"
);
export
default
{
components
:
{
UpdateDialog
},
...
...
@@ -31,6 +31,7 @@ export default {
checkList
:
[],
desktopDevice
:
1
,
desktoVersion
:
getVersion
(),
deleteSetting
:
getDeleteSetting
(),
checked
:
false
,
isFirst
:
true
,
cacheList
:
[
...
...
@@ -621,6 +622,24 @@ export default {
this.$store.commit("
getNewGrid
");
this.command(0);
},
changeDeleteSetting(value) {
const oldValue = this.deleteSetting; // 缓存旧值
console.log(626, oldValue);
// this.$confirm("
选择该操作打印后会导致打印记录清空,是否继续?
", "
警告
", {
// confirmButtonText: "
确定
",
// cancelButtonText: "
取消
",
// type: "
warning
",
// })
// .then(() => {
// ipcRenderer.send("
update
-
deleteSetting
", value);
// })
// .catch(() => {
// this.deleteSetting = oldValue;
// });
ipcRenderer.send("
update
-
deleteSetting
", value);
// console.log(626, this.deleteSetting);
},
async cutImgFn(arr) {
if (!arr.length) return arr;
console.log(arr);
...
...
@@ -717,6 +736,7 @@ export default {
.left-btn
{
display
:
flex
;
flex
:
1
;
}
</
style
>
<
template
>
...
...
@@ -727,6 +747,7 @@ export default {
<div>
设备类型:
</div>
<el-select
class=
"selectItem"
v-model=
"desktopDevice"
@
change=
"changeDesktopDeviceFn"
placeholder=
"请选择设备类型"
...
...
@@ -735,10 +756,12 @@ export default {
<el-option
label=
"其他"
:value=
"2"
></el-option>
</el-select>
</div>
<div
class=
"selectInput"
>
<div>
驱动版本:
</div>
<el-select
class=
"selectItem"
v-model=
"desktoVersion"
@
change=
"changeDesktoVersionFn"
placeholder=
"请选择版本"
...
...
@@ -748,8 +771,25 @@ export default {
<el-option
label=
"600"
value=
"print600"
></el-option>
</el-select>
</div>
<div
class=
"selectInput"
>
<div>
删除模式:
</div>
<el-dropdown
trigger=
"click"
@
command=
"command"
:hide-on-click=
"false"
>
<el-select
class=
"selectDelete"
v-model=
"deleteSetting"
@
change=
"changeDeleteSetting"
placeholder=
"请选择"
>
<el-option
label=
"自动删除打印素材(打印后)"
value=
"1"
></el-option>
<el-option
label=
"保留打印素材(打印后)"
value=
"0"
></el-option>
</el-select>
</div>
<el-dropdown
class=
"selectInput"
trigger=
"click"
@
command=
"command"
:hide-on-click=
"false"
>
<el-button
style=
"height: 100%;margin-right: 0"
size=
"small"
>
{{
grid
[
selectGridIndex
]?.
label
}}
</el-button>
...
...
@@ -760,7 +800,7 @@ export default {
</el-dropdown-menu>
</el-dropdown>
<el-tooltip
content=
"图片"
>
<el-tooltip
c
lass=
"selectInput"
c
ontent=
"图片"
>
<el-upload
accept=
".png"
action=
""
...
...
@@ -769,7 +809,7 @@ export default {
:before-upload=
"uploadImage"
style=
"height: 100%;"
>
<el-button
style=
"height: 100%
;margin:0 8px
"
size=
"small"
>
<el-button
style=
"height: 100%"
size=
"small"
>
<i
class=
"el-icon-picture"
style=
"font-size: 15px;"
></i>
</el-button>
</el-upload>
...
...
@@ -792,7 +832,7 @@ export default {
trigger=
"click"
placement=
"bottom"
>
<div
class=
"setting-form"
>
<div
class=
"setting-form
selectInput
"
>
<el-form
:model=
"setting"
label-position=
"left"
...
...
@@ -902,20 +942,19 @@ export default {
type=
"success"
>
生产完成
</el-button>
<div
class=
"check"
>
<el-checkbox
v-model=
"isAutoFinish"
>
自动完成上一单
</el-checkbox>
</div>
</div>
<div
style=
"margin-left:
10
px;"
>
<el-checkbox
v-model=
"
checked"
>
自动裁切素材
</el-checkbox>
<div
style=
"margin-left:
8
px;"
>
<el-checkbox
v-model=
"
isAutoFinish"
>
自动完成上一单
</el-checkbox>
</div>
<el-button
<div
style=
"margin-left: 8px;"
>
<el-checkbox
v-model=
"checked"
>
自动裁切
</el-checkbox>
</div>
<!--
<el-button
@
click=
"downloadImage"
size=
"medium"
style=
"margin-left: 15px"
style=
"margin-left: 8px"
type=
"primary"
>
下载素材
</el-button>
</el-button>
-->
</div>
<div
class=
"right-user"
>
<div
...
...
@@ -1019,28 +1058,28 @@ export default {
.
center
-
input
{
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
center
;
//
justify-content: center;
flex
:
1
;
flex
-
shrink
:
0
;
overflow
:
hidden
;
padding
-
left
:
100
px
;
//
padding-left: 100px;
}
.
sure
-
btn
{
width
:
30
0
px
;
// width: 25
0px;
position
:
relative
;
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
center
;
::
v
-
deep
{
.
el
-
button
{
span
{
position
:
relative
;
left
:
-
40
px
;
}
}
}
//
::v-deep
{
//
.el-button
{
//
span
{
//
position: relative;
//
left: -40px;
//
}
//
}
//
}
}
.
check
{
...
...
@@ -1065,12 +1104,15 @@ export default {
.
selectInput
{
display
:
flex
;
align
-
items
:
center
;
margin
:
0
10
px
;
margin
-
right
:
5
px
;
font
-
size
:
14
px
;
::
v
-
deep
{
.
el
-
select
.
el
-
input
{
.
selectItem
.
el
-
input
{
max
-
width
:
80
px
;
}
.
selectDelete
.
el
-
input
{
max
-
width
:
110
px
;
}
}
}
::
v
-
deep
{
...
...
src/views/design/head/printDialog.vue
View file @
a327daff
...
...
@@ -7,7 +7,7 @@ import moment from "moment";
import
pkg
from
"../../../../package.json"
;
import
{
pxToUnit
}
from
"../../../utils/index"
;
import
{
mapState
}
from
"vuex"
;
const
{
getVersion
}
=
require
(
"@/server/utils/store"
);
const
{
getVersion
,
getDeleteSetting
}
=
require
(
"@/server/utils/store"
);
export
default
{
data
()
{
return
{
...
...
@@ -434,7 +434,7 @@ export default {
let
print_cmd
=
`
${
printCmd
}
send -A "Output\\
${
imgFileName
.
replace
(
".png"
,
""
)}
.arxp" -P "
${
this
.
printer
}
`
;
)}
.arxp" -P "
${
this
.
printer
}
" -D
${
getDeleteSetting
()}
`
;
let
data
=
{
...
this
.
printSetting
,
...{
...
...
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