Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/UBCS-WEB/src/util/func.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -120,6 +120,22 @@ mounted() { }, methods: { handlerFile(res){ let reader = new FileReader(); reader.readAsText(res.data); reader.onload = (result) =>{ try { let resData = JSON.parse(result.target.result); // 解析对象成功 if (resData.code != 200) { this.$message.error(resData.msg); } } catch (err) { // console.log("err",err)// 解析成对象失败,说明是正常的文件流 func.downloadFileByBlobHandler(res); this.$message.success('下载成功,请查看!'); } }; }, escHandler() { this.$emit('update:visible', false); this.value = []; @@ -157,10 +173,8 @@ 'conditionMap[oid]': this.ids, ...this.exportArrTwo, limit: -1 }).then(res => { if (res) { func.downloadFileByBlobHandler(res); this.escHandler() } this.handlerFile(res); this.escHandler(); }) } else { @@ -169,10 +183,9 @@ 'conditionMap[oid]': this.ids, ...this.exportArr }).then(res => { // console.log('res',res) if (res) { func.downloadFileByBlobHandler(res); this.escHandler() } this.handlerFile(res); this.escHandler(); }) } @@ -186,15 +199,13 @@ exportCode({codeClassifyOid: this.codeClassifyOid, ...this.exportArrTwo, limit: -1}).then(res => { if (res) { func.downloadFileByBlobHandler(res); this.escHandler() this.escHandler(); } }) } else { exportCode({codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: -1}).then(res => { if (res) { func.downloadFileByBlobHandler(res); this.escHandler() } this.handlerFile(res); this.escHandler(); }) } } else if (this.radio === 2) { @@ -230,10 +241,9 @@ endPage: end }).then((res) => { // console.log('res',res) if (res) { func.downloadFileByBlobHandler(res); this.escHandler() } this.handlerFile(res); this.escHandler(); }); } else { this.tableHeadData.map(item => item.prop) @@ -246,11 +256,9 @@ page: start, endPage: end }).then(res => { // console.log('res',res) if (res) { func.downloadFileByBlobHandler(res); this.escHandler() } console.log('res',res) this.handlerFile(res); this.escHandler(); }) } } Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -578,19 +578,25 @@ exportGroupCodeExcel({ codeClassifyOid: this.codeClassifyOid, }).then(res => { console.log(res) if (res) { let reader = new FileReader(); reader.readAsText(res.data) reader.onload = (result) =>{ try { let resData = JSON.parse(result.target.result); // 解析对象成功 if (!resData.success) { console.log("resData",resData) this.$message.error(resData.msg); this.isLoading = false; } } catch (err) { // console.log("err",err)// 解析成对象失败,说明是正常的文件流 func.downloadFileByBlobHandler(res); this.$message.success('下载成功,请查看!'); this.isLoading = false; } }).catch(error => { console.log(error) if (error) { this.$message.error('请查看下载的错误文件!'); } this.isLoading = false; }) }; }); }, //标准申请 codeApplyHandler() { Source/UBCS-WEB/src/util/func.js
@@ -133,6 +133,7 @@ * @returns {Boolean} */ static downloadFileByBlobHandler(res) { if(res.headers['content-disposition']){ const fileNames = res.headers['content-disposition'].split(";"); let characterSet = fileNames[2].split("filename*=")[1]; let fileName = decodeURI(fileNames[1].split("filename=")[1],characterSet); // 下载的文件名 @@ -148,6 +149,7 @@ document.body.removeChild(link); //删除下载 window.URL.revokeObjectURL(url); //释放掉blob对象 } } /** * 获取流文件进行文件下