|
@@ -1,7 +1,7 @@
|
|
|
<script>
|
|
|
import { dicts } from "./dicts";
|
|
|
import useColumns from "./columns";
|
|
|
-import { LIST, mbDownload } from "@/api/business/purchase/apply";
|
|
|
+import { LIST, mbDownload, failDownload} from "@/api/business/purchase/apply";
|
|
|
// 导入的token
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
|
|
@@ -127,7 +127,27 @@ export default {
|
|
|
this.upload.open = false;
|
|
|
this.upload.isUploading = false;
|
|
|
this.$refs.upload.clearFiles();
|
|
|
- this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
+ this.$alert(response.data.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
+ // 有失败的再次下载下来
|
|
|
+ if(response.data.flag) {
|
|
|
+ this.$modal.loading("正在下载导入失败数据,请稍后...");
|
|
|
+ failDownload({failDatas:response.data.datas}).then(res => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
+ });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
+ const downloadElement = document.createElement("a"); //创建a标签
|
|
|
+ const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
+ downloadElement.href = href; //下载地址
|
|
|
+ downloadElement.download = '价格申报单导入失败数据' + this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
|
|
|
+ document.body.appendChild(downloadElement);
|
|
|
+ downloadElement.click(); // 点击下载
|
|
|
+ document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
+ }).catch(err => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ })
|
|
|
+ }
|
|
|
this.useQuery(this.params, this.page);
|
|
|
},
|
|
|
errorFile(err) {
|