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
5c58f588
Commit
5c58f588
authored
Jul 14, 2025
by
zhuzhequan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫码逻辑代码整理
parent
4e672b59
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
99 deletions
+59
-99
src/views/design/head/index.vue
+58
-92
src/views/design/main/index.vue
+1
-7
No files found.
src/views/design/head/index.vue
View file @
5c58f588
...
@@ -297,41 +297,20 @@ export default {
...
@@ -297,41 +297,20 @@ export default {
let
res
=
await
this
.
$api
.
post
(
"/downloadByDesignId"
,
params
);
let
res
=
await
this
.
$api
.
post
(
"/downloadByDesignId"
,
params
);
this
.
$message
.
success
(
res
.
msg
);
this
.
$message
.
success
(
res
.
msg
);
},
},
async
getDataInfo
()
{
async
hasDesignImagesCanvasJsonList
(
designImagesCanvasJsonList
){
if
(
let
imageResList
=
[]
this
.
detail
&&
if
(
this
.
detail
.
adjustable
&&
designImagesCanvasJsonList
)
{
Object
.
keys
(
this
.
detail
).
length
>
0
&&
this
.
isAutoFinish
)
{
await
this
.
setData
(
this
.
detail
);
}
if
(
this
.
productionNo
===
""
)
return
this
.
$message
.
warning
(
"请录入生产单号"
);
if
(
!
this
.
isAutoFinish
&&
!
this
.
isFirst
)
this
.
$confirm
(
"请注意自动完成上一单未勾选"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
type
:
"warning"
});
try
{
//查找生产单号信息传给第二个显示器
const
findByPodProductionNo
=
await
this
.
$api
.
post
(
"/findByPodProductionNo"
,
{
thirdSubOrderNumber
:
this
.
productionNo
,
type
:
this
.
factoryType
}
);
this
.
detail
=
findByPodProductionNo
.
data
;
// console.log("detail111111", findByPodProductionNo);
let
imageResList
=
[];
this
.
imgList
=
[];
let
designImagesCanvasJsonList
=
this
.
detail
.
drParam
if
(
designImagesCanvasJsonList
)
{
designImagesCanvasJsonList
=
JSON
.
parse
(
designImagesCanvasJsonList
);
designImagesCanvasJsonList
=
JSON
.
parse
(
designImagesCanvasJsonList
);
if
(
this
.
detail
.
adjustable
)
{
if
(
designImagesCanvasJsonList
[
0
].
images
){
designImagesCanvasJsonList
.
forEach
((
el
)
=>
{
el
.
images
.
forEach
((
item
)
=>
{
imageResList
.
push
({
productionFile
:
item
,
title
:
el
.
title
});
});
});
}
else
{
let
imageList
=
await
this
.
canvasToImage
(
designImagesCanvasJsonList
);
let
imageList
=
await
this
.
canvasToImage
(
designImagesCanvasJsonList
);
let
fm
=
new
FormData
();
let
fm
=
new
FormData
();
for
(
let
img
of
imageList
)
{
for
(
let
img
of
imageList
)
{
...
@@ -345,49 +324,9 @@ export default {
...
@@ -345,49 +324,9 @@ export default {
item
.
productionFile
=
item
.
url
;
item
.
productionFile
=
item
.
url
;
});
});
imageResList
=
Sres
.
data
;
imageResList
=
Sres
.
data
;
this
.
imgList
=
[];
if
(
this
.
checked
)
{
imageResList
=
await
this
.
cutImgFn
(
imageResList
);
imageResList
.
forEach
((
el
)
=>
{
el
.
isCut
=
true
;
});
}
}
}
else
{
this
.
imgList
=
[];
designImagesCanvasJsonList
.
forEach
((
el
)
=>
{
el
.
images
.
forEach
((
item
)
=>
{
this
.
imgList
.
push
({
productionFile
:
item
,
title
:
el
.
title
});
});
});
}
}
this
.
$store
.
commit
(
"setProductDetail"
,
findByPodProductionNo
.
data
);
ipcRenderer
.
send
(
"win-subScreen"
,
findByPodProductionNo
.
data
);
if
(
imageResList
&&
imageResList
.
length
)
{
let
obj
=
{
type
:
"sendFile"
,
value
:
imageResList
.
map
((
el
,
index
)
=>
{
el
.
designId
=
el
.
designId
||
index
;
return
el
;
})
};
if
(
this
.
detail
.
mssWidth
&&
this
.
detail
.
adjustable
&&
this
.
detail
.
mssHeight
)
{
obj
.
size
=
{
width
:
this
.
detail
.
mssWidth
,
height
:
this
.
detail
.
mssHeight
};
}
}
bus
.
$emit
(
"busEmit"
,
obj
);
if
(
!
imageResList
.
length
){
}
else
{
if
(
!
this
.
imgList
.
length
){
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let
res
=
await
this
.
$api
.
post
(
"/downloadBySubOrderNumber"
,
{
let
res
=
await
this
.
$api
.
post
(
"/downloadBySubOrderNumber"
,
{
ids
:
[
this
.
detail
.
id
],
ids
:
[
this
.
detail
.
id
],
...
@@ -396,28 +335,22 @@ export default {
...
@@ -396,28 +335,22 @@ export default {
});
});
if
(
res
.
data
.
length
===
0
)
if
(
res
.
data
.
length
===
0
)
return
this
.
$message
.
warning
(
"未找到素材图!"
);
return
this
.
$message
.
warning
(
"未找到素材图!"
);
this
.
imgList
=
[];
res
.
data
.
forEach
((
el
)
=>
{
res
.
data
.
forEach
((
el
)
=>
{
this
.
imgList
=
this
.
img
List
.
concat
(
el
.
list
||
[]);
imageResList
=
imageRes
List
.
concat
(
el
.
list
||
[]);
});
});
}
}
// res.data = arr.filter((el) => el.type !== 1);
let
newImgList
;
if
(
this
.
imgList
.
length
)
if
(
this
.
checked
)
{
if
(
this
.
checked
)
{
newImgList
=
await
this
.
cutImgFn
(
this
.
img
List
);
imageResList
=
await
this
.
cutImgFn
(
imageRes
List
);
newImg
List
.
forEach
((
el
)
=>
{
imageRes
List
.
forEach
((
el
)
=>
{
el
.
isCut
=
true
;
el
.
isCut
=
true
;
});
});
}
else
{
newImgList
=
this
.
imgList
;
}
}
// 延迟后强制激活窗口
// 延迟后强制激活窗口
if
(
this
.
desktopDevice
!==
1
)
{
if
(
this
.
desktopDevice
!==
1
)
{
if
(
this
.
img
List
.
length
)
{
if
(
imageRes
List
.
length
)
{
let
pathUrl
=
this
.
img
List
[
0
].
productionFile
;
let
pathUrl
=
imageRes
List
[
0
].
productionFile
;
setTimeout
(
async
()
=>
{
setTimeout
(
async
()
=>
{
// await this.focusExplorerWindow(pathUrl);
// await this.focusExplorerWindow(pathUrl);
const
pathParts
=
pathUrl
.
split
(
"
\
\"
);
const
pathParts
=
pathUrl
.
split
(
"
\
\"
);
...
@@ -428,11 +361,10 @@ export default {
...
@@ -428,11 +361,10 @@ export default {
// 删除最后一个部分,即文件名
// 删除最后一个部分,即文件名
}, 500);
}, 500);
}
}
} else {
}else{
console.log("
newImgList
", newImgList);
let obj = {
let obj = {
type: "
sendFile
",
type: "
sendFile
",
value: newImg
List.map((el, index) => {
value: imageRes
List.map((el, index) => {
el.designId = el.designId || index;
el.designId = el.designId || index;
return el;
return el;
})
})
...
@@ -449,7 +381,41 @@ export default {
...
@@ -449,7 +381,41 @@ export default {
}
}
bus.$emit("
busEmit
", obj);
bus.$emit("
busEmit
", obj);
}
}
},
async getDataInfo() {
if (
this.detail &&
Object.keys(this.detail).length > 0 &&
this.isAutoFinish
) {
await this.setData(this.detail);
}
}
if (this.productionNo === "")
return this.$message.warning("
请录入生产单号
");
if (!this.isAutoFinish && !this.isFirst)
this.$confirm("
请注意自动完成上一单未勾选
", "
提示
", {
confirmButtonText: "
确定
",
type: "
warning
"
});
try {
//查找生产单号信息传给第二个显示器
const findByPodProductionNo = await this.$api.post(
"
/
findByPodProductionNo
",
{
thirdSubOrderNumber: this.productionNo,
type: this.factoryType
}
);
this.detail = findByPodProductionNo.data;
this.imgList = [];
let designImagesCanvasJsonList = this.detail.drParam
await this.hasDesignImagesCanvasJsonList(designImagesCanvasJsonList);
this.$store.commit("
setProductDetail
", findByPodProductionNo.data);
ipcRenderer.send("
win
-
subScreen
", findByPodProductionNo.data);
this.$dataStore.set("
production_no
", this.productionNo);
this.$dataStore.set("
production_no
", this.productionNo);
this.productionNo = "";
this.productionNo = "";
this.$refs.searchRef.focus();
this.$refs.searchRef.focus();
...
@@ -556,7 +522,7 @@ export default {
...
@@ -556,7 +522,7 @@ export default {
console.log(347, store.state.desktopDevice);
console.log(347, store.state.desktopDevice);
},
},
async cutImgFn(arr) {
async cutImgFn(arr) {
if (!arr.length) return;
if (!arr.length) return
arr
;
console.log(arr);
console.log(arr);
try {
try {
...
...
src/views/design/main/index.vue
View file @
5c58f588
...
@@ -652,7 +652,6 @@ export default {
...
@@ -652,7 +652,6 @@ export default {
that
.
$nextTick
(
async
()
=>
{
that
.
$nextTick
(
async
()
=>
{
let
w
=
bw
/
2
;
let
w
=
bw
/
2
;
let
h
=
bh
/
2
;
let
h
=
bh
/
2
;
let
width_px
,
height_px
,
rate
,
x
,
y
;
let
width_px
,
height_px
,
rate
,
x
,
y
;
if
(
size
&&
!
files
[
i
].
isCut
)
{
if
(
size
&&
!
files
[
i
].
isCut
)
{
width_px
=
that
.
WHproportion
*
mmToPx
(
size
.
width
);
width_px
=
that
.
WHproportion
*
mmToPx
(
size
.
width
);
...
@@ -1053,12 +1052,7 @@ export default {
...
@@ -1053,12 +1052,7 @@ export default {
});
});
break
;
break
;
case
"sendFile"
:
case
"sendFile"
:
console
.
log
(
"sendFile"
);
this
.
hasSize
=
!!
size
;
if
(
size
)
{
this
.
hasSize
=
true
;
}
else
{
this
.
hasSize
=
false
;
}
this
.
detail
.
designImageSize
=
size
;
this
.
detail
.
designImageSize
=
size
;
console
.
log
(
this
.
detail
,
"this.detail"
);
console
.
log
(
this
.
detail
,
"this.detail"
);
this
.
imgList
=
[];
this
.
imgList
=
[];
...
...
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