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
f70c7aa5
Commit
f70c7aa5
authored
Apr 30, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试提交
parent
879eca7b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
26 deletions
+33
-26
src/views/design/head/printDialog.vue
+7
-9
src/views/design/main/index.vue
+26
-17
No files found.
src/views/design/head/printDialog.vue
View file @
f70c7aa5
...
...
@@ -296,11 +296,12 @@ export default {
// 使用getBoundingClientRect获取更精确的位置信息
const
imageRect
=
image
.
getBoundingClientRect
();
const
lineRect
=
line
.
getBoundingClientRect
();
console
.
log
(
"lineRect"
,
lineRect
);
console
.
log
(
"imageRect"
,
imageRect
);
// 计算image相对于line的坐标位置
const
relativeX
=
imageRect
.
left
-
lineRect
.
left
;
const
relativeY
=
imageRect
.
top
-
lineRect
.
top
;
console
.
log
(
dom_id
);
// 获取图片的宽高
let
w
=
image
.
clientWidth
/
this
.
WHproportion
;
// 图片宽
let
h
=
image
.
clientHeight
/
this
.
WHproportion
;
// 图片高
...
...
@@ -308,18 +309,15 @@ export default {
const
x
=
relativeX
/
this
.
WHproportion
;
const
y
=
relativeY
/
this
.
WHproportion
;
const
r
=
this
.
imgList
[
0
].
r
;
console
.
log
(
w
,
h
);
console
.
log
(
x
,
y
,
"x,y"
);
const
x_mm
=
this
.
pxToUnit
(
x
,
"mm"
);
const
y_mm
=
this
.
pxToUnit
(
y
,
"mm"
);
const
w_mm
=
this
.
pxToUnit
(
w
,
"mm"
);
const
h_mm
=
this
.
pxToUnit
(
h
,
"mm"
);
// console.log({
// x: Number((x_mm - 0.8).toFixed(1)),
// y: Number((y_mm - 0.9).toFixed(1)),
// w: Number((w_mm - 0.3).toFixed(1)),
// h: Number((h_mm - 0.3).toFixed(1)),
// r
// });
console
.
log
(
"x_mm"
,
x_mm
);
console
.
log
(
"y_mm"
,
y_mm
);
console
.
log
(
"w_mm"
,
w_mm
);
console
.
log
(
"h_mm"
,
h_mm
);
return
{
x
:
x_mm
,
y
:
y_mm
,
...
...
src/views/design/main/index.vue
View file @
f70c7aa5
...
...
@@ -366,12 +366,12 @@ export default {
let
item
=
this
.
imgList
.
find
((
img
)
=>
img
.
fileName
===
it
.
fileName
);
if
(
item
)
return
;
console
.
log
(
this
.
detail
.
designImageSize
);
let
size
=
null
if
(
this
.
detail
.
mssWidth
&&
this
.
detail
.
mssHeight
)
{
let
size
=
null
;
if
(
this
.
detail
.
mssWidth
&&
this
.
detail
.
mssHeight
)
{
size
=
{
width
:
this
.
detail
.
mssWidth
,
height
:
this
.
detail
.
mssHeight
,
}
}
;
}
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this
.
getBackFile
({
files
:
[
it
],
size
},
(
file
)
=>
{
...
...
@@ -530,37 +530,41 @@ export default {
});
},
getComputedName
(
title
)
{
let
img
=
this
.
selectImgList
.
find
((
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
));
let
img
=
this
.
selectImgList
.
find
(
(
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
);
return
img
?.
designId
;
},
getComputedTitle
(
title
)
{
console
.
log
(
this
.
selectImgList
,
"this.selectImgList"
);
let
img
=
this
.
selectImgList
.
find
((
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
));
let
img
=
this
.
selectImgList
.
find
(
(
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
);
return
img
?.
productionFile
;
},
getBackFile
({
files
,
size
},
callback
)
{
let
that
=
this
;
let
bw
=
document
.
getElementById
(
'line'
)
bw
=
bw
.
clientWidth
let
bw
=
document
.
getElementById
(
"line"
);
bw
=
bw
.
clientWidth
;
// bw = Number(bw.replace("px", ""));
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
files
[
i
].
url
=
files
[
i
].
productionFile
||
files
[
i
].
url
;
that
.
$nextTick
(
async
()
=>
{
let
w
=
bw
/
2
;
let
width_px
,
height_px
,
rate
,
x
,
y
;
let
width_px
,
height_px
,
rate
,
x
,
y
;
if
(
size
)
{
width_px
=
that
.
WHproportion
*
mmToPx
(
size
.
width
);
height_px
=
that
.
WHproportion
*
mmToPx
(
size
.
height
);
x
=
w
*
that
.
WHproportion
y
=
(
height_px
/
2
)
*
that
.
WHproportion
x
=
w
*
that
.
WHproportion
;
y
=
(
height_px
/
2
)
*
that
.
WHproportion
;
rate
=
height_px
/
width_px
;
}
else
{
let
data
=
await
that
.
getImageSize
(
files
[
i
].
url
);
rate
=
data
.
height
/
data
.
width
;
width_px
=
bw
*
(
2
/
3
);
x
=
w
y
=
(
height_px
/
2
)
x
=
w
;
y
=
height_px
/
2
;
height_px
=
width_px
*
rate
;
}
...
...
@@ -569,11 +573,11 @@ export default {
url
:
files
[
i
].
url
,
fileName
:
files
[
i
].
fileName
,
rate
,
w
:
width_px
,
w
:
width_px
,
zIndex
:
that
.
imgList
.
length
,
x
,
y
,
h
:
height_px
,
h
:
height_px
,
r
:
0
,
});
that
.
selectIndex
=
that
.
imgList
.
length
-
1
;
...
...
@@ -809,7 +813,7 @@ export default {
this
.
hasSize
=
false
;
}
this
.
detail
.
designImageSize
=
size
;
console
.
log
(
this
.
detail
,
'this.detail'
);
console
.
log
(
this
.
detail
,
"this.detail"
);
this
.
imgList
=
[];
this
.
selectIndex
=
-
1
;
if
(
value
.
length
>
0
)
{
...
...
@@ -1154,7 +1158,7 @@ export default {
<div
v-if=
"isView"
id=
"img"
>
<div
id=
"line"
style=
"left: 22%;top: 5
7
%;background-color: transparent;overflow: hidden;cursor: none;"
style=
"left: 22%;top: 5
2
%;background-color: transparent;overflow: hidden;cursor: none;"
>
<div
class=
"sucaitu vieWsucaitu"
...
...
@@ -1290,7 +1294,12 @@ export default {
</div>
<div
class=
"print-tip"
v-if=
"detail && detail.mssWidth && detail.mssHeight && selectImgList.length"
v-if=
"
detail &&
detail.mssWidth &&
detail.mssHeight &&
selectImgList.length
"
>
<b
style=
"color: green"
v-if=
"hasSize"
>
该生产单无需拖动设计,直接打印
</b
...
...
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