|
@@ -8,7 +8,7 @@
|
|
|
type="date"
|
|
|
placeholder="选择日期" @change="getSheetDetail">
|
|
|
</el-date-picker>
|
|
|
- <el-button type="text" @click="downloadSheet">下载</el-button>
|
|
|
+ <el-button type="text" @click="downloadSheet" :loading="isDownload">下载</el-button>
|
|
|
</div>
|
|
|
<div class="table-box">
|
|
|
<div class="sheet-wrap">
|
|
@@ -34,7 +34,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
sheetDetailInfo:{},
|
|
|
- selectDate:''
|
|
|
+ selectDate:'',
|
|
|
+ exportBase: process.env.VUE_APP_API_ROOT + " /meeting_probabilities/detail", //数据导出接口
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -54,24 +55,27 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
downloadSheet(){
|
|
|
- const {FileUrl} = this.sheetDetailInfo
|
|
|
- if(!FileUrl){
|
|
|
+ if(!this.sheetDetailInfo.MeetingInfoId){
|
|
|
this.$message.warning("暂无下载文件")
|
|
|
return
|
|
|
}
|
|
|
- const fileType = FileUrl.split('.')[1]
|
|
|
- const x = new XMLHttpRequest()
|
|
|
- x.open('GET', FileUrl, true)
|
|
|
- x.responseType = 'blob'
|
|
|
- x.onload = () => {
|
|
|
- const url = window.URL.createObjectURL(x.response)
|
|
|
- let a = document.createElement('a')
|
|
|
- a.href = url
|
|
|
- a.download=`联储观察${this.selectDate}.${fileType}`
|
|
|
- a.click();
|
|
|
- window.URL.revokeObjectURL(url)
|
|
|
- }
|
|
|
- x.send()
|
|
|
+ const exportApi = this.exportBase
|
|
|
+ +`?${localStorage.getItem("auth") || ""}`
|
|
|
+ +`&DateTime=${this.selectDate}`
|
|
|
+ +`&IsExport=1`
|
|
|
+
|
|
|
+ this.isDownload = true;
|
|
|
+ const link = document.createElement("a");
|
|
|
+ link.href = this.escapeStr(exportApi);
|
|
|
+ link.download = "";
|
|
|
+ link.click();
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isDownload = false;
|
|
|
+ }, 5000);
|
|
|
+ },
|
|
|
+ // 对[#,;]转义
|
|
|
+ escapeStr(str) {
|
|
|
+ return str.replace(/#/g, escape("#")).replace(/;/g, escape(";"));
|
|
|
},
|
|
|
initSheet(){
|
|
|
const baseOption = this.sheetDetailInfo.Content ? JSON.parse(this.sheetDetailInfo.Content) : {}
|