|
@@ -1099,38 +1099,40 @@ export default {
|
|
|
},
|
|
|
params: this.getSearchForm(),
|
|
|
url,
|
|
|
- responseType: "blob",
|
|
|
+ // responseType: "blob",
|
|
|
};
|
|
|
this.$confirm("您确定导出报表", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
})
|
|
|
- .then(() => {
|
|
|
+ .then((data) => {
|
|
|
load.startLoading();
|
|
|
axios(options)
|
|
|
.then((res) => {
|
|
|
- let blob = new Blob([res.data], {
|
|
|
- // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
|
- type: "application/vnd.ms-excel;charset=utf-8",
|
|
|
- //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
|
- });
|
|
|
- let text = new Response(blob).text();
|
|
|
- text.then((res) => {
|
|
|
- // 判断是否报错
|
|
|
- if (res.indexOf("code") != -1) {
|
|
|
- let json = JSON.parse(res);
|
|
|
- this.$message.error(json.msg);
|
|
|
- } else {
|
|
|
- let objectUrl = URL.createObjectURL(blob);
|
|
|
- let link = document.createElement("a");
|
|
|
- let fname = "课表列表" + new Date().getTime() + ".xls"; //下载文件的名字
|
|
|
- link.href = objectUrl;
|
|
|
- link.setAttribute("download", fname);
|
|
|
- document.body.appendChild(link);
|
|
|
- link.click();
|
|
|
- }
|
|
|
- });
|
|
|
+ console.log(res)
|
|
|
+ this.$message.success(res.data.data)
|
|
|
+ // let blob = new Blob([res.data], {
|
|
|
+ // // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
|
+ // type: "application/vnd.ms-excel;charset=utf-8",
|
|
|
+ // //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
|
+ // });
|
|
|
+ // let text = new Response(blob).text();
|
|
|
+ // text.then((res) => {
|
|
|
+ // // 判断是否报错
|
|
|
+ // if (res.indexOf("code") != -1) {
|
|
|
+ // let json = JSON.parse(res);
|
|
|
+ // this.$message.error(json.msg);
|
|
|
+ // } else {
|
|
|
+ // let objectUrl = URL.createObjectURL(blob);
|
|
|
+ // let link = document.createElement("a");
|
|
|
+ // let fname = "课表列表" + new Date().getTime() + ".xls"; //下载文件的名字
|
|
|
+ // link.href = objectUrl;
|
|
|
+ // link.setAttribute("download", fname);
|
|
|
+ // document.body.appendChild(link);
|
|
|
+ // link.click();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
load.endLoading();
|
|
|
})
|
|
|
.catch((error) => {
|