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
97e0fb09
Commit
97e0fb09
authored
May 07, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改裁剪功能bug以及登录后网格消失问题
parent
08521d9f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
70 deletions
+123
-70
config/env.json
+3
-3
src/store/index.js
+14
-0
src/views/design/main/index.vue
+69
-57
src/views/login/index.vue
+37
-10
No files found.
config/env.json
View file @
97e0fb09
{
{
"apiApiHost"
:
"http
s://factory.jomalls.com
/api"
,
"apiApiHost"
:
"http
://10.168.31.142:8060
/api"
,
"fileApiUrl"
:
"https://factory.jomalls.com
/upload/factory"
,
"fileApiUrl"
:
"http://10.168.31.142:80
/upload/factory"
,
"visionUrl"
:
"https://console.jomalls.com"
"visionUrl"
:
"https://console.jomalls.com"
}
}
src/store/index.js
View file @
97e0fb09
...
@@ -26,6 +26,16 @@ export default new Vuex.Store({
...
@@ -26,6 +26,16 @@ export default new Vuex.Store({
autoPrint
:
false
,
autoPrint
:
false
,
gridSpacing
:
10
,
gridSpacing
:
10
,
},
},
grid
:
[
{
label
:
"16×18"
,
value
:
1
,
row
:
16
,
col
:
18
,
h
:
0
,
w
:
0
,
},
],
},
},
mutations
:
{
mutations
:
{
setDefaultSetting
(
state
)
{
setDefaultSetting
(
state
)
{
...
@@ -55,6 +65,10 @@ export default new Vuex.Store({
...
@@ -55,6 +65,10 @@ export default new Vuex.Store({
setIsPreView
(
state
,
value
)
{
setIsPreView
(
state
,
value
)
{
state
.
isPreView
=
value
;
state
.
isPreView
=
value
;
},
},
setGrid
(
state
,
{
h
,
w
})
{
state
.
grid
[
0
].
h
=
h
;
state
.
grid
[
0
].
w
=
w
;
},
},
},
getters
:
{
getters
:
{
systemSetting
(
state
)
{
systemSetting
(
state
)
{
...
...
src/views/design/main/index.vue
View file @
97e0fb09
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
VueDragResizeRotate
from
"@minogin/vue-drag-resize-rotate"
;
import
VueDragResizeRotate
from
"@minogin/vue-drag-resize-rotate"
;
import
PicScrollbarBox
from
"../../../components/PicScrollbarBox.vue"
;
import
PicScrollbarBox
from
"../../../components/PicScrollbarBox.vue"
;
const
{
ipcRenderer
}
=
require
(
"electron"
);
const
{
ipcRenderer
}
=
require
(
"electron"
);
import
{
grid
}
from
"../data"
;
//
import { grid } from "../data";
import
ImgSetting
from
"./imgSetting.vue"
;
import
ImgSetting
from
"./imgSetting.vue"
;
import
bus
from
"@/bus"
;
import
bus
from
"@/bus"
;
import
PrintDialog
from
"@/views/design/head/printDialog.vue"
;
import
PrintDialog
from
"@/views/design/head/printDialog.vue"
;
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
PrintDialog
,
PrintDialog
,
VueDragResizeRotate
,
VueDragResizeRotate
,
ImgSetting
,
ImgSetting
,
PicScrollbarBox
PicScrollbarBox
,
},
},
destroyed
()
{
destroyed
()
{
document
.
removeEventListener
(
"keyup"
,
this
.
keyup
);
document
.
removeEventListener
(
"keyup"
,
this
.
keyup
);
...
@@ -37,13 +37,14 @@ export default {
...
@@ -37,13 +37,14 @@ export default {
proportion
=
1.7
;
proportion
=
1.7
;
}
else
if
(
height
>
900
&&
height
<=
1000
)
{
}
else
if
(
height
>
900
&&
height
<=
1000
)
{
proportion
=
1.5
;
proportion
=
1.5
;
this
.
PreViewGrid
.
h
;
}
else
{
}
else
{
proportion
=
1
;
proportion
=
1
;
}
}
this
.
$store
.
commit
(
"setWHproportion"
,
proportion
);
this
.
$store
.
commit
(
"setWHproportion"
,
proportion
);
this
.
grid
[
0
].
h
=
540
*
proportion
;
this
.
$store
.
commit
(
"setGrid"
,
{
this
.
grid
[
0
].
w
=
480
*
proportion
;
h
:
540
*
proportion
,
w
:
480
*
proportion
,
});
});
});
},
},
computed
:
{
computed
:
{
...
@@ -57,7 +58,7 @@ export default {
...
@@ -57,7 +58,7 @@ export default {
return
{
return
{
w
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
w
,
w
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
w
,
v
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
value
,
v
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
value
,
h
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
h
h
:
this
.
grid
[
this
.
systemSetting
.
gridValue
].
h
,
};
};
},
},
gridSpacing
()
{
gridSpacing
()
{
...
@@ -67,7 +68,7 @@ export default {
...
@@ -67,7 +68,7 @@ export default {
if
(
unit
===
"mm"
)
{
if
(
unit
===
"mm"
)
{
return
{
return
{
w
:
gridSpacing
+
"px"
,
w
:
gridSpacing
+
"px"
,
h
:
gridSpacing
+
"px"
h
:
gridSpacing
+
"px"
,
};
};
}
else
if
(
unit
===
"inch"
)
{
}
else
if
(
unit
===
"inch"
)
{
let
w
=
this
.
grid
[
this
.
systemSetting
.
gridValue
].
w
;
let
w
=
this
.
grid
[
this
.
systemSetting
.
gridValue
].
w
;
...
@@ -77,7 +78,7 @@ export default {
...
@@ -77,7 +78,7 @@ export default {
return
{
return
{
// w: gridSpacing * ((w - row + 1) / row) + "px",
// w: gridSpacing * ((w - row + 1) / row) + "px",
w
:
gridSpacing
*
(
w
/
row
)
+
"px"
,
w
:
gridSpacing
*
(
w
/
row
)
+
"px"
,
h
:
gridSpacing
*
(
h
/
col
)
+
"px"
h
:
gridSpacing
*
(
h
/
col
)
+
"px"
,
};
};
}
}
return
{
w
:
"480px"
,
h
:
"540px"
};
return
{
w
:
"480px"
,
h
:
"540px"
};
...
@@ -89,7 +90,7 @@ export default {
...
@@ -89,7 +90,7 @@ export default {
if
(
unit
===
"mm"
)
{
if
(
unit
===
"mm"
)
{
return
{
return
{
w
:
gridSpacing
+
"px"
,
w
:
gridSpacing
+
"px"
,
h
:
gridSpacing
+
"px"
h
:
gridSpacing
+
"px"
,
};
};
}
else
if
(
unit
===
"inch"
)
{
}
else
if
(
unit
===
"inch"
)
{
let
w
=
480
;
let
w
=
480
;
...
@@ -98,7 +99,7 @@ export default {
...
@@ -98,7 +99,7 @@ export default {
let
h
=
540
;
let
h
=
540
;
return
{
return
{
w
:
gridSpacing
*
(
w
/
row
)
+
"px"
,
w
:
gridSpacing
*
(
w
/
row
)
+
"px"
,
h
:
gridSpacing
*
(
h
/
col
)
+
"px"
h
:
gridSpacing
*
(
h
/
col
)
+
"px"
,
};
};
}
}
return
{
w
:
"480px"
,
h
:
"540px"
};
return
{
w
:
"480px"
,
h
:
"540px"
};
...
@@ -125,7 +126,7 @@ export default {
...
@@ -125,7 +126,7 @@ export default {
return
null
;
return
null
;
},
},
...
mapState
([
"desktopDevice"
,
"productDetail"
,
"WHproportion"
])
...
mapState
([
"desktopDevice"
,
"productDetail"
,
"WHproportion"
,
"grid"
]),
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -143,7 +144,7 @@ export default {
...
@@ -143,7 +144,7 @@ export default {
"hsva(120, 40, 94, 0.5)"
,
"hsva(120, 40, 94, 0.5)"
,
"hsl(181, 100%, 37%)"
,
"hsl(181, 100%, 37%)"
,
"hsla(209, 100%, 56%, 0.73)"
,
"hsla(209, 100%, 56%, 0.73)"
,
"#c7158577"
"#c7158577"
,
],
],
actionList
:
[],
actionList
:
[],
checkList
:
[],
checkList
:
[],
...
@@ -157,14 +158,14 @@ export default {
...
@@ -157,14 +158,14 @@ export default {
imgHeight
:
0
,
imgHeight
:
0
,
selectImgList
:
[],
selectImgList
:
[],
bus
:
0
,
bus
:
0
,
grid
,
PreViewGrid
:
{
PreViewGrid
:
{
label
:
"16×18"
,
label
:
"16×18"
,
value
:
1
,
value
:
1
,
row
:
16
,
row
:
16
,
col
:
18
,
col
:
18
,
h
:
540
,
h
:
540
,
w
:
480
w
:
480
,
},
},
showImgSetting
:
true
,
showImgSetting
:
true
,
printDialogShow
:
true
,
printDialogShow
:
true
,
...
@@ -182,7 +183,7 @@ export default {
...
@@ -182,7 +183,7 @@ export default {
imgHistoryIndex
:
0
,
imgHistoryIndex
:
0
,
row
:
8
,
row
:
8
,
img
,
img
,
col
:
7
col
:
7
,
};
};
},
},
watch
:
{
watch
:
{
...
@@ -201,7 +202,7 @@ export default {
...
@@ -201,7 +202,7 @@ export default {
dom_i
.
style
.
zIndex
===
""
||
!
dom_i
.
style
.
zIndex
dom_i
.
style
.
zIndex
===
""
||
!
dom_i
.
style
.
zIndex
?
0
?
0
:
dom_i
.
style
.
zIndex
;
:
dom_i
.
style
.
zIndex
;
dom
[
i
].
addEventListener
(
"click"
,
e
=>
{
dom
[
i
].
addEventListener
(
"click"
,
(
e
)
=>
{
this
.
selectIndex
=
i
;
this
.
selectIndex
=
i
;
this
.
selectItem
(
i
);
this
.
selectItem
(
i
);
});
});
...
@@ -211,7 +212,7 @@ export default {
...
@@ -211,7 +212,7 @@ export default {
this
.
$store
.
commit
(
"changeImgList"
,
this
.
imgList
);
this
.
$store
.
commit
(
"changeImgList"
,
this
.
imgList
);
},
},
deep
:
true
,
deep
:
true
,
immediate
:
true
immediate
:
true
,
},
},
selectIndex
()
{
selectIndex
()
{
if
(
this
.
selectIndex
>=
0
)
{
if
(
this
.
selectIndex
>=
0
)
{
...
@@ -238,7 +239,7 @@ export default {
...
@@ -238,7 +239,7 @@ export default {
},
},
changeCheckFn
(
value
)
{
changeCheckFn
(
value
)
{
console
.
log
(
"check"
,
value
);
console
.
log
(
"check"
,
value
);
}
}
,
},
},
methods
:
{
methods
:
{
changePrintDialogShow
()
{
changePrintDialogShow
()
{
...
@@ -260,11 +261,11 @@ export default {
...
@@ -260,11 +261,11 @@ export default {
formData
.
append
(
"file"
,
files
[
i
]);
formData
.
append
(
"file"
,
files
[
i
]);
let
{
data
}
=
await
that
.
$api
.
post
(
"/uploadImage"
,
formData
,
{
let
{
data
}
=
await
that
.
$api
.
post
(
"/uploadImage"
,
formData
,
{
headers
:
{
headers
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
"Content-Type"
:
"application/x-www-form-urlencoded"
,
}
}
,
});
});
that
.
selectImgIndex
=
0
;
that
.
selectImgIndex
=
0
;
that
.
addFile
(
data
,
file
=>
{
that
.
addFile
(
data
,
(
file
)
=>
{
that
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
that
.
imgList
)));
that
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
that
.
imgList
)));
});
});
}
}
...
@@ -364,12 +365,12 @@ export default {
...
@@ -364,12 +365,12 @@ export default {
return
mm1
.
width
;
return
mm1
.
width
;
},
},
setDesignImg
(
title
)
{
setDesignImg
(
title
)
{
let
img
=
this
.
selectImgList
.
find
(
it
=>
it
.
title
===
title
);
let
img
=
this
.
selectImgList
.
find
(
(
it
)
=>
it
.
title
===
title
);
if
(
img
)
{
if
(
img
)
{
console
.
log
(
this
.
detail
.
designImageSize
,
"this.detail.size"
);
console
.
log
(
this
.
detail
.
designImageSize
,
"this.detail.size"
);
this
.
getBackFile
(
this
.
getBackFile
(
{
files
:
[
img
],
size
:
this
.
detail
.
designImageSize
},
{
files
:
[
img
],
size
:
this
.
detail
.
designImageSize
},
file
=>
{
(
file
)
=>
{
this
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
)));
this
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
)));
}
}
);
);
...
@@ -381,7 +382,7 @@ export default {
...
@@ -381,7 +382,7 @@ export default {
}
}
// this.selectImgIndexList.push(i)
// this.selectImgIndexList.push(i)
let
item
=
this
.
imgList
.
find
(
img
=>
img
.
fileName
===
it
.
fileName
);
let
item
=
this
.
imgList
.
find
(
(
img
)
=>
img
.
fileName
===
it
.
fileName
);
if
(
item
)
return
;
if
(
item
)
return
;
console
.
log
(
this
.
detail
.
designImageSize
);
console
.
log
(
this
.
detail
.
designImageSize
);
let
size
=
null
;
let
size
=
null
;
...
@@ -392,10 +393,10 @@ export default {
...
@@ -392,10 +393,10 @@ export default {
)
{
)
{
size
=
{
size
=
{
width
:
this
.
detail
.
mssWidth
,
width
:
this
.
detail
.
mssWidth
,
height
:
this
.
detail
.
mssHeight
height
:
this
.
detail
.
mssHeight
,
};
};
}
}
this
.
getBackFile
({
files
:
[
it
],
size
},
file
=>
{
this
.
getBackFile
({
files
:
[
it
],
size
},
(
file
)
=>
{
this
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
)));
this
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
)));
});
});
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
...
@@ -554,20 +555,21 @@ export default {
...
@@ -554,20 +555,21 @@ export default {
},
},
getComputedName
(
title
)
{
getComputedName
(
title
)
{
let
img
=
this
.
selectImgList
.
find
(
let
img
=
this
.
selectImgList
.
find
(
it
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
(
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
);
);
return
img
?.
designId
;
return
img
?.
designId
;
},
},
getComputedTitle
(
title
)
{
getComputedTitle
(
title
)
{
console
.
log
(
this
.
selectImgList
,
"this.selectImgList"
);
console
.
log
(
this
.
selectImgList
,
"this.selectImgList"
);
let
img
=
this
.
selectImgList
.
find
(
let
img
=
this
.
selectImgList
.
find
(
it
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
(
it
)
=>
it
.
title
===
title
||
it
.
title
.
includes
(
title
)
);
);
return
img
?.
productionFile
;
return
img
?.
productionFile
;
},
},
getBackFile
({
files
,
size
},
callback
)
{
getBackFile
({
files
,
size
},
callback
)
{
let
that
=
this
;
let
that
=
this
;
let
bw
=
document
.
getElementById
(
"line"
);
let
bw
=
document
.
getElementById
(
"line"
);
let
bh
=
bw
.
clientHeight
;
bw
=
bw
.
clientWidth
;
bw
=
bw
.
clientWidth
;
this
.
isView
=
false
;
this
.
isView
=
false
;
// bw = Number(bw.replsace("px", ""));
// bw = Number(bw.replsace("px", ""));
...
@@ -575,6 +577,8 @@ export default {
...
@@ -575,6 +577,8 @@ export default {
files
[
i
].
url
=
files
[
i
].
productionFile
||
files
[
i
].
url
;
files
[
i
].
url
=
files
[
i
].
productionFile
||
files
[
i
].
url
;
that
.
$nextTick
(
async
()
=>
{
that
.
$nextTick
(
async
()
=>
{
let
w
=
bw
/
2
;
let
w
=
bw
/
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
);
...
@@ -584,13 +588,20 @@ export default {
...
@@ -584,13 +588,20 @@ export default {
rate
=
height_px
/
width_px
;
rate
=
height_px
/
width_px
;
}
else
{
}
else
{
let
data
=
await
that
.
getImageSize
(
files
[
i
].
url
);
let
data
=
await
that
.
getImageSize
(
files
[
i
].
url
);
rate
=
data
.
height
/
data
.
width
;
rate
=
data
.
height
/
data
.
width
;
width_px
=
bw
*
(
2
/
3
);
if
(
rate
>
1
)
{
x
=
w
;
height_px
=
bh
*
(
9
/
10
);
height_px
=
width_px
*
rate
;
width_px
=
height_px
/
rate
;
y
=
height_px
/
2
;
x
=
width_px
/
2
;
y
=
h
;
}
else
{
width_px
=
bw
*
(
2
/
3
);
height_px
=
width_px
*
rate
;
x
=
w
;
y
=
height_px
/
2
;
}
}
}
that
.
imgList
=
[];
that
.
imgList
=
[];
that
.
imgList
.
push
({
that
.
imgList
.
push
({
url
:
files
[
i
].
url
,
url
:
files
[
i
].
url
,
...
@@ -601,7 +612,7 @@ export default {
...
@@ -601,7 +612,7 @@ export default {
x
,
x
,
y
,
y
,
h
:
height_px
,
h
:
height_px
,
r
:
0
r
:
0
,
});
});
that
.
selectIndex
=
that
.
imgList
.
length
-
1
;
that
.
selectIndex
=
that
.
imgList
.
length
-
1
;
that
.
showImgSetting
=
true
;
that
.
showImgSetting
=
true
;
...
@@ -622,7 +633,7 @@ export default {
...
@@ -622,7 +633,7 @@ export default {
let
bw
=
document
.
getElementById
(
"line"
).
clientWidth
;
let
bw
=
document
.
getElementById
(
"line"
).
clientWidth
;
let
bh
=
document
.
getElementById
(
"line"
).
clientHeight
;
let
bh
=
document
.
getElementById
(
"line"
).
clientHeight
;
that
.
$nextTick
(()
=>
{
that
.
$nextTick
(()
=>
{
that
.
getImageSize
(
file
.
url
).
then
(
data
=>
{
that
.
getImageSize
(
file
.
url
).
then
(
(
data
)
=>
{
let
w
=
document
.
getElementById
(
"line"
).
clientWidth
/
2
;
let
w
=
document
.
getElementById
(
"line"
).
clientWidth
/
2
;
let
rate
=
data
.
height
/
data
.
width
;
let
rate
=
data
.
height
/
data
.
width
;
that
.
imgList
=
[];
that
.
imgList
=
[];
...
@@ -635,7 +646,7 @@ export default {
...
@@ -635,7 +646,7 @@ export default {
x
:
w
,
x
:
w
,
y
:
(
bw
*
(
2
/
3
)
*
rate
)
/
2
,
y
:
(
bw
*
(
2
/
3
)
*
rate
)
/
2
,
h
:
bw
*
(
2
/
3
)
*
rate
,
h
:
bw
*
(
2
/
3
)
*
rate
,
r
:
0
r
:
0
,
});
});
console
.
log
(
570
,
that
.
imgList
);
console
.
log
(
570
,
that
.
imgList
);
that
.
selectIndex
=
that
.
imgList
.
length
-
1
;
that
.
selectIndex
=
that
.
imgList
.
length
-
1
;
...
@@ -661,7 +672,7 @@ export default {
...
@@ -661,7 +672,7 @@ export default {
image
.
onload
=
function
()
{
image
.
onload
=
function
()
{
resolve
({
resolve
({
width
:
image
.
width
,
width
:
image
.
width
,
height
:
image
.
height
height
:
image
.
height
,
});
});
};
};
image
.
onerror
=
function
()
{
image
.
onerror
=
function
()
{
...
@@ -731,21 +742,21 @@ export default {
...
@@ -731,21 +742,21 @@ export default {
this
.
checkList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectImgList
));
this
.
checkList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectImgList
));
try
{
try
{
const
processQueue
=
await
Promise
.
all
(
const
processQueue
=
await
Promise
.
all
(
this
.
checkList
.
map
(
async
el
=>
{
this
.
checkList
.
map
(
async
(
el
)
=>
{
try
{
try
{
const
outputDir
=
path
.
dirname
(
el
.
productionFile
);
const
outputDir
=
path
.
dirname
(
el
.
productionFile
);
const
outputFileName
=
`
${
uuid
.
v4
()}
.png`
;
const
outputFileName
=
`
${
uuid
.
v4
()}
.png`
;
const
outputPath
=
path
.
join
(
outputDir
,
outputFileName
);
const
outputPath
=
path
.
join
(
outputDir
,
outputFileName
);
const
params
=
{
const
params
=
{
inputPath
:
el
.
productionFile
,
inputPath
:
el
.
productionFile
,
outputPath
:
outputPath
outputPath
:
outputPath
,
};
};
const
res
=
await
this
.
$api
.
post
(
"/processImage"
,
params
);
const
res
=
await
this
.
$api
.
post
(
"/processImage"
,
params
);
fs
.
unlinkSync
(
el
.
productionFile
);
fs
.
unlinkSync
(
el
.
productionFile
);
return
{
return
{
fileName
:
outputFileName
,
fileName
:
outputFileName
,
productionFile
:
res
.
msg
[
0
]?.
outputPath
,
productionFile
:
res
.
msg
[
0
]?.
outputPath
,
designId
:
el
.
designId
designId
:
el
.
designId
,
};
};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`处理失败:
${
el
.
productionFile
}
`
,
error
);
console
.
error
(
`处理失败:
${
el
.
productionFile
}
`
,
error
);
...
@@ -754,9 +765,9 @@ export default {
...
@@ -754,9 +765,9 @@ export default {
);
);
// 等待所有异步操作完成
// 等待所有异步操作完成
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
100
));
await
new
Promise
(
(
resolve
)
=>
setTimeout
(
resolve
,
100
));
const
newMap
=
new
Map
(
processQueue
.
map
(
el
=>
[
el
.
designId
,
el
]));
const
newMap
=
new
Map
(
processQueue
.
map
(
(
el
)
=>
[
el
.
designId
,
el
]));
this
.
selectImgList
.
forEach
(
el
=>
{
this
.
selectImgList
.
forEach
(
(
el
)
=>
{
if
(
newMap
.
has
(
el
.
designId
))
{
if
(
newMap
.
has
(
el
.
designId
))
{
el
.
fileName
=
newMap
.
get
(
el
.
designId
).
fileName
;
el
.
fileName
=
newMap
.
get
(
el
.
designId
).
fileName
;
el
.
url
=
newMap
.
get
(
el
.
designId
).
productionFile
;
el
.
url
=
newMap
.
get
(
el
.
designId
).
productionFile
;
...
@@ -768,7 +779,7 @@ export default {
...
@@ -768,7 +779,7 @@ export default {
if
(
this
.
imgList
.
length
)
{
if
(
this
.
imgList
.
length
)
{
const
fileNameExists
=
this
.
checkList
.
some
(
const
fileNameExists
=
this
.
checkList
.
some
(
el
=>
el
.
fileName
===
this
.
imgList
[
0
].
fileName
(
el
)
=>
el
.
fileName
===
this
.
imgList
[
0
].
fileName
);
);
if
(
fileNameExists
)
{
if
(
fileNameExists
)
{
this
.
imgList
=
[];
this
.
imgList
=
[];
...
@@ -801,13 +812,13 @@ export default {
...
@@ -801,13 +812,13 @@ export default {
this
.
isView
=
false
;
this
.
isView
=
false
;
}
}
this
.
$store
.
commit
(
"setIsPreView"
,
this
.
isView
);
this
.
$store
.
commit
(
"setIsPreView"
,
this
.
isView
);
}
}
,
},
},
mounted
()
{
mounted
()
{
this
.
imgHeight
=
window
.
screen
.
height
+
"px"
;
this
.
imgHeight
=
window
.
screen
.
height
+
"px"
;
this
.
systemSetting
=
this
.
$dataStore
.
get
(
"setting"
);
this
.
systemSetting
=
this
.
$dataStore
.
get
(
"setting"
);
bus
.
$on
(
"busEmit"
,
v
=>
{
bus
.
$on
(
"busEmit"
,
(
v
)
=>
{
let
{
type
,
value
,
size
}
=
v
;
let
{
type
,
value
,
size
}
=
v
;
switch
(
type
)
{
switch
(
type
)
{
...
@@ -819,7 +830,7 @@ export default {
...
@@ -819,7 +830,7 @@ export default {
this
.
indexChange
(
value
);
this
.
indexChange
(
value
);
break
;
break
;
case
"bg"
:
case
"bg"
:
this
.
changeImageColor
(
value
,
res
=>
{
this
.
changeImageColor
(
value
,
(
res
)
=>
{
this
.
img
=
res
;
this
.
img
=
res
;
});
});
break
;
break
;
...
@@ -849,7 +860,7 @@ export default {
...
@@ -849,7 +860,7 @@ export default {
this
.
selectImgIndex
=
0
;
this
.
selectImgIndex
=
0
;
this
.
getBackFile
(
this
.
getBackFile
(
{
files
:
[
value
[
0
]],
size
:
this
.
detail
.
designImageSize
||
null
},
{
files
:
[
value
[
0
]],
size
:
this
.
detail
.
designImageSize
||
null
},
file
=>
{
(
file
)
=>
{
this
.
imgHistoryList
.
push
(
this
.
imgHistoryList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
))
JSON
.
parse
(
JSON
.
stringify
(
this
.
imgList
))
);
);
...
@@ -872,7 +883,7 @@ export default {
...
@@ -872,7 +883,7 @@ export default {
beforeDestroy
()
{
beforeDestroy
()
{
// 销毁组件时移除事件监听器
// 销毁组件时移除事件监听器
document
.
removeEventListener
(
"click"
,
this
.
handleClick
);
document
.
removeEventListener
(
"click"
,
this
.
handleClick
);
}
}
,
};
};
</
script
>
</
script
>
...
@@ -1026,6 +1037,7 @@ export default {
...
@@ -1026,6 +1037,7 @@ export default {
<
template
#
mainContent
>
<
template
#
mainContent
>
<div
<div
v-for=
"(img, i) in selectImgList"
v-for=
"(img, i) in selectImgList"
:key=
"i"
class=
"img-item"
class=
"img-item"
@
click
.
stop
.
prevent=
"selectImg(img)"
@
click
.
stop
.
prevent=
"selectImg(img)"
>
>
...
@@ -1084,7 +1096,7 @@ export default {
...
@@ -1084,7 +1096,7 @@ export default {
style=
"margin-left: 5px"
style=
"margin-left: 5px"
v-if=
"detail.podProductionNo"
v-if=
"detail.podProductionNo"
:style=
"{
:style=
"{
color: detail.customizedQuantity > 1 ? 'red' : '#67C23A'
color: detail.customizedQuantity > 1 ? 'red' : '#67C23A'
,
}"
}"
>
>
{{ detail.customizedQuantity > 1 ? "多" : "单" }}
{{ detail.customizedQuantity > 1 ? "多" : "单" }}
...
@@ -1219,7 +1231,7 @@ export default {
...
@@ -1219,7 +1231,7 @@ export default {
:class=
"{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:class=
"{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:style=
"{
:style=
"{
width: 480 + 'px',
width: 480 + 'px',
height: 540 + 'px'
height: 540 + 'px'
,
}"
}"
class=
"grid"
class=
"grid"
style=
"border-style:dashed"
style=
"border-style:dashed"
...
@@ -1261,9 +1273,9 @@ export default {
...
@@ -1261,9 +1273,9 @@ export default {
:draggable=
"true"
:draggable=
"true"
:resizable=
"true"
:resizable=
"true"
:rotatable=
"true"
:rotatable=
"true"
@
dragstop=
"
a
=> dragStop(a, item)"
@
dragstop=
"
(a)
=> dragStop(a, item)"
@
resizestop=
"
a
=> resizeStop(a, item)"
@
resizestop=
"
(a)
=> resizeStop(a, item)"
@
rotatestop=
"
a
=> rotating(a, item)"
@
rotatestop=
"
(a)
=> rotating(a, item)"
:angle=
"item.r"
:angle=
"item.r"
>
>
<div
<div
...
@@ -1296,7 +1308,7 @@ export default {
...
@@ -1296,7 +1308,7 @@ export default {
:class=
"{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:class=
"{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:style=
"{
:style=
"{
width: gridWH.w + 'px',
width: gridWH.w + 'px',
height: gridWH.h + 'px'
height: gridWH.h + 'px'
,
}"
}"
class=
"grid"
class=
"grid"
>
>
...
@@ -1318,7 +1330,7 @@ export default {
...
@@ -1318,7 +1330,7 @@ export default {
</div>
</div>
<div
<div
class=
"print-tip"
class=
"print-tip"
:style=
"{
left:isView?'':'22%'
}"
:style=
"{
left: isView ? '' : '22%'
}"
v-if=
"
v-if=
"
detail &&
detail &&
detail.mssWidth &&
detail.mssWidth &&
...
@@ -1326,7 +1338,7 @@ export default {
...
@@ -1326,7 +1338,7 @@ export default {
selectImgList.length
selectImgList.length
"
"
>
>
<b
style=
"color: green"
v-if=
"hasSize"
<b
style=
"color: green"
v-if=
"hasSize"
>
该生产单无需拖动设计,直接打印
</b
>
该生产单无需拖动设计,直接打印
</b
>
>
<b
style=
"color: red"
v-else
>
该生产单需要拖动设计打印
</b>
<b
style=
"color: red"
v-else
>
该生产单需要拖动设计打印
</b>
...
...
src/views/login/index.vue
View file @
97e0fb09
<
script
>
<
script
>
const
{
ipcRenderer
}
=
require
(
"electron"
);
import
{
mapState
}
from
"vuex"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
rules
:
{
rules
:
{
factoryCode
:
[
factoryCode
:
[
{
message
:
"请输入工厂编码"
,
required
:
true
,
trigger
:
"blur"
}
{
message
:
"请输入工厂编码"
,
required
:
true
,
trigger
:
"blur"
}
,
],
],
account
:
[{
message
:
"请输入账号"
,
required
:
true
,
trigger
:
"blur"
}],
account
:
[{
message
:
"请输入账号"
,
required
:
true
,
trigger
:
"blur"
}],
password
:
[{
message
:
"请输入密码"
,
required
:
true
,
trigger
:
"blur"
}]
password
:
[{
message
:
"请输入密码"
,
required
:
true
,
trigger
:
"blur"
}]
,
},
},
userList
:
[],
userList
:
[],
authorityVisible
:
false
,
authorityVisible
:
false
,
...
@@ -17,12 +20,33 @@ export default {
...
@@ -17,12 +20,33 @@ export default {
form
:
{
form
:
{
factoryCode
:
""
,
factoryCode
:
""
,
account
:
""
,
account
:
""
,
password
:
""
password
:
""
,
}
}
,
};
};
},
},
computed
:
{
...
mapState
([
"grid"
]),
},
created
()
{
created
()
{
this
.
userList
=
this
.
$dataStore
.
get
(
'userList'
)
||
[]
this
.
userList
=
this
.
$dataStore
.
get
(
"userList"
)
||
[];
ipcRenderer
.
on
(
"window-size"
,
(
event
,
size
)
=>
{
const
{
width
,
height
}
=
size
;
console
.
log
(
`接收到窗口尺寸:
${
width
}
x
${
height
}
`
);
let
proportion
;
if
(
height
>
1000
)
{
proportion
=
1.7
;
}
else
if
(
height
>
900
&&
height
<=
1000
)
{
proportion
=
1.5
;
}
else
{
proportion
=
1
;
}
this
.
$store
.
commit
(
"setWHproportion"
,
proportion
);
this
.
$store
.
commit
(
"setGrid"
,
{
h
:
540
*
proportion
,
w
:
480
*
proportion
,
});
console
.
log
(
this
.
grid
);
});
},
},
mounted
()
{
mounted
()
{
document
.
addEventListener
(
"keyup"
,
this
.
keyUp
);
document
.
addEventListener
(
"keyup"
,
this
.
keyUp
);
...
@@ -38,11 +62,14 @@ export default {
...
@@ -38,11 +62,14 @@ export default {
},
},
async
login
()
{
async
login
()
{
this
.
$refs
.
formRef
.
validate
(
async
valid
=>
{
this
.
$refs
.
formRef
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
let
f
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
));
let
f
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
));
let
{
data
}
=
await
this
.
$api
.
post
(
"/login"
,
f
);
let
{
data
}
=
await
this
.
$api
.
post
(
"/login"
,
f
);
this
.
$dataStore
.
set
(
"user"
,
{
...
data
.
sysUser
,...{
token
:
data
.
token
}
});
this
.
$dataStore
.
set
(
"user"
,
{
...
data
.
sysUser
,
...{
token
:
data
.
token
},
});
console
.
log
(
this
.
$dataStore
);
console
.
log
(
this
.
$dataStore
);
if
(
this
.
remember
)
{
if
(
this
.
remember
)
{
let
userList
=
this
.
$dataStore
.
get
(
"userList"
);
let
userList
=
this
.
$dataStore
.
get
(
"userList"
);
...
@@ -50,7 +77,7 @@ export default {
...
@@ -50,7 +77,7 @@ export default {
if
(
userList
)
{
if
(
userList
)
{
if
(
if
(
!
userList
.
find
(
!
userList
.
find
(
el
=>
(
el
)
=>
el
.
account
===
f
.
account
&&
el
.
factoryCode
===
f
.
factoryCode
el
.
account
===
f
.
account
&&
el
.
factoryCode
===
f
.
factoryCode
)
)
)
{
)
{
...
@@ -70,8 +97,8 @@ export default {
...
@@ -70,8 +97,8 @@ export default {
this
.
form
.
account
=
this
.
userList
[
v
].
account
;
this
.
form
.
account
=
this
.
userList
[
v
].
account
;
this
.
form
.
factoryCode
=
this
.
userList
[
v
].
factoryCode
;
this
.
form
.
factoryCode
=
this
.
userList
[
v
].
factoryCode
;
this
.
form
.
password
=
this
.
userList
[
v
].
password
;
this
.
form
.
password
=
this
.
userList
[
v
].
password
;
}
}
,
}
}
,
};
};
</
script
>
</
script
>
...
...
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