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
b6aa61fb
Commit
b6aa61fb
authored
Dec 24, 2024
by
zhuzhequan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志功能
parent
c3ac02c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
21 deletions
+14
-21
src/server/entity/function.js
+1
-1
src/views/design/head/printDialog.vue
+2
-2
src/views/design/main/imgSetting.vue
+11
-18
No files found.
src/server/entity/function.js
View file @
b6aa61fb
...
@@ -30,7 +30,7 @@ export default {
...
@@ -30,7 +30,7 @@ export default {
data
=
fs
.
readFileSync
(
p
,
{
encoding
:
"utf-8"
});
data
=
fs
.
readFileSync
(
p
,
{
encoding
:
"utf-8"
});
data
=
JSON
.
parse
(
data
);
data
=
JSON
.
parse
(
data
);
}
}
data
.
push
(
body
);
data
.
unshift
(
body
);
fs
.
writeFileSync
(
p
,
JSON
.
stringify
(
data
));
fs
.
writeFileSync
(
p
,
JSON
.
stringify
(
data
));
res
.
json
({
code
:
200
});
res
.
json
({
code
:
200
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
src/views/design/head/printDialog.vue
View file @
b6aa61fb
...
@@ -356,8 +356,8 @@ export default {
...
@@ -356,8 +356,8 @@ export default {
},
},
async
toWritePrintLog
(
send_api_data
)
{
async
toWritePrintLog
(
send_api_data
)
{
let
head_setting
=
this
.
$dataStore
.
get
(
"setting"
);
let
head_setting
=
this
.
$dataStore
.
get
(
"setting"
);
let
position_before_px
=
this
.
$dataStore
.
get
(
"position
-before-
px"
);
// 图片的位置信息 px
let
position_before_px
=
this
.
$dataStore
.
get
(
"position
_before_
px"
);
// 图片的位置信息 px
let
position_after_px
=
this
.
$dataStore
.
get
(
"position
-after-
px"
);
// 图片根据单位转换后的px
let
position_after_px
=
this
.
$dataStore
.
get
(
"position
_after_
px"
);
// 图片根据单位转换后的px
let
position_unit
=
this
.
$dataStore
.
get
(
"position_unit"
);
// 图片根据单位转换后的px
let
position_unit
=
this
.
$dataStore
.
get
(
"position_unit"
);
// 图片根据单位转换后的px
let
print_time
=
moment
(
new
Date
()).
format
(
"YYYY-MM-DD HH:mm:ss"
);
// 打印的时间
let
print_time
=
moment
(
new
Date
()).
format
(
"YYYY-MM-DD HH:mm:ss"
);
// 打印的时间
let
production_no
=
this
.
$dataStore
.
get
(
"production_no"
);
// 打印的单号
let
production_no
=
this
.
$dataStore
.
get
(
"production_no"
);
// 打印的单号
...
...
src/views/design/main/imgSetting.vue
View file @
b6aa61fb
...
@@ -41,16 +41,15 @@ export default {
...
@@ -41,16 +41,15 @@ export default {
item
:
{
item
:
{
handler
()
{
handler
()
{
if
(
this
.
item
)
{
if
(
this
.
item
)
{
let
setting
=
this
.
$dataStore
.
get
(
"setting"
);
let
setting
=
this
.
$dataStore
.
get
(
"setting"
);
this
.
$dataStore
.
set
(
"position-before-px"
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
item
)));
this
.
item
.
y
=
(
this
.
item
.
y
-
this
.
item
.
h
/
2
);
this
.
item
.
x
=
(
this
.
item
.
x
-
this
.
item
.
w
/
2
);
this
.
$dataStore
.
set
(
"position_before_px"
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
item
)));
console
.
log
(
console
.
log
(
"setting"
,
"setting"
,
setting
setting
);
)
this
.
item
.
y
=
(
this
.
item
.
y
-
this
.
item
.
h
/
2
);
this
.
item
.
x
=
(
this
.
item
.
x
-
this
.
item
.
w
/
2
);
console
.
log
(
this
.
item
.
x
,
this
.
item
.
y
,
this
.
item
.
h
);
let
x_mm
,
w_mm
,
h_mm
,
y_mm
;
let
x_mm
,
w_mm
,
h_mm
,
y_mm
;
if
(
setting
.
unit
===
"mm"
)
{
if
(
setting
.
unit
===
"mm"
)
{
x_mm
=
Number
((
this
.
item
.
x
*
0.84183
).
toFixed
(
2
));
x_mm
=
Number
((
this
.
item
.
x
*
0.84183
).
toFixed
(
2
));
...
@@ -58,13 +57,11 @@ export default {
...
@@ -58,13 +57,11 @@ export default {
h_mm
=
Number
((
this
.
item
.
h
*
0.84183
).
toFixed
(
2
));
h_mm
=
Number
((
this
.
item
.
h
*
0.84183
).
toFixed
(
2
));
y_mm
=
Number
((
this
.
item
.
y
*
0.84183
).
toFixed
(
2
));
y_mm
=
Number
((
this
.
item
.
y
*
0.84183
).
toFixed
(
2
));
}
else
if
(
setting
.
unit
===
"inch"
)
{
}
else
if
(
setting
.
unit
===
"inch"
)
{
x_mm
=
(
Number
((
this
.
item
.
x
*
0.84183
)
/
25.4
).
toFixed
(
2
));
x_mm
=
Number
((
this
.
item
.
x
*
0.84183
)
/
25.4
).
toFixed
(
2
);
w_mm
=
(
Number
((
this
.
item
.
w
*
0.84183
)
/
25.4
).
toFixed
(
2
));
w_mm
=
Number
((
this
.
item
.
w
*
0.84183
)
/
25.4
).
toFixed
(
2
);
h_mm
=
(
Number
((
this
.
item
.
h
*
0.84183
)
/
25.4
).
toFixed
(
2
));
h_mm
=
Number
((
this
.
item
.
h
*
0.84183
)
/
25.4
).
toFixed
(
2
);
y_mm
=
(
Number
((
this
.
item
.
y
*
0.84183
)
/
25.4
).
toFixed
(
2
));
y_mm
=
Number
((
this
.
item
.
y
*
0.84183
)
/
25.4
).
toFixed
(
2
);
}
}
// return
// return
this
.
form
.
x
=
x_mm
;
this
.
form
.
x
=
x_mm
;
this
.
form
.
rate
=
this
.
item
.
rate
;
this
.
form
.
rate
=
this
.
item
.
rate
;
...
@@ -72,12 +69,8 @@ export default {
...
@@ -72,12 +69,8 @@ export default {
this
.
form
.
w
=
w_mm
;
this
.
form
.
w
=
w_mm
;
this
.
form
.
h
=
h_mm
;
this
.
form
.
h
=
h_mm
;
this
.
form
.
zIndex
=
this
.
item
.
zIndex
;
this
.
form
.
zIndex
=
this
.
item
.
zIndex
;
// this.form.sx = x_mm
// this.form.sy = y_mm
// this.form.sh = h_mm
// this.form.sw = w_mm
this
.
form
.
r
=
this
.
item
.
r
;
this
.
form
.
r
=
this
.
item
.
r
;
this
.
$dataStore
.
set
(
`position
-after-
px`
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
)));
this
.
$dataStore
.
set
(
`position
_after_
px`
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
)));
}
}
},
},
immediate
:
true
,
immediate
:
true
,
...
@@ -114,7 +107,7 @@ export default {
...
@@ -114,7 +107,7 @@ export default {
f
[
k
]
=
Number
(
f
[
k
]);
f
[
k
]
=
Number
(
f
[
k
]);
}
}
this
.
$emit
(
"change"
,
f
);
this
.
$emit
(
"change"
,
f
);
this
.
$dataStore
.
set
(
'position_unit'
,
JSON
.
parse
(
JSON
.
stringify
(
f
)))
this
.
$dataStore
.
set
(
"position_unit"
,
JSON
.
parse
(
JSON
.
stringify
(
f
)));
},
},
addValue
(
f
)
{
addValue
(
f
)
{
...
...
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