|
@@ -361,7 +361,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { detailExcel, excelType, tabLazytree, getWbsTypeList, wbstree, selectByNodeTable, Excelmodify, uploadExcel, deleteExcelshu, deleteExcel ,tabLazytreeAll,
|
|
|
- uploadcoverfileExcel} from '@/api/exctab/excelmodel'
|
|
|
+ uploadcoverfileExcel,downExcelFile} from '@/api/exctab/excelmodel'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
@@ -637,8 +637,18 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
downloadExcel () {//下载excel表
|
|
|
- this.downFile(this.from.fileUrl,"123456.xlsx");
|
|
|
- // window.open(this.from.fileUrl,'namexxx')
|
|
|
+ //this.downFile(this.from.fileUrl,"123456.xlsx");
|
|
|
+ //window.open(this.from.fileUrl,'namexxx')
|
|
|
+ const link = document.createElement('a')
|
|
|
+ downExcelFile(this.from.id).then((res)=>{
|
|
|
+ // 创建Blob对象,设置文件类型
|
|
|
+ let blob = new Blob([res.data], {type: "application/vnd.ms-excel"})
|
|
|
+ let objectUrl = URL.createObjectURL(blob) // 创建URL
|
|
|
+ link.href = objectUrl
|
|
|
+ link.download = this.from.extension // 自定义文件名
|
|
|
+ link.click() // 下载文件
|
|
|
+ URL.revokeObjectURL(objectUrl); // 释放内存
|
|
|
+ })
|
|
|
},
|
|
|
//#endregion
|
|
|
|