|
|
@@ -104,7 +104,7 @@
|
|
|
width="200px"
|
|
|
>
|
|
|
<div class="df aic jcsb">
|
|
|
- <div class="df aic">
|
|
|
+ <div v-if="exportModalTitle != '航次列表'" class="df aic">
|
|
|
<div class="mr20">请选择月份:</div>
|
|
|
<el-date-picker
|
|
|
v-model="currentMonth"
|
|
|
@@ -114,6 +114,7 @@
|
|
|
:disabled="isLoadingZip"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <div></div>
|
|
|
<el-button type="primary" @click="exportZip" :loading="isLoadingZip"
|
|
|
>导出{{ exportModalTitle }}</el-button
|
|
|
>
|
|
|
@@ -715,50 +716,71 @@ function showExportModal(type) {
|
|
|
let isLoadingZip = ref(false);
|
|
|
|
|
|
async function exportZip() {
|
|
|
- if (!currentMonth.value) return;
|
|
|
+ if (!currentMonth.value && exportModalTitle.value != "航次列表") return;
|
|
|
|
|
|
isLoadingZip.value = true;
|
|
|
let path = "";
|
|
|
let type = "";
|
|
|
+ let postData = {
|
|
|
+ loginAccountId: localStorage.loginAccountId,
|
|
|
+ };
|
|
|
+ let title = "";
|
|
|
switch (exportModalTitle.value) {
|
|
|
case "航次列表": {
|
|
|
path = "/voyage/exportListExcel";
|
|
|
type =
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
|
|
|
+ title = `${exportModalTitle.value}`;
|
|
|
+ let arr = [];
|
|
|
+ for (let i of tableData.value) {
|
|
|
+ arr.push(i.id);
|
|
|
+ }
|
|
|
+ postData.voyageIds = arr.join(",");
|
|
|
break;
|
|
|
}
|
|
|
case "航次跟踪": {
|
|
|
path = "/voyage/exportMultExcel";
|
|
|
type = "application/zip";
|
|
|
+ postData.date = currentMonth.value;
|
|
|
+ title = `${exportModalTitle.value}${currentMonth.value}`;
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
case "卸货记录": {
|
|
|
path = "/voyage/exportMultDischargeExcel";
|
|
|
type = "application/zip";
|
|
|
+ postData.date = currentMonth.value;
|
|
|
+ title = `${exportModalTitle.value}${currentMonth.value}`;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- let res = await downloadBlobFile(
|
|
|
- `${url.baseurl}${path}`,
|
|
|
- { loginAccountId: localStorage.loginAccountId, date: currentMonth.value },
|
|
|
- `${exportModalTitle.value}${currentMonth.value}`,
|
|
|
- "post",
|
|
|
- type
|
|
|
- );
|
|
|
- if (res.status == 0) {
|
|
|
- ElNotification({
|
|
|
- title: "导出成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- } else {
|
|
|
+ try {
|
|
|
+ let res = await downloadBlobFile(
|
|
|
+ `${url.baseurl}${path}`,
|
|
|
+ postData,
|
|
|
+ title,
|
|
|
+ "post",
|
|
|
+ type
|
|
|
+ );
|
|
|
+ if (res.status == 0) {
|
|
|
+ ElNotification({
|
|
|
+ title: "导出成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ title: "暂无数据",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
ElNotification({
|
|
|
title: "暂无数据",
|
|
|
});
|
|
|
+ } finally {
|
|
|
+ isLoadingZip.value = false;
|
|
|
+ currentMonth.value = "";
|
|
|
+ exportModalVisable.value = false;
|
|
|
}
|
|
|
-
|
|
|
- isLoadingZip.value = false;
|
|
|
- currentMonth.value = "";
|
|
|
- exportModalVisable.value = false;
|
|
|
}
|
|
|
|
|
|
function rowStyle({ row }) {
|