|
|
@@ -16,6 +16,15 @@
|
|
|
Search
|
|
|
</el-button>
|
|
|
</div>
|
|
|
+ <div class="filter-flex-button">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-download"
|
|
|
+ :loading="logLoading"
|
|
|
+ @click="handleDownloadLog">
|
|
|
+ LOG
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-table
|
|
|
@@ -103,6 +112,7 @@ export default {
|
|
|
search: "",
|
|
|
},
|
|
|
listLoading: true,
|
|
|
+ logLoading: false,
|
|
|
tableList: [],
|
|
|
total: 0,
|
|
|
listQuery: {
|
|
|
@@ -124,6 +134,24 @@ export default {
|
|
|
this.listLoading = true;
|
|
|
this.getList();
|
|
|
},
|
|
|
+ handleDownloadLog() {
|
|
|
+ this.logLoading = true;
|
|
|
+ api.downloadLog().then(res => {
|
|
|
+ if (res && res.size > 0) {
|
|
|
+ const name = 'Log-' + new Date().getTime() + '.log'
|
|
|
+ this.downloadFile(res, name);
|
|
|
+ } else {
|
|
|
+ this.$message.error('Empty files');
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: err
|
|
|
+ })
|
|
|
+ }).finally(() => {
|
|
|
+ this.logLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.listLoading = true
|
|
|
const params = {
|
|
|
@@ -147,6 +175,26 @@ export default {
|
|
|
}).finally(() => {
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
+ },
|
|
|
+ downloadFile(res, fileName) {
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: 'application/pdf;charset=utf-8'
|
|
|
+ })
|
|
|
+ // let href = window.URL.createObjectURL(blob)
|
|
|
+ if ('download' in document.createElement('a')) {
|
|
|
+ // 非IE下载
|
|
|
+ const elink = document.createElement('a')
|
|
|
+ elink.download = fileName
|
|
|
+ elink.style.display = 'none'
|
|
|
+ elink.href = URL.createObjectURL(blob)
|
|
|
+ document.body.appendChild(elink)
|
|
|
+ elink.click()
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
+ document.body.removeChild(elink)
|
|
|
+ } else {
|
|
|
+ // IE10+下载
|
|
|
+ navigator.msSaveBlob(blob, fileName)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|