提交 8a590ebc 编写于 作者: zhentian.jia's avatar zhentian.jia

文件导出问题

上级 17e492da
......@@ -24,8 +24,8 @@ export const envConfig = {
workApiUrl: 'https://dev-work.yunqueyi.com/web',
workApiSrc: 'https://dev-work.yunqueyi.com',
// reportUrl: 'http://10.177.15.150:10401/',
reportUrl: 'http://192.168.140.13:10401/',
// reportUrl: 'https://dev-sc-report.yunqueyi.com/',
// reportUrl: 'http://192.168.140.13:10401/',
reportUrl: 'https://dev-sc-report.yunqueyi.com/',
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/',
......
......@@ -4,7 +4,13 @@
<div class="component-content screenSet" id="screenSet">
<p>导出文件列表</p>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="title" label="名称" align="center" min-width="150" show-overflow-tooltip></el-table-column>
<el-table-column
prop="title"
label="名称"
align="center"
min-width="150"
show-overflow-tooltip
></el-table-column>
<el-table-column prop="createdTime" label="时间" align="center" min-width="120">
<template slot-scope="scope">{{ scope.row.createdTime }}</template>
</el-table-column>
......@@ -23,7 +29,7 @@
</el-table-column>
<div slot="empty">
<div class="table-empty">
<img src="../../assets/image/no-content1.png">
<img src="../../assets/image/no-content1.png" />
<p>没有相关数据,请重新选择查询范围</p>
</div>
</div>
......@@ -46,6 +52,8 @@
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import * as commonUtil from "../../utils/utils";
import { openLoading, closeLoading } from "../../utils/utils";
import axios from "axios";
let vm = null;
export default {
components: {
......@@ -55,7 +63,7 @@ export default {
return {
curmbFirst: "学情报告",
curmbSecond: "导出下载",
projectId: '',
projectId: "",
tableData: [],
param: {
pageSize: 10,
......@@ -63,6 +71,7 @@ export default {
},
totalRows: 0,
totalTime: 3,
queryData: {}
// buttonText: "刷新",
// buttonStatus: false,
};
......@@ -79,7 +88,7 @@ export default {
setButton() {
for (let i = 0; i < vm.tableData.length; i++) {
vm.tableData[i].index = i;
if(vm.tableData[i].status == 1) {
if (vm.tableData[i].status == 1) {
vm.tableData[i].buttonText = "下载";
vm.tableData[i].buttonStatus = false;
} else {
......@@ -91,8 +100,8 @@ export default {
search() {
// this.setButton();
let req = {
projectId : vm.projectId,
}
projectId: vm.projectId
};
vm.reportGET("report/downLoad/getDownloadList", req).then(res => {
if (res.code == "000000") {
vm.tableData = res.data.data;
......@@ -101,59 +110,60 @@ export default {
}
});
},
downLoad() {
console.log('下载Excel');
downLoad(row) {
// vm.queryData = this.$route.query;
// let req = vm.queryData;
// openLoading(vm);
// vm.reportGET("report/downLoad/downLoad", req).then(res => {
// closeLoading(vm);
// // console
// if (res.code == "000000") {
// }
// });
// let url = '';
// let fileName = '文件';
// let blob = new Blob([url], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' }) // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet这里表示xlsx类型
// let downloadElement = document.createElement('a')
// let href = window.URL.createObjectURL(blob) // 创建下载的链接
// downloadElement.href = href
// downloadElement.download = typeof fileName !== 'undefined' ? fileName + '.xls' : new Date().getTime() + '.xls' // 下载后文件名
// document.body.appendChild(downloadElement)
// downloadElement.click() // 点击下载
// document.body.removeChild(downloadElement) // 下载完成移除元素
// window.URL.revokeObjectURL(href) // 释放掉blob对象
setTimeout(() => {
window.open(row.fileUrl);
}, 500);
},
getDownLoadStatus(row) {
let req = {
id : row.id,
}
id: row.id
};
vm.reportGET("report/downLoad/getDownLoadStatus", req).then(res => {
if (res.code == "000000") {
vm.tableData[row.index].status = res.data.data;
// console.log('res.data.data',res.data.data);
if(res.data.data == 1) {
vm.tableData[row.index].title = vm.tableData[row.index].title+ ' ';
if (res.data.data == 1) {
vm.tableData[row.index].title = vm.tableData[row.index].title + " ";
vm.tableData[row.index].buttonText = "下载";
} else {
console.log('res',res,vm.tableData[row.index]);
vm.tableData[row.index].title = vm.tableData[row.index].title+ ' ';
console.log("res", res, vm.tableData[row.index]);
vm.tableData[row.index].title = vm.tableData[row.index].title + " ";
vm.tableData[row.index].buttonText = "刷新";
}
}
});
},
update(row) {
if(vm.tableData[row.index].status == 1) {
vm.downLoad();
if (vm.tableData[row.index].status == 1) {
vm.downLoad(row);
} else {
this.$nextTick(function() {
// vm.getDownLoadStatus(row);
console.log(vm.tableData[row.index]);
let nowTime = vm.totalTime;
vm.tableData[row.index].title = vm.tableData[row.index].title+ ' ';
vm.tableData[row.index].title = vm.tableData[row.index].title + " ";
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
vm.tableData[row.index].buttonStatus = true;
let clock = window.setInterval(() => {
nowTime--;
vm.tableData[row.index].title = vm.tableData[row.index].title+ ' ';
vm.tableData[row.index].title = vm.tableData[row.index].title + " ";
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
if (nowTime <= 0) {
window.clearInterval(clock);
vm.tableData[row.index].title = vm.tableData[row.index].title+ ' ';
vm.tableData[row.index].title =
vm.tableData[row.index].title + " ";
// vm.tableData[row.index].buttonText = "刷新";
vm.tableData[row.index].buttonStatus = false; //这里重新开启
vm.getDownLoadStatus(row);
......
......@@ -180,8 +180,8 @@ export default {
routerData.tableType = 1;
routerData.courseId = data.courseId;
routerData.ids = operationData.getIds(vm.formInline,vm.organizationList,checkAll);
routerData.type = operationData.getSearchType(vm.formInline,checkAll),
routerData.originalFlag = vm.formInline.checked == false ? 0 : 1
routerData.type = operationData.getSearchType(vm.formInline,checkAll);
routerData.originalFlag = vm.formInline.checked == false ? 0 : 1;
this.$router.push({ path: '/name-list', query: routerData});
},
......
......@@ -149,6 +149,7 @@ export default {
curmbFirst: "学情报告",
curmbSecond: "项目列表",
projectId: "",
projectName: "",
organizationList: [],
optionsRegion: [],
props: {
......@@ -453,11 +454,48 @@ export default {
}
},
exportExcel() {
if (vm.formInline.region.length == 0) {
vm.$message("请选择地区");
return;
}
this.dialogVisible = true;
let checkAll = operationData.hasAll(vm.formInline.organization)
let req = {
projectId : vm.projectId,
ids: operationData.getIds(vm.formInline,vm.organizationList,checkAll),
type: operationData.getSearchType(vm.formInline,checkAll),
originalFlag: vm.formInline.checked == false ? 0 : 1,
projectName: vm.$route.query.projectName,
cityName: vm.getCityName(),
};
openLoading(vm);
vm.reportGET("report/downLoad/downLoad", req).then(res => {
closeLoading(vm);
// console
if (res.code == "000000") {
}
});
},
getCityName() {
let city = '';
let region = vm.dialogData.region;
console.log('region',region,typeof region,region == '');
if(region != '') {
city = region.split(' / ').join('');
console.log('city',city);
}
return city;
},
toDownload() {
let checkAll = operationData.hasAll(vm.formInline.organization)
let routerData = {
projectId : vm.projectId,
// ids: operationData.getIds(vm.formInline,vm.organizationList,checkAll),
// type: operationData.getSearchType(vm.formInline,checkAll),
// originalFlag: vm.formInline.checked == false ? 0 : 1,
// projectName: vm.$route.query.projectName,
// cityName: vm.getCityName(),
};
vm.$router.push({ path: "export-download", query: routerData });
},
......
......@@ -176,7 +176,11 @@ export default {
},
//跳转到报告详情页
go(row) {
vm.$router.push({ path: "/item-list?id=" + row.id, params: row });
let routerData = {
id: row.id,
projectName: row.projectName,
};
vm.$router.push({ path: "/item-list" , query: routerData });
}
}
};
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册