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
b9cd86c2
Commit
b9cd86c2
authored
Oct 17, 2022
by
huhaiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复下载文件时后台返回json无法解析
parent
62da92d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
34 deletions
+50
-34
box.js
src/api/ecw/box.js
+5
-5
index.vue
src/views/ecw/box/ladingBill/index.vue
+17
-13
makeLadingBill.vue
src/views/ecw/box/ladingBill/makeLadingBill.vue
+6
-2
previewBill.vue
src/views/ecw/box/ladingBill/previewBill.vue
+7
-6
utils.js
src/views/ecw/box/shippingSea/utils.js
+15
-8
No files found.
src/api/ecw/box.js
View file @
b9cd86c2
...
...
@@ -154,7 +154,7 @@ export function cancelBillService(id) {
export
function
downloadBillService
(
params
)
{
return
request
({
url
:
"
/shipment/make-bill-of-lading/download
"
,
responseType
:
"
arraybuffer
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
,
});
...
...
@@ -190,7 +190,7 @@ export function getBillService(params) {
export
function
zipDownload
(
params
)
{
return
request
({
url
:
"
/shipment/make-bill-of-lading/zipDownload
"
,
responseType
:
"
arraybuffer
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
,
});
...
...
@@ -284,7 +284,7 @@ export function downloadCustomFiles(params) {
export
function
downloadLoadGoodsList
(
params
)
{
return
request
({
url
:
"
/ecw/box-preload-goods/downloadLoadGoodsList
"
,
responseType
:
"
arraybuffer
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
,
});
...
...
@@ -294,7 +294,7 @@ export function downloadLoadGoodsList(params) {
export
function
downloadPreloadGoodsList
(
params
)
{
return
request
({
url
:
"
/ecw/box-preload-goods/downloadPreloadGoodsList
"
,
responseType
:
"
arraybuffer
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
,
});
...
...
@@ -304,7 +304,7 @@ export function downloadPreloadGoodsList(params) {
export
function
downloadReceivableList
(
params
)
{
return
request
({
url
:
"
/ecw/box-preload-goods/downloadReceivableList
"
,
responseType
:
"
arraybuffer
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
,
});
...
...
src/views/ecw/box/ladingBill/index.vue
View file @
b9cd86c2
...
...
@@ -89,7 +89,6 @@ import {
makeBillService
,
getBillService
,
deleteBillService
,
zipDownload
,
}
from
"
@/api/ecw/box
"
;
import
{
getTotlContent
,
...
...
@@ -98,7 +97,6 @@ import {
}
from
"
../shippingSea/utils
"
;
import
makeLadingBill
from
"
./makeLadingBill.vue
"
;
import
previewBill
from
"
./previewBill.vue
"
;
import
FileSaver
from
"
file-saver
"
;
export
default
{
name
:
"
ladingBill
"
,
...
...
@@ -145,11 +143,14 @@ export default {
/* const title = `查看提单 ${this.shipmentObj.selfNo ?? ""} 柜号:${
this.shipmentObj.cubNo ?? ""
} 柜型:${cabinetLabel}`; */
const
title
=
this
.
$t
(
'
查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}
'
,
{
selfNo
:
this
.
shipmentObj
.
selfNo
,
cubNo
:
this
.
shipmentObj
.
cubNo
,
cabinetLabel
})
const
title
=
this
.
$t
(
"
查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}
"
,
{
selfNo
:
this
.
shipmentObj
.
selfNo
,
cubNo
:
this
.
shipmentObj
.
cubNo
,
cabinetLabel
,
}
);
this
.
$set
(
this
.
dialogCfg
,
"
title
"
,
title
);
},
closeDialog
(
type
)
{
...
...
@@ -182,7 +183,7 @@ export default {
downloadFile
(
type
,
{
shipmentId
:
this
.
shipmentObj
.
id
},
this
.
$t
(
'
已装单
'
)
+
`(
${
this
.
shipmentObj
.
selfNo
}
).xlsx`
,
this
.
$t
(
"
已装单
"
)
+
`(
${
this
.
shipmentObj
.
selfNo
}
).xlsx`
,
"
xlsx
"
);
return
;
...
...
@@ -190,7 +191,7 @@ export default {
downloadFile
(
type
,
{
shipmentId
:
this
.
shipmentObj
.
id
},
this
.
$t
(
'
应收汇总表
'
)
+
`(
${
this
.
shipmentObj
.
selfNo
}
).xlsx`
,
this
.
$t
(
"
应收汇总表
"
)
+
`(
${
this
.
shipmentObj
.
selfNo
}
).xlsx`
,
"
xlsx
"
);
return
;
...
...
@@ -220,14 +221,17 @@ export default {
this
.
currData
=
{
billContent
:
data
?.
billContent
??
""
,
orderNo
:
this
.
currRow
.
orderNo
,
bpmProcessId
:
data
.
bpmProcessId
,
};
});
},
clickZipDownload
()
{
zipDownload
({
shipmentId
:
this
.
shipmentObj
.
id
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
],
{
type
:
"
application/zip
"
});
FileSaver
.
saveAs
(
blob
,
this
.
$t
(
'
打包文件
'
)
+
"
.zip
"
);
});
downloadFile
(
"
zipDownload
"
,
{
shipmentId
:
this
.
shipmentObj
.
id
},
this
.
$t
(
"
打包文件
"
)
+
"
.zip
"
,
"
zip
"
);
},
},
computed
:
{
...
...
src/views/ecw/box/ladingBill/makeLadingBill.vue
View file @
b9cd86c2
...
...
@@ -14,7 +14,7 @@
<work-flow
xmlkey=
"bill_lading"
v-model=
"selectedUsers"
></work-flow>
</div>
<div
v-if=
"currRow.status === 1"
>
<el-button
type=
"primary"
disabled
>
{{
$t
(
'
审核中
'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"jumpReviewDetail"
>
{{
$t
(
'
审核中
'
)
}}
</el-button>
<el-button
plain
type=
"primary"
@
click=
"canclAudit"
>
{{
$t
(
'
取消审核
'
)
}}
</el-button>
<el-button
plain
type=
"primary"
@
click=
"showLoaingTemplate"
>
{{
$t
(
'
提单预览
'
)
}}
</el-button>
</div>
...
...
@@ -38,7 +38,7 @@ import {
updateBillService
,
cancelBillService
,
}
from
"
@/api/ecw/box
"
;
import
{
serviceMsg
}
from
"
../shippingSea/utils
"
;
import
{
serviceMsg
,
toReviewDetail
}
from
"
../shippingSea/utils
"
;
import
previewBill
from
"
./previewBill.vue
"
;
import
{
getToken
}
from
"
@/utils/auth
"
;
...
...
@@ -200,6 +200,10 @@ export default {
close
(
type
)
{
this
.
$emit
(
"
closeDialog
"
,
type
);
},
jumpReviewDetail
()
{
const
{
bpmProcessId
}
=
this
.
currData
;
toReviewDetail
.
apply
(
this
,
[
bpmProcessId
]);
},
},
watch
:
{
currData
:
{
...
...
src/views/ecw/box/ladingBill/previewBill.vue
View file @
b9cd86c2
...
...
@@ -9,9 +9,8 @@
</
template
>
<
script
>
import
{
downloadBillService
}
from
"
@/api/ecw/box
"
;
import
lodop
from
"
@/utils/lodop
"
;
import
FileSaver
from
"
file-saver
"
;
import
{
downloadFile
}
from
"
../shippingSea/utils
"
;
export
default
{
name
:
"
previewBill
"
,
...
...
@@ -22,10 +21,12 @@ export default {
},
methods
:
{
download
()
{
downloadBillService
({
id
:
this
.
currRow
.
id
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
],
{
type
:
"
application/pdf
"
});
FileSaver
.
saveAs
(
blob
,
this
.
currRow
.
orderNo
+
"
.pdf
"
);
});
downloadFile
(
"
downloadBillService
"
,
{
id
:
this
.
currRow
.
id
},
this
.
currRow
.
orderNo
+
"
.pdf
"
,
"
pdf
"
);
},
print
()
{
lodop
()
...
...
src/views/ecw/box/shippingSea/utils.js
View file @
b9cd86c2
...
...
@@ -1510,15 +1510,22 @@ function toReviewDetail(bpmProcessId) {
function downloadFile(funName, params, fileName, fileFormat) {
_BOX[funName](params).then((res) => {
try {
let jsonData = JSON.parse(res);
if (jsonData.code === 0) {
window.ElementUI.$message.success("操作成功");
const reader = new FileReader();
reader.onload = (event) => {
try {
// 将读取的string转换为json
// 若果能转换成功 => 接口返回的是json数据,提示报错信息
const json = JSON.parse(event.target.result);
if (json.code) {
window.ElementUI.Message.error(json.msg);
}
} catch (err) {
let blob = new Blob([res], { type: `
application
/
$
{
fileFormat
}
` });
FileSaver.saveAs(blob, fileName);
}
} catch (error) {
let blob = new Blob([res], { type: `
application
/
$
{
fileFormat
}
` });
FileSaver.saveAs(blob, fileName);
}
};
reader.readAsText(res);
});
}
...
...
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