zhanbo.xu

Merge branch 'release-pdd-cache-v1.0.10' into release-pdd-cache-v1.0.11

...@@ -328,3 +328,29 @@ export function getOperationLogByBillNo(data) { ...@@ -328,3 +328,29 @@ export function getOperationLogByBillNo(data) {
328 data: data, 328 data: data,
329 }); 329 });
330 } 330 }
331 +
332 +// 查询导出的任务ID
333 +
334 +// POST
335 +// /exportList/submitExportTask
336 +export function getSubmitExportTask(data) {
337 + return request({
338 + url: "/bus-customer/declareData/submitExportTask",
339 + method: "post",
340 + data: data,
341 + });
342 +}
343 +// /asyncExport/taskStatus/{taskId}
344 +export function getTaskStatus(data) {
345 + return request({
346 + url: "/bus-customer/asyncExport/taskStatus/" + data.taskId,
347 + method: "get",
348 + });
349 +}
350 +// /asyncExport/download/{taskId}
351 +export function getDownload(data) {
352 + return request({
353 + url: "/bus-customer/asyncExport/download/" + data.taskId,
354 + method: "get",
355 + });
356 +}
......
...@@ -64,3 +64,29 @@ export function getCustomizeExcel(data) { ...@@ -64,3 +64,29 @@ export function getCustomizeExcel(data) {
64 data: data, 64 data: data,
65 }); 65 });
66 } 66 }
67 +
68 +// 查询导出的任务ID
69 +
70 +// POST
71 +// /exportList/submitExportTask
72 +export function getSubmitExportTask(data) {
73 + return request({
74 + url: "/bus-customer/exportList/submitExportTask",
75 + method: "post",
76 + data: data,
77 + });
78 +}
79 +// /asyncExport/taskStatus/{taskId}
80 +export function getTaskStatus(data) {
81 + return request({
82 + url: "/bus-customer/asyncExport/taskStatus/" + data.taskId,
83 + method: "get",
84 + });
85 +}
86 +// /asyncExport/download/{taskId}
87 +export function getDownload(data) {
88 + return request({
89 + url: "/bus-customer/asyncExport/download/" + data.taskId,
90 + method: "get",
91 + });
92 +}
......
...@@ -51,6 +51,7 @@ router.beforeEach((to, from, next) => { ...@@ -51,6 +51,7 @@ router.beforeEach((to, from, next) => {
51 "RETURN_STATUS", 51 "RETURN_STATUS",
52 "FORWARD_STATUS", 52 "FORWARD_STATUS",
53 "DATA_SOURCE_IMPORT", 53 "DATA_SOURCE_IMPORT",
54 + "DECLARE_TRAFMODE",
54 ]); 55 ]);
55 // 根据roles权限生成可访问的路由表 56 // 根据roles权限生成可访问的路由表
56 router.addRoutes(accessRoutes); // 动态添加可访问路由表 57 router.addRoutes(accessRoutes); // 动态添加可访问路由表
......
...@@ -20,13 +20,13 @@ const user = { ...@@ -20,13 +20,13 @@ const user = {
20 permissions: [], 20 permissions: [],
21 linkList: [], 21 linkList: [],
22 dict: { 22 dict: {
23 - DECLARE_TRAFMODE: [ 23 + // DECLARE_TRAFMODE: [
24 - { 24 + // {
25 - itemCode: "DECLARE_TRAFMODE_AVIATION", 25 + // itemCode: "DECLARE_TRAFMODE_AVIATION",
26 - itemChineseName: "航空运输", 26 + // itemChineseName: "航空运输",
27 - itemValue: "5", 27 + // itemValue: "5",
28 - }, 28 + // },
29 - ], 29 + // ],
30 }, 30 },
31 loading: { 31 loading: {
32 type: false, 32 type: false,
......
1 -import axios from 'axios' 1 +import axios from "axios";
2 -import { MessageBox, Message } from 'element-ui' 2 +import { MessageBox, Message } from "element-ui";
3 -import store from '@/store' 3 +import store from "@/store";
4 -import { getToken, setTime, removeTime, removeToken } from '@/utils/auth' 4 +import { getToken, setTime, removeTime, removeToken } from "@/utils/auth";
5 -import errorCode from '@/utils/errorCode' 5 +import errorCode from "@/utils/errorCode";
6 -import i18n from '@/assets/languages' 6 +import i18n from "@/assets/languages";
7 7
8 -axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' 8 +axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
9 // 创建axios实例 9 // 创建axios实例
10 const service = axios.create({ 10 const service = axios.create({
11 // axios中请求配置有baseURL选项,表示请求URL公共部分 11 // axios中请求配置有baseURL选项,表示请求URL公共部分
12 baseURL: process.env.VUE_APP_BASE_API, 12 baseURL: process.env.VUE_APP_BASE_API,
13 // 超时 13 // 超时
14 - timeout: 1800000 14 + timeout: 180000000,
15 -}) 15 +});
16 // request拦截器 16 // request拦截器
17 -service.interceptors.request.use(config => { 17 +service.interceptors.request.use(
18 - // 是否需要设置 token 18 + (config) => {
19 - const isToken = (config.headers || {}).isToken === false 19 + // 是否需要设置 token
20 - // if (getToken() && !isToken) { 20 + const isToken = (config.headers || {}).isToken === false;
21 - config.headers['Authorization'] = getToken() == null ? '1' : 'Bearer ' + getToken()// 让每个请求携带自定义token 请根据实际情况自行修改 21 + // if (getToken() && !isToken) {
22 - // } 22 + config.headers["Authorization"] =
23 - config.headers['Lang'] = localStorage.getItem('iClearExpLang') ? localStorage.getItem('iClearExpLang') : '1' 23 + getToken() == null ? "1" : "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
24 - config.headers['Ver'] = process.env.VUE_APP_APIVERSION 24 + // }
25 - // get请求映射params参数 25 + config.headers["Lang"] = localStorage.getItem("iClearExpLang")
26 - if (config.method === 'get' && config.params) { 26 + ? localStorage.getItem("iClearExpLang")
27 - let url = config.url + '?'; 27 + : "1";
28 - for (const propName of Object.keys(config.params)) { 28 + config.headers["Ver"] = process.env.VUE_APP_APIVERSION;
29 - const value = config.params[propName]; 29 + // get请求映射params参数
30 - var part = encodeURIComponent(propName) + "="; 30 + if (config.method === "get" && config.params) {
31 - if (value !== null && typeof (value) !== "undefined") { 31 + let url = config.url + "?";
32 - if (typeof value === 'object') { 32 + for (const propName of Object.keys(config.params)) {
33 - for (const key of Object.keys(value)) { 33 + const value = config.params[propName];
34 - let params = propName + '[' + key + ']'; 34 + var part = encodeURIComponent(propName) + "=";
35 - var subPart = encodeURIComponent(params) + "="; 35 + if (value !== null && typeof value !== "undefined") {
36 - url += subPart + encodeURIComponent(value[key]) + "&"; 36 + if (typeof value === "object") {
37 + for (const key of Object.keys(value)) {
38 + let params = propName + "[" + key + "]";
39 + var subPart = encodeURIComponent(params) + "=";
40 + url += subPart + encodeURIComponent(value[key]) + "&";
41 + }
42 + } else {
43 + url += part + encodeURIComponent(value) + "&";
37 } 44 }
38 - } else {
39 - url += part + encodeURIComponent(value) + "&";
40 } 45 }
41 } 46 }
47 + url = url.slice(0, -1);
48 + config.params = {};
49 + config.url = url;
42 } 50 }
43 - url = url.slice(0, -1); 51 + // let token = getToken() != null ? getToken().split('.')[0] : null
44 - config.params = {}; 52 + // let userType = store.getters.userData.organization ? store.getters.userData.organization.code : null
45 - config.url = url; 53 + // if ((token == '2' && userType != null && userType != 'customer') || (token == '1' && userType == 'customer')) {
54 + // config.url = ''
55 + // MessageBox.alert('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
56 + // confirmButtonText: '重新登录',
57 + // cancelButtonText: '取消',
58 + // type: 'warning'
59 + // }
60 + // ).then(() => {
61 + // store.dispatch('FedLogOut')
62 + // })
63 + // return config
64 + // } else {
65 + return config;
66 + // }
67 + },
68 + (error) => {
69 + console.log(error);
70 + Promise.reject(error);
46 } 71 }
47 - // let token = getToken() != null ? getToken().split('.')[0] : null 72 +);
48 - // let userType = store.getters.userData.organization ? store.getters.userData.organization.code : null
49 - // if ((token == '2' && userType != null && userType != 'customer') || (token == '1' && userType == 'customer')) {
50 - // config.url = ''
51 - // MessageBox.alert('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
52 - // confirmButtonText: '重新登录',
53 - // cancelButtonText: '取消',
54 - // type: 'warning'
55 - // }
56 - // ).then(() => {
57 - // store.dispatch('FedLogOut')
58 - // })
59 - // return config
60 - // } else {
61 - return config
62 - // }
63 -}, error => {
64 - console.log(error)
65 - Promise.reject(error)
66 -})
67 73
68 // 响应拦截器 74 // 响应拦截器
69 -service.interceptors.response.use(res => { 75 +service.interceptors.response.use(
70 - if (res.config.url != '/manager-server/systemAddressInfoController/findSystemAddressInfoAll') { 76 + (res) => {
71 - setTime(new Date().getTime()) 77 + if (
72 - } 78 + res.config.url !=
73 - // 未设置状态码则默认成功状态 79 + "/manager-server/systemAddressInfoController/findSystemAddressInfoAll"
74 - const code = Number(res.data.code) || 200; 80 + ) {
75 - // 获取错误信息 81 + setTime(new Date().getTime());
76 - const msg = errorCode[code] || res.data.message || errorCode['default']
77 - if (code === 50000 || code === 530) {
78 - removeToken()
79 - MessageBox.alert(i18n.t('system.loginOut'), i18n.t('system.systemTip'), {
80 - confirmButtonText: i18n.t('system.relogin'),
81 - cancelButtonText: i18n.t('system.close'),
82 - type: 'warning'
83 } 82 }
84 - ).finally(() => { 83 + // 未设置状态码则默认成功状态
85 - store.dispatch('FedLogOut') 84 + const code = Number(res.data.code) || 200;
86 - }) 85 + // 获取错误信息
87 - } else if (code === 10005) { 86 + const msg = errorCode[code] || res.data.message || errorCode["default"];
88 - removeToken() 87 + if (code === 50000 || code === 530) {
89 - MessageBox.alert('<span style="font-weight:700">系统版本已更新!</span><br/>当前版本非最新版,请退出系统后刷新您当前所使用的浏览器后,重新登录系统!</br> </br>常用浏览器的快速刷新页面操作方法有:</br>1、谷歌浏览器请按“F5键”或“Ctrl键 + R键”快速刷新页面</br>2、360浏览器跟EDGE浏览器请按“Ctrl键 + R键”快速刷新页面</br>3、IE浏览器请按“F5键”或“Ctrl键 + R键”快速刷新页面</br> </br>其它浏览器的刷新方式请根据浏览器的菜单进行操作!', i18n.t('system.systemTip'), { 88 + removeToken();
90 - confirmButtonText: i18n.t('system.relogin'), 89 + MessageBox.alert(i18n.t("system.loginOut"), i18n.t("system.systemTip"), {
91 - cancelButtonText: i18n.t('system.close'), 90 + confirmButtonText: i18n.t("system.relogin"),
92 - type: 'warning', 91 + cancelButtonText: i18n.t("system.close"),
93 - customClass: 'systemVerError', 92 + type: "warning",
94 - dangerouslyUseHTMLString: true 93 + }).finally(() => {
94 + store.dispatch("FedLogOut");
95 + });
96 + } else if (code === 10005) {
97 + removeToken();
98 + MessageBox.alert(
99 + '<span style="font-weight:700">系统版本已更新!</span><br/>当前版本非最新版,请退出系统后刷新您当前所使用的浏览器后,重新登录系统!</br> </br>常用浏览器的快速刷新页面操作方法有:</br>1、谷歌浏览器请按“F5键”或“Ctrl键 + R键”快速刷新页面</br>2、360浏览器跟EDGE浏览器请按“Ctrl键 + R键”快速刷新页面</br>3、IE浏览器请按“F5键”或“Ctrl键 + R键”快速刷新页面</br> </br>其它浏览器的刷新方式请根据浏览器的菜单进行操作!',
100 + i18n.t("system.systemTip"),
101 + {
102 + confirmButtonText: i18n.t("system.relogin"),
103 + cancelButtonText: i18n.t("system.close"),
104 + type: "warning",
105 + customClass: "systemVerError",
106 + dangerouslyUseHTMLString: true,
107 + }
108 + ).finally(() => {
109 + store.dispatch("FedLogOut");
110 + });
111 + } else if (code === 500) {
112 + MessageBox.alert(msg, i18n.t("system.tipTitle2"), {
113 + dangerouslyUseHTMLString: true,
114 + });
115 + return Promise.reject(new Error(msg));
116 + } else if (code !== 200) {
117 + // MessageBox.alert(msg, '注意', {
118 + // dangerouslyUseHTMLString: true
119 + // });
120 + return res.data;
121 + } else {
122 + return res.data;
95 } 123 }
96 - ).finally(() => { 124 + },
97 - store.dispatch('FedLogOut') 125 + (error) => {
98 - }) 126 + removeTime();
99 - } else if (code === 500) { 127 + console.log("err" + error);
100 - MessageBox.alert(msg, i18n.t('system.tipTitle2'), {
101 - dangerouslyUseHTMLString: true
102 - });
103 - return Promise.reject(new Error(msg))
104 - } else if (code !== 200) {
105 - // MessageBox.alert(msg, '注意', {
106 - // dangerouslyUseHTMLString: true
107 - // });
108 - return res.data
109 - } else {
110 - return res.data
111 - }
112 -},
113 - error => {
114 - removeTime()
115 - console.log('err' + error)
116 let { message } = error; 128 let { message } = error;
117 if (message == "Network Error") { 129 if (message == "Network Error") {
118 - message = i18n.t('system.systemError1'); 130 + message = i18n.t("system.systemError1");
119 - } 131 + } else if (message.includes("timeout")) {
120 - else if (message.includes("timeout")) { 132 + message = i18n.t("system.systemError2");
121 - message = i18n.t('system.systemError2'); 133 + } else if (message.includes("Request failed with status code")) {
122 - } 134 + message = i18n.t("system.systemError3", {
123 - else if (message.includes("Request failed with status code")) { 135 + a: message.substr(message.length - 3),
124 - message = i18n.t('system.systemError3', { a: message.substr(message.length - 3) }); 136 + });
125 } 137 }
126 Message({ 138 Message({
127 message: message, 139 message: message,
128 - type: 'error', 140 + type: "error",
129 - duration: 5 * 1000 141 + duration: 5 * 1000,
130 - }) 142 + });
131 - return Promise.reject(error) 143 + return Promise.reject(error);
132 } 144 }
133 -) 145 +);
134 146
135 -export default service 147 +export default service;
......
...@@ -20,6 +20,8 @@ const apiUrl = { ...@@ -20,6 +20,8 @@ const apiUrl = {
20 declareDataModel: "/bus-customer/declareData/downloadTemplate", 20 declareDataModel: "/bus-customer/declareData/downloadTemplate",
21 // 清单查询下载 21 // 清单查询下载
22 listExport: "/bus-customer/exportList/listExport", 22 listExport: "/bus-customer/exportList/listExport",
23 + // 根据id导出
24 + customDownloadXls: "/bus-customer/asyncExport/download",
23 }; 25 };
24 26
25 const baseUrl = process.env.VUE_APP_BASE_API; 27 const baseUrl = process.env.VUE_APP_BASE_API;
...@@ -31,6 +33,8 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) { ...@@ -31,6 +33,8 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) {
31 url = baseUrl + apiUrl[str]; 33 url = baseUrl + apiUrl[str];
32 } else if (urlStatus == "res") { 34 } else if (urlStatus == "res") {
33 url = str; 35 url = str;
36 + } else if (urlStatus == "task") {
37 + url = baseUrl + apiUrl[str] + "/" + data.taskId;
34 } 38 }
35 console.log(url); 39 console.log(url);
36 40
...@@ -65,6 +69,7 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) { ...@@ -65,6 +69,7 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) {
65 }, 69 },
66 }) 70 })
67 .then((res) => { 71 .then((res) => {
72 + console.log(res);
68 if (filename == null) { 73 if (filename == null) {
69 if (res.headers["content-disposition"]) { 74 if (res.headers["content-disposition"]) {
70 var patt = new RegExp("filename=([^;]+\\.[^\\.;]+);*"); 75 var patt = new RegExp("filename=([^;]+\\.[^\\.;]+);*");
...@@ -80,8 +85,9 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) { ...@@ -80,8 +85,9 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) {
80 resolveBlob(res, mimeMap[type], filename); 85 resolveBlob(res, mimeMap[type], filename);
81 resolve(); 86 resolve();
82 }) 87 })
83 - .catch(() => { 88 + .catch((err) => {
84 - reject(); 89 + debugger;
90 + reject(err);
85 }); 91 });
86 }); 92 });
87 } 93 }
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
244 </el-row> 244 </el-row>
245 <el-row :gutter="5"> 245 <el-row :gutter="5">
246 <!-- 申报状态 --> 246 <!-- 申报状态 -->
247 - <el-col :span="6"> 247 + <el-col :span="3">
248 <Formitem label="主要货物信息" prop="mainGoodsInfo"> 248 <Formitem label="主要货物信息" prop="mainGoodsInfo">
249 <el-input 249 <el-input
250 type="text" 250 type="text"
...@@ -272,9 +272,55 @@ ...@@ -272,9 +272,55 @@
272 ></el-input> 272 ></el-input>
273 </Formitem> 273 </Formitem>
274 </el-col> 274 </el-col>
275 - <!-- 申报日期 --> 275 + <!-- 出口口岸 -->
276 + <el-col :span="3">
277 + <Formitem label="出口口岸" prop="exportPortCode">
278 + <el-input
279 + type="text"
280 + class="inputShadow"
281 + id="inputInner--exportPortCode"
282 + resize="none"
283 + v-model="formData.exportPortCode"
284 + clearable
285 + placeholder=""
286 + ></el-input>
287 + </Formitem>
288 + </el-col>
289 + <!-- 运输方式 -->
290 + <el-col :span="3">
291 + <Formitem label="运输方式" prop="transportMode">
292 + <el-select
293 + type="text"
294 + id="inputInner--transportMode"
295 + v-model="formData.transportMode"
296 + clearable
297 + placeholder=""
298 + >
299 + <el-option
300 + v-for="(item, index) in $store.getters.dict.DECLARE_TRAFMODE"
301 + :key="index"
302 + :label="item.itemChineseName"
303 + :value="item.itemValue"
304 + ></el-option>
305 + </el-select>
306 + </Formitem>
307 + </el-col>
308 + <!-- 运输工具名称 -->
309 + <el-col :span="3">
310 + <Formitem label="运输工具名称" prop="transportVehicleName">
311 + <el-input
312 + type="text"
313 + class="inputShadow"
314 + id="inputInner--transportVehicleName"
315 + resize="none"
316 + v-model="formData.transportVehicleName"
317 + clearable
318 + placeholder=""
319 + ></el-input>
320 + </Formitem>
321 + </el-col>
276 <el-col :span="3"> 322 <el-col :span="3">
277 - <Formitem label="航班号" prop="flightNumber"> 323 + <Formitem label="航班航次号" prop="flightNumber">
278 <el-input 324 <el-input
279 type="text" 325 type="text"
280 class="inputShadow" 326 class="inputShadow"
...@@ -313,6 +359,8 @@ ...@@ -313,6 +359,8 @@
313 ></el-input> 359 ></el-input>
314 </Formitem> 360 </Formitem>
315 </el-col> 361 </el-col>
362 + </el-row>
363 + <el-row :gutter="5">
316 <el-col :span="3"> 364 <el-col :span="3">
317 <Formitem label="监管场所代码" prop="regulatoryVenueCode"> 365 <Formitem label="监管场所代码" prop="regulatoryVenueCode">
318 <el-input 366 <el-input
...@@ -339,8 +387,6 @@ ...@@ -339,8 +387,6 @@
339 ></el-input> 387 ></el-input>
340 </Formitem> 388 </Formitem>
341 </el-col> 389 </el-col>
342 - </el-row>
343 - <el-row :gutter="5">
344 <el-col :span="3"> 390 <el-col :span="3">
345 <Formitem label="运抵国(地区)" prop="destinationCountryRegion"> 391 <Formitem label="运抵国(地区)" prop="destinationCountryRegion">
346 <el-select 392 <el-select
...@@ -445,6 +491,8 @@ ...@@ -445,6 +491,8 @@
445 ></el-input> 491 ></el-input>
446 </Formitem> 492 </Formitem>
447 </el-col> 493 </el-col>
494 + </el-row>
495 + <el-row :gutter="5">
448 <el-col :span="3"> 496 <el-col :span="3">
449 <Formitem label="保费币制" prop="insuredfeeCurrency"> 497 <Formitem label="保费币制" prop="insuredfeeCurrency">
450 <el-select 498 <el-select
...@@ -482,8 +530,6 @@ ...@@ -482,8 +530,6 @@
482 </el-select> 530 </el-select>
483 </Formitem> 531 </Formitem>
484 </el-col> 532 </el-col>
485 - </el-row>
486 - <el-row :gutter="5">
487 <el-col :span="3"> 533 <el-col :span="3">
488 <Formitem label="包装种类代码" prop="packageTypeCode"> 534 <Formitem label="包装种类代码" prop="packageTypeCode">
489 <el-select 535 <el-select
......
...@@ -215,6 +215,7 @@ ...@@ -215,6 +215,7 @@
215 size="small" 215 size="small"
216 icon="el-icon-download" 216 icon="el-icon-download"
217 @click="downloadData" 217 @click="downloadData"
218 + :loading="isPolling || exportLoading"
218 > 219 >
219 导出 220 导出
220 </el-button> 221 </el-button>
...@@ -282,9 +283,16 @@ ...@@ -282,9 +283,16 @@
282 </template> 283 </template>
283 284
284 <script> 285 <script>
285 -import { getAllexportList, getListReceiptData } from "@/api/exportList-api.js"; 286 +import {
287 + getAllexportList,
288 + getListReceiptData,
289 + getSubmitExportTask,
290 + getTaskStatus,
291 +} from "@/api/exportList-api.js";
286 import CustomDialog from "./custom-dialog.vue"; 292 import CustomDialog from "./custom-dialog.vue";
287 import { formatDateNew } from "../../utils"; 293 import { formatDateNew } from "../../utils";
294 +import axios from "axios";
295 +import { getToken } from "@/utils/auth";
288 296
289 export default { 297 export default {
290 name: "ExportListQuery", 298 name: "ExportListQuery",
...@@ -415,6 +423,12 @@ export default { ...@@ -415,6 +423,12 @@ export default {
415 formItemconsignmentHeadCode: false, 423 formItemconsignmentHeadCode: false,
416 }, 424 },
417 tableMaxheight: null, 425 tableMaxheight: null,
426 + exportLoading: false,
427 + pollTimer: null, // 定时器实例
428 + pollInterval: 5000, // 轮询间隔(5秒)
429 + isPolling: false, // 轮询状态标识
430 + currentTaskId: null,
431 + pollCount: 0,
418 }; 432 };
419 }, 433 },
420 created() { 434 created() {
...@@ -423,9 +437,13 @@ export default { ...@@ -423,9 +437,13 @@ export default {
423 mounted() { 437 mounted() {
424 this.tableMaxheight = window.innerHeight - 360; 438 this.tableMaxheight = window.innerHeight - 360;
425 }, 439 },
440 + beforeDestroy() {
441 + this.stopPolling(); // 组件销毁前清理定时器
442 + },
426 watch: { 443 watch: {
427 $route() { 444 $route() {
428 this.popoverClose(); 445 this.popoverClose();
446 + this.stopPolling(); // 组件销毁前清理定时器
429 }, 447 },
430 }, 448 },
431 methods: { 449 methods: {
...@@ -496,6 +514,139 @@ export default { ...@@ -496,6 +514,139 @@ export default {
496 summaryApplicationStatus: "", 514 summaryApplicationStatus: "",
497 }; 515 };
498 }, 516 },
517 +
518 + downLoadZip(retryCount = 0) {
519 + const baseUrl = process.env.VUE_APP_BASE_API;
520 + console.log(this.currentTaskId);
521 + axios({
522 + method: "get",
523 + url: `${baseUrl}/bus-customer/asyncExport/download/${this.currentTaskId}`,
524 + responseType: "blob",
525 + headers: {
526 + Authorization: "Bearer " + getToken(),
527 + Ver: process.env.VUE_APP_APIVERSION,
528 + },
529 + })
530 + .then((res) => {
531 + debugger;
532 + console.log(res);
533 + const mimeType =
534 + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
535 +
536 + const aLink = document.createElement("a");
537 + var blob = new Blob([res.data], { type: mimeType });
538 + if (blob.size < 500) {
539 + var reader = new FileReader();
540 + reader.readAsText(blob, "utf-8");
541 + reader.onloadend = () => {
542 + // 获取文本内容并将其转换为JSON格式
543 + if (
544 + reader.result &&
545 + reader.result != null &&
546 + reader.result != ""
547 + ) {
548 + if (JSON.parse(reader.result)) {
549 + debugger;
550 + let jsonData = JSON.parse(reader.result);
551 + if (jsonData.code == "10103") {
552 + // 检查重试次数
553 + if (retryCount < 50) {
554 + // 延迟后重试
555 + setTimeout(() => {
556 + this.downLoadZip(retryCount + 1);
557 + }, 5000); // 5秒后重试
558 + } else {
559 + this.alertWarningMsg("导出失败");
560 + this.exportLoading = false;
561 + }
562 +
563 + return;
564 + }
565 + this.alertWarningMsg(jsonData.message);
566 + } else {
567 + this.alertWarningMsg("文件无法下载,请重新生成后再试!");
568 + }
569 + } else {
570 + this.alertWarningMsg("文件无法下载,请重新生成后再试!");
571 + }
572 + };
573 + } else {
574 + const fileName = `${formatDateNew(new Date())}.xlsx`;
575 + aLink.href = URL.createObjectURL(blob);
576 + aLink.setAttribute("download", fileName); // 设置下载文件名称
577 + document.body.appendChild(aLink);
578 + aLink.click();
579 + document.body.removeChild(aLink);
580 + this.exportLoading = false;
581 + }
582 + })
583 + .catch((error) => {
584 + console.log("失败", error);
585 + this.exportLoading = false;
586 + });
587 + },
588 +
589 + // 查询成功后调用的其他接口
590 + async callOtherApi() {
591 + try {
592 + this.downLoadZip();
593 + // const fileName = `${formatDateNew(new Date())}.xlsx`;
594 + // this.fileDownload
595 + // .downLoadZip("task", "customDownloadXls", fileName, "xlsx", "get", {
596 + // taskId: this.currentTaskId,
597 + // })
598 + // .finally(() => {
599 + // // this.cancelDownload();
600 + // this.exportLoading = false;
601 + // });
602 + } catch (error) {
603 + console.error("后续接口调用失败:", error);
604 + }
605 + },
606 + // 轮询查询状态
607 + async pollStatus() {
608 + try {
609 + const result = await getTaskStatus({ taskId: this.currentTaskId });
610 + if (+result.code === 200) {
611 + // PENDING, PROCESSING, COMPLETED, FAILED
612 + if (result.data.status === "COMPLETED") {
613 + this.stopPolling(); // 停止轮询
614 + await this.callOtherApi(); // 调用其他接口
615 + } else if (result.data.status === "FAILED") {
616 + this.stopPolling();
617 + this.handleFailure();
618 + this.alertWarningMsg(result.data.errorMessage);
619 + } else {
620 + this.startPolling(); // 启动轮询
621 + }
622 + } else {
623 + this.stopPolling();
624 + this.handleFailure();
625 + }
626 + // 其他状态继续轮询
627 + } catch (error) {
628 + console.error("轮询查询失败:", error);
629 + this.stopPolling();
630 + }
631 + },
632 + // 启动轮询
633 + startPolling() {
634 + if (this.isPolling) return;
635 +
636 + this.isPolling = true;
637 + this.pollTimer = setInterval(() => {
638 + this.pollStatus();
639 + }, this.pollInterval);
640 + },
641 + // 停止轮询
642 + stopPolling() {
643 + if (this.pollTimer) {
644 + clearInterval(this.pollTimer);
645 + this.pollTimer = null;
646 + }
647 + this.isPolling = false;
648 + this.exportLoading = false;
649 + },
499 //导出 650 //导出
500 downloadData() { 651 downloadData() {
501 let obj = { ...this.sreachFormData }; 652 let obj = { ...this.sreachFormData };
...@@ -527,13 +678,32 @@ export default { ...@@ -527,13 +678,32 @@ export default {
527 // // 2. 清单查询 678 // // 2. 清单查询
528 // console.log(res); 679 // console.log(res);
529 // }); 680 // });
530 - const fileName = `${formatDateNew(new Date())}.xlsx`; 681 + this.exportLoading = true;
531 - this.fileDownload 682 +
532 - .downLoadZip("api", "listExport", fileName, "xlsx", "post", { 683 + this.$confirm(`正在导出中,请稍候!`, "提示", {
533 - ...obj, 684 + confirmButtonText: "确定",
685 + cancelButtonText: "取消",
686 + type: "warning",
687 + })
688 + .then(() => {
689 + getSubmitExportTask(obj).then((res) => {
690 + if (+res.code === 200) {
691 + console.log(res);
692 + this.currentTaskId = res.data;
693 + this.startPolling();
694 + }
695 + });
696 + // this.fileDownload
697 + // .downLoadZip("api", "listExport", fileName, "xlsx", "post", {
698 + // ...obj,
699 + // })
700 + // .finally(() => {
701 + // // this.cancelDownload();
702 + // this.exportLoading = false;
703 + // });
534 }) 704 })
535 - .finally(() => { 705 + .catch(() => {
536 - this.cancelDownload(); 706 + this.exportLoading = false;
537 }); 707 });
538 }, 708 },
539 //查询详情 709 //查询详情
......
...@@ -31,7 +31,11 @@ ...@@ -31,7 +31,11 @@
31 ></el-option> 31 ></el-option>
32 </el-select> 32 </el-select>
33 </Formitem> 33 </Formitem>
34 - <Formitem label="修改内容" prop="modifyContent"> 34 + <Formitem
35 + label="修改内容"
36 + prop="modifyContent"
37 + v-if="batchModifyFormData.modifyData !== 'TRANSPORT_MODE'"
38 + >
35 <el-input 39 <el-input
36 type="text" 40 type="text"
37 class="inputShadow" 41 class="inputShadow"
...@@ -41,6 +45,24 @@ ...@@ -41,6 +45,24 @@
41 placeholder="请输入修改内容" 45 placeholder="请输入修改内容"
42 ></el-input> 46 ></el-input>
43 </Formitem> 47 </Formitem>
48 + <!-- -->
49 + <Formitem label="运输方式" prop="modifyContent" v-else>
50 + <el-select
51 + type="text"
52 + id="inputInner--modifyContent"
53 + v-model="batchModifyFormData.modifyContent"
54 + clearable
55 + placeholder="请选择运输方式"
56 + >
57 + <el-option
58 + v-for="(item, index) in $store.getters.dict.DECLARE_TRAFMODE"
59 + :key="index"
60 + :label="item.itemChineseName"
61 + :value="item.itemValue"
62 + ></el-option>
63 + </el-select>
64 + </Formitem>
65 + <!-- -->
44 </el-form> 66 </el-form>
45 </div> 67 </div>
46 <div class="dialogOption entrySave revokeOperation"> 68 <div class="dialogOption entrySave revokeOperation">
...@@ -81,7 +103,11 @@ export default { ...@@ -81,7 +103,11 @@ export default {
81 { required: true, message: "请选择修改数据", trigger: "change" }, 103 { required: true, message: "请选择修改数据", trigger: "change" },
82 ], 104 ],
83 modifyContent: [ 105 modifyContent: [
84 - { required: true, message: "请输入修改内容", trigger: "blur" }, 106 + {
107 + required: true,
108 + message: "请输入修改内容",
109 + trigger: "blur",
110 + },
85 ], 111 ],
86 }, 112 },
87 modifyDataList: [ 113 modifyDataList: [
...@@ -90,6 +116,7 @@ export default { ...@@ -90,6 +116,7 @@ export default {
90 ], 116 ],
91 }; 117 };
92 }, 118 },
119 +
93 watch: { 120 watch: {
94 showDialog(val) { 121 showDialog(val) {
95 if (val) { 122 if (val) {
...@@ -98,6 +125,16 @@ export default { ...@@ -98,6 +125,16 @@ export default {
98 this.batchModifyFormData.modifyContent = ""; 125 this.batchModifyFormData.modifyContent = "";
99 } 126 }
100 }, 127 },
128 + "batchModifyFormData.modifyData"(newVal, oldVal) {
129 + this.$set(this.batchModifyFormRules, "modifyContent", [
130 + {
131 + required: true,
132 + message:
133 + newVal !== "TRANSPORT_MODE" ? "请输入修改内容" : "请选择运输方式",
134 + trigger: "blur",
135 + },
136 + ]);
137 + },
101 }, 138 },
102 created() { 139 created() {
103 this.getModifyDataList(); 140 this.getModifyDataList();
......
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
252 class="entrySaveButton" 252 class="entrySaveButton"
253 size="small" 253 size="small"
254 icon="el-icon-download" 254 icon="el-icon-download"
255 - v-loading="loadings.exportDeclareLoading" 255 + v-loading="isPolling || loadings.exportDeclareLoading"
256 @click="downloadData" 256 @click="downloadData"
257 > 257 >
258 导出 258 导出
...@@ -466,14 +466,35 @@ ...@@ -466,14 +466,35 @@
466 </el-tooltip> 466 </el-tooltip>
467 </template> 467 </template>
468 </vxe-column> 468 </vxe-column>
469 - <vxe-column field="flightNumber" title="航班号" width="80"></vxe-column> 469 + <vxe-column
470 + field="flightNumber"
471 + title="航班航次号"
472 + width="110"
473 + ></vxe-column>
474 + <vxe-column
475 + field="exportPortCode"
476 + title="出口口岸"
477 + width="110"
478 + ></vxe-column>
479 + <vxe-column
480 + field="transportModeName"
481 + title="运输方式"
482 + width="110"
483 + ></vxe-column>
484 + <vxe-column
485 + field="transportVehicleName"
486 + title="运输工具名称"
487 + width="110"
488 + ></vxe-column>
470 <vxe-column 489 <vxe-column
471 field="regulatoryVenueCode" 490 field="regulatoryVenueCode"
472 title="监管场所代码" 491 title="监管场所代码"
492 + width="110"
473 ></vxe-column> 493 ></vxe-column>
474 <vxe-column 494 <vxe-column
475 field="ecomEntName" 495 field="ecomEntName"
476 title="电商企业名称" 496 title="电商企业名称"
497 + width="110"
477 :show-overflow="true" 498 :show-overflow="true"
478 > 499 >
479 <template #default="{ row }"> 500 <template #default="{ row }">
...@@ -492,7 +513,11 @@ ...@@ -492,7 +513,11 @@
492 title="申报业务类型" 513 title="申报业务类型"
493 width="100" 514 width="100"
494 ></vxe-column> 515 ></vxe-column>
495 - <vxe-column field="createTime" title="创建时间"></vxe-column> 516 + <vxe-column
517 + field="createTime"
518 + title="创建时间"
519 + width="150"
520 + ></vxe-column>
496 <vxe-column 521 <vxe-column
497 field="orderReceiptStatus" 522 field="orderReceiptStatus"
498 title="订单回执" 523 title="订单回执"
...@@ -921,7 +946,8 @@ import { ...@@ -921,7 +946,8 @@ import {
921 getLogisticsReceipt, 946 getLogisticsReceipt,
922 getDeclarationLog, 947 getDeclarationLog,
923 arrivalInReceipt, 948 arrivalInReceipt,
924 - exportDeclareData, 949 + getSubmitExportTask,
950 + getTaskStatus,
925 } from "@/api/declareData-api.js"; 951 } from "@/api/declareData-api.js";
926 import DialogVue from "./dialog.vue"; 952 import DialogVue from "./dialog.vue";
927 import RevokeDialog from "./revokeDialog.vue"; 953 import RevokeDialog from "./revokeDialog.vue";
...@@ -933,6 +959,9 @@ import DataPreview from "./data-preview.vue"; ...@@ -933,6 +959,9 @@ import DataPreview from "./data-preview.vue";
933 import WeightAdjust from "./weight-adjust.vue"; 959 import WeightAdjust from "./weight-adjust.vue";
934 import { getCurrUserPortInfo } from "@/api/system/user.js"; 960 import { getCurrUserPortInfo } from "@/api/system/user.js";
935 import { listStatus, receiptStatus, totalScoreStatus } from "../../utils/dict"; 961 import { listStatus, receiptStatus, totalScoreStatus } from "../../utils/dict";
962 +import axios from "axios";
963 +import { getToken } from "@/utils/auth";
964 +import { formatDateNew } from "../../utils";
936 export default { 965 export default {
937 name: "ReportingData", 966 name: "ReportingData",
938 components: { 967 components: {
...@@ -1045,6 +1074,12 @@ export default { ...@@ -1045,6 +1074,12 @@ export default {
1045 declareId: "", 1074 declareId: "",
1046 data: {}, 1075 data: {},
1047 }, 1076 },
1077 + //
1078 + pollTimer: null, // 定时器实例
1079 + pollInterval: 5000, // 轮询间隔(5秒)
1080 + isPolling: false, // 轮询状态标识
1081 + currentTaskId: null,
1082 + pollCount: 0,
1048 }; 1083 };
1049 }, 1084 },
1050 beforeCreate() {}, 1085 beforeCreate() {},
...@@ -1074,6 +1109,8 @@ export default { ...@@ -1074,6 +1109,8 @@ export default {
1074 watch: { 1109 watch: {
1075 $route(val, oldval) { 1110 $route(val, oldval) {
1076 this.popoverClose(); 1111 this.popoverClose();
1112 + this.popoverClose();
1113 + this.stopPolling(); // 组件销毁前清理定时器
1077 }, 1114 },
1078 }, 1115 },
1079 beforeRouteEnter(to, from, next) { 1116 beforeRouteEnter(to, from, next) {
...@@ -1298,6 +1335,121 @@ export default { ...@@ -1298,6 +1335,121 @@ export default {
1298 console.log(err); 1335 console.log(err);
1299 }); 1336 });
1300 }, 1337 },
1338 + callOtherApi(retryCount = 0) {
1339 + const baseUrl = process.env.VUE_APP_BASE_API;
1340 + console.log(this.currentTaskId);
1341 + axios({
1342 + method: "get",
1343 + url: `${baseUrl}/bus-customer/asyncExport/download/${this.currentTaskId}`,
1344 + responseType: "blob",
1345 + headers: {
1346 + Authorization: "Bearer " + getToken(),
1347 + Ver: process.env.VUE_APP_APIVERSION,
1348 + },
1349 + })
1350 + .then((res) => {
1351 + debugger;
1352 + console.log(res);
1353 + const mimeType =
1354 + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1355 +
1356 + const aLink = document.createElement("a");
1357 + var blob = new Blob([res.data], { type: mimeType });
1358 + if (blob.size < 500) {
1359 + var reader = new FileReader();
1360 + reader.readAsText(blob, "utf-8");
1361 + reader.onloadend = () => {
1362 + // 获取文本内容并将其转换为JSON格式
1363 + if (
1364 + reader.result &&
1365 + reader.result != null &&
1366 + reader.result != ""
1367 + ) {
1368 + if (JSON.parse(reader.result)) {
1369 + debugger;
1370 + let jsonData = JSON.parse(reader.result);
1371 + if (jsonData.code == "10103") {
1372 + // 检查重试次数
1373 + if (retryCount < 50) {
1374 + // 延迟后重试
1375 + setTimeout(() => {
1376 + this.callOtherApi(retryCount + 1);
1377 + }, 5000); // 5秒后重试
1378 + } else {
1379 + this.alertWarningMsg("导出失败");
1380 + this.loadings.exportDeclareLoading = false;
1381 + }
1382 +
1383 + return;
1384 + }
1385 + this.alertWarningMsg(jsonData.message);
1386 + } else {
1387 + this.alertWarningMsg("文件无法下载,请重新生成后再试!");
1388 + }
1389 + } else {
1390 + this.alertWarningMsg("文件无法下载,请重新生成后再试!");
1391 + }
1392 + };
1393 + } else {
1394 + const fileName = `${formatDateNew(new Date())}.xlsx`;
1395 + aLink.href = URL.createObjectURL(blob);
1396 + aLink.setAttribute("download", fileName); // 设置下载文件名称
1397 + document.body.appendChild(aLink);
1398 + aLink.click();
1399 + document.body.removeChild(aLink);
1400 + this.loadings.exportDeclareLoading = false;
1401 + }
1402 + })
1403 + .catch((error) => {
1404 + console.log("失败", error);
1405 + this.loadings.exportDeclareLoading = false;
1406 + });
1407 + },
1408 + // 轮询查询状态
1409 + async pollStatus() {
1410 + try {
1411 + const result = await getTaskStatus({ taskId: this.currentTaskId });
1412 + if (+result.code === 200) {
1413 + // PENDING, PROCESSING, COMPLETED, FAILED
1414 + if (result.data.status === "COMPLETED") {
1415 + this.stopPolling(); // 停止轮询
1416 + await this.callOtherApi(); // 调用其他接口
1417 + } else if (result.data.status === "FAILED") {
1418 + this.stopPolling();
1419 + // this.handleFailure();
1420 + this.alertWarningMsg(result.data.errorMessage);
1421 + } else {
1422 + this.startPolling(); // 启动轮询
1423 + }
1424 + } else {
1425 + this.stopPolling();
1426 + // this.handleFailure();
1427 + }
1428 + // 其他状态继续轮询
1429 + } catch (error) {
1430 + console.error("轮询查询失败:", error);
1431 + this.stopPolling();
1432 + }
1433 + },
1434 +
1435 + // 启动轮询
1436 + startPolling() {
1437 + if (this.isPolling) return;
1438 +
1439 + this.isPolling = true;
1440 + this.pollTimer = setInterval(() => {
1441 + this.pollStatus();
1442 + }, this.pollInterval);
1443 + },
1444 + // 停止轮询
1445 + stopPolling() {
1446 + if (this.pollTimer) {
1447 + clearInterval(this.pollTimer);
1448 + this.pollTimer = null;
1449 + }
1450 + this.isPolling = false;
1451 + this.loadings.exportDeclareLoading = false;
1452 + },
1301 1453
1302 datasDownload(dataSource) { 1454 datasDownload(dataSource) {
1303 let obj = { 1455 let obj = {
...@@ -1314,24 +1466,46 @@ export default { ...@@ -1314,24 +1466,46 @@ export default {
1314 obj.endCreateTime = obj.createTime[1]; 1466 obj.endCreateTime = obj.createTime[1];
1315 } 1467 }
1316 obj.declareId = this.selected.map((item) => item.declareId); 1468 obj.declareId = this.selected.map((item) => item.declareId);
1317 - exportDeclareData(obj) 1469 + const _that = this;
1318 - .then((res) => { 1470 +
1319 - // if (res.code === "200") { 1471 + _that
1320 - // // this.alertSuccessMsg(res.message); 1472 + .$confirm(`正在导出中,请稍候!`, "提示", {
1321 - // } else { 1473 + confirmButtonText: "确定",
1322 - // console.log(res.message); 1474 + cancelButtonText: "取消",
1323 - // this.alertWarningMsg(res.message); 1475 + type: "warning",
1324 - // }
1325 }) 1476 })
1326 - .catch((err) => { 1477 + .then(() => {
1327 - console.log(err); 1478 + getSubmitExportTask(obj)
1328 - this.alertErrorMsg(err); 1479 + .then((res) => {
1480 + if (+res.code === 200) {
1481 + console.log(res);
1482 + _that.currentTaskId = res.data;
1483 + _that.datasExportVisible = false;
1484 + _that.$refs.exportDialog.datasExportVisible = false;
1485 + _that.startPolling();
1486 + }
1487 + })
1488 + .catch((err) => {
1489 + console.log(err);
1490 + });
1329 }) 1491 })
1330 - .finally((res) => { 1492 + .catch(() => {
1331 - this.loadings.exportDeclareLoading = false; 1493 + _that.loadings.exportDeclareLoading = false;
1332 - this.datasExportVisible = false; 1494 + _that.datasExportVisible = false;
1333 - this.$refs.exportDialog.datasExportVisible = false; 1495 + _that.$refs.exportDialog.datasExportVisible = false;
1334 }); 1496 });
1497 +
1498 + // exportDeclareData(obj)
1499 + // .then((res) => {})
1500 + // .catch((err) => {
1501 + // console.log(err);
1502 + // this.alertErrorMsg(err);
1503 + // })
1504 + // .finally((res) => {
1505 + // this.loadings.exportDeclareLoading = false;
1506 + // this.datasExportVisible = false;
1507 + // this.$refs.exportDialog.datasExportVisible = false;
1508 + // });
1335 }, 1509 },
1336 //导出 1510 //导出
1337 downloadData() { 1511 downloadData() {
......