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

1

parent 0d596fed
...@@ -7,6 +7,73 @@ ...@@ -7,6 +7,73 @@
<script> <script>
export default { export default {
name: "App", 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> </script>
......
...@@ -23,9 +23,17 @@ ...@@ -23,9 +23,17 @@
size="small" size="small"
type="primary" type="primary"
:disabled="multipleSelection.length === 0" :disabled="multipleSelection.length === 0"
@click="downloadMultiplefujian" @click="getDownloadMultiplefujianTag"
:loading="fujianLoading" :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> </el-button>
</div> </div>
</div> </div>
...@@ -333,9 +341,18 @@ export default { ...@@ -333,9 +341,18 @@ export default {
ListObjectType: [], //面向群体 枚举 ListObjectType: [], //面向群体 枚举
multipleSelection: [], //多选 multipleSelection: [], //多选
fujianLoading: false, fujianLoading: false,
fujianText: "榜单附件导出",
fujianUrl: "",
timer: null,
showfujianbtn: false,
}; };
}, },
created() { created() {
let tag = localStorage.getItem("fujianTag");
if (tag) {
this.fujianLoading = true;
this.fujianText = "附件准备中,请等待";
}
this.getListType(); //榜单类型 枚举 this.getListType(); //榜单类型 枚举
this.getListState(); //榜单状态 枚举 this.getListState(); //榜单状态 枚举
this.getListObject(); //面向群体 枚举 this.getListObject(); //面向群体 枚举
...@@ -487,23 +504,29 @@ export default { ...@@ -487,23 +504,29 @@ export default {
"批量下载榜单报名列表.xls" "批量下载榜单报名列表.xls"
); );
}, },
// 导出榜单附件 // 导出榜单附件准备
downloadMultiplefujian() { getDownloadMultiplefujianTag() {
let that = this;
this.fujianLoading = true; this.fujianLoading = true;
let ids = this.multipleSelection.map((e) => e.Id).toString(); let ids = this.multipleSelection.map((e) => e.Id).toString();
this.apipost( this.apipost(
"/api/Trade/GetFirstShopEnrollZipExport", "/api/Trade/GetNewFirstShopEnrollZipExport",
{ {
ListIds: ids, ListIds: ids,
}, },
(res) => { (res) => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.fujianLoading = false; this.fujianText = "附件准备中,请等待";
let a = document.createElement("a"); localStorage.setItem("fujianTag", res.data.data);
a.href = this.domainManager().DomainUrl + res.data.data; that.downloadMultiplefujian(res.data.data);
a.download = "榜单附件.zip"; clearInterval(this.timer);
a.click(); this.timer = setInterval(() => {
// this.delDownloadMultiplefujian(res.data.data); setTimeout(() => {
console.log("轮询中");
that.downloadMultiplefujian(res.data.data);
}, 0);
}, 10000);
this.$bus.$emit("startLoad", this.downloadMultiplefujian);
} else { } else {
this.fujianLoading = false; this.fujianLoading = false;
this.$message.error(res.data.message); this.$message.error(res.data.message);
...@@ -511,6 +534,50 @@ export default { ...@@ -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) { delDownloadMultiplefujian(url) {
this.apipost( this.apipost(
......
...@@ -15,8 +15,13 @@ import '../static/UE/ueditor.all.js' ...@@ -15,8 +15,13 @@ import '../static/UE/ueditor.all.js'
import '../static/UE/lang/zh-cn/zh-cn.js' import '../static/UE/lang/zh-cn/zh-cn.js'
import '../static/UE/ueditor.parse.min.js' import '../static/UE/ueditor.parse.min.js'
import Bus from "./plug/bus";
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(Bus); // 让插件可以使用vue
import commonUtils from './assets/utils/commonUtils' import commonUtils from './assets/utils/commonUtils'
Vue.commonUtils = Vue.prototype.$commonUtils = commonUtils Vue.commonUtils = Vue.prototype.$commonUtils = commonUtils
...@@ -25,7 +30,7 @@ Vue.http = Vue.prototype.$http = axios ...@@ -25,7 +30,7 @@ Vue.http = Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
Vue.use(ajaxPlug) Vue.use(ajaxPlug)
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
router, 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