提交 06b4eb67 编写于 作者: zhentian.jia's avatar zhentian.jia

对接exel导出接口

上级 d20e0354
...@@ -23,8 +23,8 @@ export const envConfig = { ...@@ -23,8 +23,8 @@ export const envConfig = {
saasDomainUrl: 'https://dev-saas.yunqueyi.com/', saasDomainUrl: 'https://dev-saas.yunqueyi.com/',
workApiUrl: 'https://dev-work.yunqueyi.com/web', workApiUrl: 'https://dev-work.yunqueyi.com/web',
workApiSrc: 'https://dev-work.yunqueyi.com', workApiSrc: 'https://dev-work.yunqueyi.com',
// reportUrl: 'http://10.177.15.150:10401/', reportUrl: 'http://10.177.15.150:10401/',
reportUrl: 'https://dev-sc-report.yunqueyi.com/', // reportUrl: 'https://dev-sc-report.yunqueyi.com/',
}, },
dev: { dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/', baseUrl: 'https://dev-sc.yunqueyi.com/',
......
...@@ -206,10 +206,12 @@ const vueFilter = { ...@@ -206,10 +206,12 @@ const vueFilter = {
} }
}, },
exportStatus: (value) => { exportStatus: (value) => {
if(value == 1) { if(value == 0) {
return '数据生成中,请稍后---' return '数据生成中,请稍后---';
}else { }else if(value == 1) {
return '文件生成失败请重新操作导出' return '数据生成完成';
} else {
return '文件生成失败 请重新操作导出';
} }
}, },
} }
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<div class="component-content screenSet" id="screenSet"> <div class="component-content screenSet" id="screenSet">
<p>导出文件列表</p> <p>导出文件列表</p>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="名称" align="center" min-width="300"></el-table-column> <el-table-column prop="fileName" label="名称" align="center" min-width="150"></el-table-column>
<el-table-column prop="time" label="时间" align="center" min-width="120"> <el-table-column prop="createdTime" label="时间" align="center" min-width="120">
<template slot-scope="scope">{{ scope.row.time | liveDateFilter }}</template> <template slot-scope="scope">{{ scope.row.createdTime }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="状态" align="center" min-width="150"> <el-table-column prop="status" label="状态" align="center" min-width="150">
<template slot-scope="scope">{{ scope.row.status | exportStatus }}</template> <template slot-scope="scope">{{ scope.row.status | exportStatus }}</template>
...@@ -55,19 +55,21 @@ export default { ...@@ -55,19 +55,21 @@ export default {
return { return {
curmbFirst: "学情报告", curmbFirst: "学情报告",
curmbSecond: "导出下载", curmbSecond: "导出下载",
projectId: '',
tableData: [], tableData: [],
param: { param: {
pageSize: 10, pageSize: 10,
pageNo: 1 pageNo: 1
}, },
totalRows: 0, totalRows: 0,
totalTime: 3 totalTime: 3,
// buttonText: "刷新", // buttonText: "刷新",
// buttonStatus: false, // buttonStatus: false,
}; };
}, },
created() { created() {
vm = this; vm = this;
this.projectId = vm.getUrlSearch(window.location.href, "projectId");
this.search(); this.search();
}, },
mounted: function() { mounted: function() {
...@@ -77,43 +79,47 @@ export default { ...@@ -77,43 +79,47 @@ export default {
setButton() { setButton() {
for (let i = 0; i < vm.tableData.length; i++) { for (let i = 0; i < vm.tableData.length; i++) {
vm.tableData[i].index = i; vm.tableData[i].index = i;
if(vm.tableData[i].option == false) { if(vm.tableData[i].status == 1) {
vm.tableData[i].buttonText = "刷新"; vm.tableData[i].buttonText = "下载";
vm.tableData[i].buttonStatus = false; vm.tableData[i].buttonStatus = false;
} else { } else {
vm.tableData[i].buttonText = "下载"; vm.tableData[i].buttonText = "刷新";
vm.tableData[i].buttonStatus = false; vm.tableData[i].buttonStatus = false;
} }
} }
}, },
search() { search() {
vm.tableData = [ vm.tableData = [
{ // {
id: 123, // id: 123,
name: // fileName:
"浙江省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---", // "浙江省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
time: 1562221264000, // createdTime: 1562221264000,
status: 1, // status: 0,
option: false, // },
}, // {
{ // id: 233,
id: 233, // fileName:
name: // "江西省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
"江西省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---", // createdTime: 1562221874000,
time: 1562221874000, // status: 0,
status: 1, // },
option: false, // {
}, // id: 666,
{ // fileName:
id: 666, // "上海市心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
name: // createdTime: 1562225864000,
"上海市心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---", // status: 0,
time: 1562225864000, // }
status: 1,
option: false,
}
]; ];
this.setButton(); // this.setButton();
let req = {
projectId : vm.projectId,
}
vm.reportGET("report/downLoad/getDownloadList", req).then(res => {
vm.tableData = res.data.data;
vm.setButton();
});
}, },
downLoad() { downLoad() {
console.log('下载Excel'); console.log('下载Excel');
...@@ -129,32 +135,36 @@ export default { ...@@ -129,32 +135,36 @@ export default {
// downloadElement.click() // 点击下载 // downloadElement.click() // 点击下载
// document.body.removeChild(downloadElement) // 下载完成移除元素 // document.body.removeChild(downloadElement) // 下载完成移除元素
// window.URL.revokeObjectURL(href) // 释放掉blob对象 // window.URL.revokeObjectURL(href) // 释放掉blob对象
},
getDownLoadStatus() {
}, },
update(row) { update(row) {
if(vm.tableData[row.index].option == true) { if(vm.tableData[row.index].status == 1) {
vm.downLoad(); vm.downLoad();
} else { } else {
this.$nextTick(function() { this.$nextTick(function() {
vm.getDownLoadStatus();
console.log(vm.tableData[row.index]); console.log(vm.tableData[row.index]);
let nowTime = vm.totalTime; let nowTime = vm.totalTime;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' '; vm.tableData[row.index].fileName = vm.tableData[row.index].fileName+ ' ';
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新"; vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
vm.tableData[row.index].buttonStatus = true; vm.tableData[row.index].buttonStatus = true;
let clock = window.setInterval(() => { let clock = window.setInterval(() => {
nowTime--; nowTime--;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' '; vm.tableData[row.index].fileName = vm.tableData[row.index].fileName+ ' ';
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新"; vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
if (nowTime < 0) { if (nowTime < 0) {
window.clearInterval(clock); window.clearInterval(clock);
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' '; vm.tableData[row.index].fileName = vm.tableData[row.index].fileName+ ' ';
// vm.tableData[row.index].buttonText = "刷新"; // vm.tableData[row.index].buttonText = "刷新";
vm.tableData[row.index].buttonStatus = false; //这里重新开启 vm.tableData[row.index].buttonStatus = false; //这里重新开启
vm.tableData[row.index].option = Boolean(Math.round(Math.random())); vm.tableData[row.index].status = Boolean(Math.round(Math.random()));
if(vm.tableData[row.index].option == false) { if(vm.tableData[row.index].status == 1) {
vm.tableData[row.index].buttonText = "刷新";
} else {
vm.tableData[row.index].buttonText = "下载"; vm.tableData[row.index].buttonText = "下载";
} else {
vm.tableData[row.index].buttonText = "刷新";
} }
} }
}, 1000); }, 1000);
......
...@@ -437,7 +437,10 @@ export default { ...@@ -437,7 +437,10 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
}, },
toDownload() { toDownload() {
vm.$router.push({ path: "export-download" }); let routerData = {
projectId : vm.projectId,
};
vm.$router.push({ path: "export-download", query: routerData });
}, },
update() {}, update() {},
release() {}, release() {},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册