Commit 946b8b13 authored by dragondean@qq.com's avatar dragondean@qq.com
parents 56c000d1 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,
});
......
......@@ -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: {
......
......@@ -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: {
......
......@@ -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()
......
......@@ -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);
});
}
......
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