Commit 946b8b13 authored by dragondean@qq.com's avatar dragondean@qq.com
parents 56c000d1 b9cd86c2
...@@ -154,7 +154,7 @@ export function cancelBillService(id) { ...@@ -154,7 +154,7 @@ export function cancelBillService(id) {
export function downloadBillService(params) { export function downloadBillService(params) {
return request({ return request({
url: "/shipment/make-bill-of-lading/download", url: "/shipment/make-bill-of-lading/download",
responseType: "arraybuffer", responseType: "blob",
method: "get", method: "get",
params, params,
}); });
...@@ -190,7 +190,7 @@ export function getBillService(params) { ...@@ -190,7 +190,7 @@ export function getBillService(params) {
export function zipDownload(params) { export function zipDownload(params) {
return request({ return request({
url: "/shipment/make-bill-of-lading/zipDownload", url: "/shipment/make-bill-of-lading/zipDownload",
responseType: "arraybuffer", responseType: "blob",
method: "get", method: "get",
params, params,
}); });
...@@ -284,7 +284,7 @@ export function downloadCustomFiles(params) { ...@@ -284,7 +284,7 @@ export function downloadCustomFiles(params) {
export function downloadLoadGoodsList(params) { export function downloadLoadGoodsList(params) {
return request({ return request({
url: "/ecw/box-preload-goods/downloadLoadGoodsList", url: "/ecw/box-preload-goods/downloadLoadGoodsList",
responseType: "arraybuffer", responseType: "blob",
method: "get", method: "get",
params, params,
}); });
...@@ -294,7 +294,7 @@ export function downloadLoadGoodsList(params) { ...@@ -294,7 +294,7 @@ export function downloadLoadGoodsList(params) {
export function downloadPreloadGoodsList(params) { export function downloadPreloadGoodsList(params) {
return request({ return request({
url: "/ecw/box-preload-goods/downloadPreloadGoodsList", url: "/ecw/box-preload-goods/downloadPreloadGoodsList",
responseType: "arraybuffer", responseType: "blob",
method: "get", method: "get",
params, params,
}); });
...@@ -304,7 +304,7 @@ export function downloadPreloadGoodsList(params) { ...@@ -304,7 +304,7 @@ export function downloadPreloadGoodsList(params) {
export function downloadReceivableList(params) { export function downloadReceivableList(params) {
return request({ return request({
url: "/ecw/box-preload-goods/downloadReceivableList", url: "/ecw/box-preload-goods/downloadReceivableList",
responseType: "arraybuffer", responseType: "blob",
method: "get", method: "get",
params, params,
}); });
......
...@@ -89,7 +89,6 @@ import { ...@@ -89,7 +89,6 @@ import {
makeBillService, makeBillService,
getBillService, getBillService,
deleteBillService, deleteBillService,
zipDownload,
} from "@/api/ecw/box"; } from "@/api/ecw/box";
import { import {
getTotlContent, getTotlContent,
...@@ -98,7 +97,6 @@ import { ...@@ -98,7 +97,6 @@ import {
} from "../shippingSea/utils"; } from "../shippingSea/utils";
import makeLadingBill from "./makeLadingBill.vue"; import makeLadingBill from "./makeLadingBill.vue";
import previewBill from "./previewBill.vue"; import previewBill from "./previewBill.vue";
import FileSaver from "file-saver";
export default { export default {
name: "ladingBill", name: "ladingBill",
...@@ -145,11 +143,14 @@ export default { ...@@ -145,11 +143,14 @@ export default {
/* const title = `查看提单 ${this.shipmentObj.selfNo ?? ""} 柜号:${ /* const title = `查看提单 ${this.shipmentObj.selfNo ?? ""} 柜号:${
this.shipmentObj.cubNo ?? "" this.shipmentObj.cubNo ?? ""
} 柜型:${cabinetLabel}`; */ } 柜型:${cabinetLabel}`; */
const title = this.$t('查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}', { const title = this.$t(
selfNo: this.shipmentObj.selfNo, "查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}",
cubNo: this.shipmentObj.cubNo, {
cabinetLabel selfNo: this.shipmentObj.selfNo,
}) cubNo: this.shipmentObj.cubNo,
cabinetLabel,
}
);
this.$set(this.dialogCfg, "title", title); this.$set(this.dialogCfg, "title", title);
}, },
closeDialog(type) { closeDialog(type) {
...@@ -182,7 +183,7 @@ export default { ...@@ -182,7 +183,7 @@ export default {
downloadFile( downloadFile(
type, type,
{ shipmentId: this.shipmentObj.id }, { shipmentId: this.shipmentObj.id },
this.$t('已装单') + `(${this.shipmentObj.selfNo}).xlsx`, this.$t("已装单") + `(${this.shipmentObj.selfNo}).xlsx`,
"xlsx" "xlsx"
); );
return; return;
...@@ -190,7 +191,7 @@ export default { ...@@ -190,7 +191,7 @@ export default {
downloadFile( downloadFile(
type, type,
{ shipmentId: this.shipmentObj.id }, { shipmentId: this.shipmentObj.id },
this.$t('应收汇总表') + `(${this.shipmentObj.selfNo}).xlsx`, this.$t("应收汇总表") + `(${this.shipmentObj.selfNo}).xlsx`,
"xlsx" "xlsx"
); );
return; return;
...@@ -220,14 +221,17 @@ export default { ...@@ -220,14 +221,17 @@ export default {
this.currData = { this.currData = {
billContent: data?.billContent ?? "", billContent: data?.billContent ?? "",
orderNo: this.currRow.orderNo, orderNo: this.currRow.orderNo,
bpmProcessId: data.bpmProcessId,
}; };
}); });
}, },
clickZipDownload() { clickZipDownload() {
zipDownload({ shipmentId: this.shipmentObj.id }).then((res) => { downloadFile(
let blob = new Blob([res], { type: "application/zip" }); "zipDownload",
FileSaver.saveAs(blob, this.$t('打包文件') + ".zip"); { shipmentId: this.shipmentObj.id },
}); this.$t("打包文件") + ".zip",
"zip"
);
}, },
}, },
computed: { computed: {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<work-flow xmlkey="bill_lading" v-model="selectedUsers"></work-flow> <work-flow xmlkey="bill_lading" v-model="selectedUsers"></work-flow>
</div> </div>
<div v-if="currRow.status === 1"> <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="canclAudit">{{$t('取消审核')}}</el-button>
<el-button plain type="primary" @click="showLoaingTemplate">{{$t('提单预览')}}</el-button> <el-button plain type="primary" @click="showLoaingTemplate">{{$t('提单预览')}}</el-button>
</div> </div>
...@@ -38,7 +38,7 @@ import { ...@@ -38,7 +38,7 @@ import {
updateBillService, updateBillService,
cancelBillService, cancelBillService,
} from "@/api/ecw/box"; } from "@/api/ecw/box";
import { serviceMsg } from "../shippingSea/utils"; import { serviceMsg, toReviewDetail } from "../shippingSea/utils";
import previewBill from "./previewBill.vue"; import previewBill from "./previewBill.vue";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
...@@ -200,6 +200,10 @@ export default { ...@@ -200,6 +200,10 @@ export default {
close(type) { close(type) {
this.$emit("closeDialog", type); this.$emit("closeDialog", type);
}, },
jumpReviewDetail() {
const { bpmProcessId } = this.currData;
toReviewDetail.apply(this, [bpmProcessId]);
},
}, },
watch: { watch: {
currData: { currData: {
......
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
</template> </template>
<script> <script>
import { downloadBillService } from "@/api/ecw/box";
import lodop from "@/utils/lodop"; import lodop from "@/utils/lodop";
import FileSaver from "file-saver"; import { downloadFile } from "../shippingSea/utils";
export default { export default {
name: "previewBill", name: "previewBill",
...@@ -22,10 +21,12 @@ export default { ...@@ -22,10 +21,12 @@ export default {
}, },
methods: { methods: {
download() { download() {
downloadBillService({ id: this.currRow.id }).then((res) => { downloadFile(
let blob = new Blob([res], { type: "application/pdf" }); "downloadBillService",
FileSaver.saveAs(blob, this.currRow.orderNo + ".pdf"); { id: this.currRow.id },
}); this.currRow.orderNo + ".pdf",
"pdf"
);
}, },
print() { print() {
lodop() lodop()
......
...@@ -1510,15 +1510,22 @@ function toReviewDetail(bpmProcessId) { ...@@ -1510,15 +1510,22 @@ function toReviewDetail(bpmProcessId) {
function downloadFile(funName, params, fileName, fileFormat) { function downloadFile(funName, params, fileName, fileFormat) {
_BOX[funName](params).then((res) => { _BOX[funName](params).then((res) => {
try { const reader = new FileReader();
let jsonData = JSON.parse(res);
if (jsonData.code === 0) { reader.onload = (event) => {
window.ElementUI.$message.success("操作成功"); 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}` }); reader.readAsText(res);
FileSaver.saveAs(blob, fileName);
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment