Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-app-operator-master
Commits
10e0337b
Commit
10e0337b
authored
Feb 18, 2023
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
已审核提单增加刷新按钮
parent
a1427266
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
makeLadingBill.vue
src/views/ecw/box/ladingBill/makeLadingBill.vue
+6
-0
previewBill.vue
src/views/ecw/box/ladingBill/previewBill.vue
+33
-1
No files found.
src/views/ecw/box/ladingBill/makeLadingBill.vue
View file @
10e0337b
...
@@ -49,6 +49,8 @@ import { getToken } from "@/utils/auth";
...
@@ -49,6 +49,8 @@ import { getToken } from "@/utils/auth";
import
html2canvas
from
'
html2canvas
'
;
import
html2canvas
from
'
html2canvas
'
;
import
{
jsPDF
}
from
"
jspdf
"
;
import
{
jsPDF
}
from
"
jspdf
"
;
import
{
uploadFile
}
from
'
@/api/infra/file
'
import
{
uploadFile
}
from
'
@/api/infra/file
'
import
FileSaver
from
'
file-saver
'
window
.
html2canvas
=
html2canvas
export
default
{
export
default
{
name
:
"
makeLadingBill
"
,
name
:
"
makeLadingBill
"
,
components
:
{
components
:
{
...
@@ -194,6 +196,10 @@ export default {
...
@@ -194,6 +196,10 @@ export default {
let
file
=
this
.
selfNo
+
'
-
'
+
this
.
currRow
.
tidanNo
+
'
.pdf
'
let
file
=
this
.
selfNo
+
'
-
'
+
this
.
currRow
.
tidanNo
+
'
.pdf
'
form
.
append
(
'
file
'
,
new
File
([
doc
.
output
(
'
arraybuffer
'
)],
file
,
{
type
:
'
application/pdf
'
}))
form
.
append
(
'
file
'
,
new
File
([
doc
.
output
(
'
arraybuffer
'
)],
file
,
{
type
:
'
application/pdf
'
}))
form
.
append
(
'
path
'
,
file
)
form
.
append
(
'
path
'
,
file
)
/* let blob = new Blob([doc.output('arraybuffer')], {type: "application/pdf"})
FileSaver.saveAs(blob, file);
return */
return
uploadFile
(
form
)
return
uploadFile
(
form
)
}).
then
(
res
=>
{
}).
then
(
res
=>
{
return
this
.
submit
(
res
.
data
)
return
this
.
submit
(
res
.
data
)
...
...
src/views/ecw/box/ladingBill/previewBill.vue
View file @
10e0337b
<
template
>
<
template
>
<el-row>
<el-row>
<div
v-html=
"contentHtml"
class=
"contentHtml"
></div>
<div
v-html=
"contentHtml"
id=
"html2canvas-container"
class=
"contentHtml"
></div>
<el-row
v-if=
"currRow.status === 2 && type === 'previewBill'"
style=
"text-align: center;"
>
<el-row
v-if=
"currRow.status === 2 && type === 'previewBill'"
style=
"text-align: center;"
>
<el-button
type=
"primary"
@
click=
"download"
>
{{
$t
(
'
下载
'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"download"
>
{{
$t
(
'
下载
'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"print"
>
{{
$t
(
'
打印
'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"print"
>
{{
$t
(
'
打印
'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"createPdf"
>
{{
$t
(
'
刷新
'
)
}}
</el-button>
</el-row>
</el-row>
</el-row>
</el-row>
</
template
>
</
template
>
...
@@ -12,6 +13,9 @@
...
@@ -12,6 +13,9 @@
import
lodop
from
"
@/utils/lodop
"
;
import
lodop
from
"
@/utils/lodop
"
;
import
*
as
_BOX
from
"
@/api/ecw/box
"
;
import
*
as
_BOX
from
"
@/api/ecw/box
"
;
import
FileSaver
from
"
file-saver
"
;
import
FileSaver
from
"
file-saver
"
;
import
html2canvas
from
'
html2canvas
'
;
import
{
jsPDF
}
from
"
jspdf
"
;
import
{
uploadFile
}
from
'
@/api/infra/file
'
export
default
{
export
default
{
name
:
"
previewBill
"
,
name
:
"
previewBill
"
,
...
@@ -28,6 +32,34 @@ export default {
...
@@ -28,6 +32,34 @@ export default {
}
}
});
});
},
},
createPdf
(){
let
loading
=
this
.
$loading
()
const
doc
=
new
jsPDF
(
'
p
'
,
'
pt
'
,
'
a4
'
,
true
);
html2canvas
(
document
.
querySelector
(
"
#html2canvas-container
"
),
{
dpi
:
144
,
useCORS
:
true
}).
then
(
canvas
=>
{
const
imgWidth
=
canvas
.
width
const
imgHeight
=
canvas
.
height
let
_w
=
595.28
;
let
_h
=
595.28
/
imgWidth
*
imgHeight
;
if
(
_h
>
841.89
){
_h
=
841.89
;
_w
=
_h
/
imgHeight
*
imgWidth
}
const
_left
=
(
595.28
-
_w
)
/
2
;
doc
.
addImage
(
canvas
,
'
PNG
'
,
_left
,
0
,
_w
,
_h
,
''
,
'
FAST
'
);
return
_BOX
[
"
downloadBillService
"
]({
id
:
this
.
currRow
.
id
})
}).
then
(
res
=>
{
let
form
=
new
FormData
()
let
file
=
(
new
URL
(
res
.
data
.
imgUrl
)).
pathname
.
replace
(
/^
(\/)[
a-zA-Z0-9
]
/
,
''
)
// 替换掉最前面的/
form
.
append
(
'
file
'
,
new
File
([
doc
.
output
(
'
arraybuffer
'
)],
file
,
{
type
:
'
application/pdf
'
}))
form
.
append
(
'
path
'
,
file
)
return
uploadFile
(
form
)
}).
finally
(
res
=>
{
loading
.
close
()
})
},
print
()
{
print
()
{
lodop
()
lodop
()
.
then
((
LODOP
)
=>
{
.
then
((
LODOP
)
=>
{
...
...
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