Commit 931d1f05 authored by 罗超's avatar 罗超

1

parent 0d596fed
......@@ -7,6 +7,73 @@
<script>
export default {
name: "App",
methods: {
handle(tag) {
this.apipost(
"/api/Trade/GetFirstShopEnrollResultUrl",
{
UserFlag: tag,
},
(res) => {
if (res.data.resultCode == 1) {
if (res.data.data) {
localStorage.removeItem("fujianTag");
clearInterval(this.timer);
this.$confirm("有下载文件准备完成, 前往下载?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info",
}).then(() => {
this.$router.push("/billboardList");
this.downloadFujian(res.data.data);
});
}
} else {
this.$message.error(res.data.message);
}
}
);
},
downloadFujian(url) {
let a = document.createElement("a");
a.href = this.domainManager().DomainUrl + url;
a.download = "榜单附件.zip";
a.click();
setTimeout(() => {
this.delDownloadMultiplefujian(url);
}, 2000);
},
//删除附件
delDownloadMultiplefujian(url) {
this.apipost(
"/api/Trade/DelFirstShopEnrollZipExport",
{
Url: url,
},
(res) => {
if (res.data.resultCode == 1) {
} else {
this.$message.error(res.data.message);
}
}
);
},
},
mounted() {
let tag = localStorage.getItem("fujianTag");
let that = this;
if (tag) {
this.timer = setInterval(() => {
setTimeout(() => {
that.handle(tag);
}, 0);
}, 5000);
}
},
destroyed() {
clearInterval(this.timer);
},
};
</script>
......
......@@ -23,9 +23,17 @@
size="small"
type="primary"
:disabled="multipleSelection.length === 0"
@click="downloadMultiplefujian"
@click="getDownloadMultiplefujianTag"
:loading="fujianLoading"
>榜单附件导出
>{{ fujianText }}
</el-button>
<el-button
style="float: right; margin-top: -5px; margin-right: 10px"
size="small"
type="primary"
@click="downloadFujian(fujianUrl)"
v-if="showfujianbtn"
>下载附件
</el-button>
</div>
</div>
......@@ -333,9 +341,18 @@ export default {
ListObjectType: [], //面向群体 枚举
multipleSelection: [], //多选
fujianLoading: false,
fujianText: "榜单附件导出",
fujianUrl: "",
timer: null,
showfujianbtn: false,
};
},
created() {
let tag = localStorage.getItem("fujianTag");
if (tag) {
this.fujianLoading = true;
this.fujianText = "附件准备中,请等待";
}
this.getListType(); //榜单类型 枚举
this.getListState(); //榜单状态 枚举
this.getListObject(); //面向群体 枚举
......@@ -487,23 +504,29 @@ export default {
"批量下载榜单报名列表.xls"
);
},
// 导出榜单附件
downloadMultiplefujian() {
// 导出榜单附件准备
getDownloadMultiplefujianTag() {
let that = this;
this.fujianLoading = true;
let ids = this.multipleSelection.map((e) => e.Id).toString();
this.apipost(
"/api/Trade/GetFirstShopEnrollZipExport",
"/api/Trade/GetNewFirstShopEnrollZipExport",
{
ListIds: ids,
},
(res) => {
if (res.data.resultCode == 1) {
this.fujianLoading = false;
let a = document.createElement("a");
a.href = this.domainManager().DomainUrl + res.data.data;
a.download = "榜单附件.zip";
a.click();
// this.delDownloadMultiplefujian(res.data.data);
this.fujianText = "附件准备中,请等待";
localStorage.setItem("fujianTag", res.data.data);
that.downloadMultiplefujian(res.data.data);
clearInterval(this.timer);
this.timer = setInterval(() => {
setTimeout(() => {
console.log("轮询中");
that.downloadMultiplefujian(res.data.data);
}, 0);
}, 10000);
this.$bus.$emit("startLoad", this.downloadMultiplefujian);
} else {
this.fujianLoading = false;
this.$message.error(res.data.message);
......@@ -511,6 +534,50 @@ export default {
}
);
},
// 获取附件url
downloadMultiplefujian(tag) {
this.apipost(
"/api/Trade/GetFirstShopEnrollResultUrl",
{
UserFlag: tag,
},
(res) => {
if (res.data.resultCode == 1) {
if (res.data.data) {
this.fujianLoading = false;
this.fujianText = "榜单附件导出";
localStorage.removeItem("fujianTag");
clearInterval(this.timer);
this.fujianUrl = res.data.data;
if (this.$route.path == "/billboardList") {
this.downloadFujian(res.data.data);
} else {
this.$confirm("有下载文件准备完成, 前往下载?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info",
}).then(() => {
this.$router.push("/billboardList");
this.downloadFujian(this.fujianUrl);
});
}
}
} else {
this.$message.error(res.data.message);
}
}
);
},
downloadFujian(url) {
let a = document.createElement("a");
a.href = this.domainManager().DomainUrl + url;
a.download = "榜单附件.zip";
a.click();
setTimeout(() => {
this.delDownloadMultiplefujian(url);
}, 2000);
},
//删除附件
delDownloadMultiplefujian(url) {
this.apipost(
......
......@@ -15,8 +15,13 @@ import '../static/UE/ueditor.all.js'
import '../static/UE/lang/zh-cn/zh-cn.js'
import '../static/UE/ueditor.parse.min.js'
import Bus from "./plug/bus";
Vue.use(ElementUI);
Vue.use(Bus); // 让插件可以使用vue
import commonUtils from './assets/utils/commonUtils'
Vue.commonUtils = Vue.prototype.$commonUtils = commonUtils
......@@ -25,7 +30,7 @@ Vue.http = Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts
Vue.use(ajaxPlug)
/* eslint-disable no-new */
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment