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

文件导出问题

上级 17e492da
...@@ -24,8 +24,8 @@ export const envConfig = { ...@@ -24,8 +24,8 @@ export const envConfig = {
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: 'http://192.168.140.13:10401/', // reportUrl: 'http://192.168.140.13: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/',
......
...@@ -4,7 +4,13 @@ ...@@ -4,7 +4,13 @@
<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="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"> <el-table-column prop="createdTime" label="时间" align="center" min-width="120">
<template slot-scope="scope">{{ scope.row.createdTime }}</template> <template slot-scope="scope">{{ scope.row.createdTime }}</template>
</el-table-column> </el-table-column>
...@@ -23,7 +29,7 @@ ...@@ -23,7 +29,7 @@
</el-table-column> </el-table-column>
<div slot="empty"> <div slot="empty">
<div class="table-empty"> <div class="table-empty">
<img src="../../assets/image/no-content1.png"> <img src="../../assets/image/no-content1.png" />
<p>没有相关数据,请重新选择查询范围</p> <p>没有相关数据,请重新选择查询范围</p>
</div> </div>
</div> </div>
...@@ -46,6 +52,8 @@ ...@@ -46,6 +52,8 @@
<script> <script>
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils/utils";
import { openLoading, closeLoading } from "../../utils/utils";
import axios from "axios";
let vm = null; let vm = null;
export default { export default {
components: { components: {
...@@ -55,7 +63,7 @@ export default { ...@@ -55,7 +63,7 @@ export default {
return { return {
curmbFirst: "学情报告", curmbFirst: "学情报告",
curmbSecond: "导出下载", curmbSecond: "导出下载",
projectId: '', projectId: "",
tableData: [], tableData: [],
param: { param: {
pageSize: 10, pageSize: 10,
...@@ -63,6 +71,7 @@ export default { ...@@ -63,6 +71,7 @@ export default {
}, },
totalRows: 0, totalRows: 0,
totalTime: 3, totalTime: 3,
queryData: {}
// buttonText: "刷新", // buttonText: "刷新",
// buttonStatus: false, // buttonStatus: false,
}; };
...@@ -79,7 +88,7 @@ export default { ...@@ -79,7 +88,7 @@ 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].status == 1) { 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 {
...@@ -91,8 +100,8 @@ export default { ...@@ -91,8 +100,8 @@ export default {
search() { search() {
// this.setButton(); // this.setButton();
let req = { let req = {
projectId : vm.projectId, projectId: vm.projectId
} };
vm.reportGET("report/downLoad/getDownloadList", req).then(res => { vm.reportGET("report/downLoad/getDownloadList", req).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
vm.tableData = res.data.data; vm.tableData = res.data.data;
...@@ -101,59 +110,60 @@ export default { ...@@ -101,59 +110,60 @@ export default {
} }
}); });
}, },
downLoad() { downLoad(row) {
console.log('下载Excel'); // 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 = ''; setTimeout(() => {
// let fileName = '文件'; window.open(row.fileUrl);
// let blob = new Blob([url], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' }) // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet这里表示xlsx类型 }, 500);
// 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对象
}, },
getDownLoadStatus(row) { getDownLoadStatus(row) {
let req = { let req = {
id : row.id, id: row.id
} };
vm.reportGET("report/downLoad/getDownLoadStatus", req).then(res => { vm.reportGET("report/downLoad/getDownLoadStatus", req).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
vm.tableData[row.index].status = res.data.data; vm.tableData[row.index].status = res.data.data;
// console.log('res.data.data',res.data.data); // console.log('res.data.data',res.data.data);
if(res.data.data == 1) { if (res.data.data == 1) {
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].buttonText = "下载";
} else { } else {
console.log('res',res,vm.tableData[row.index]); console.log("res", res, vm.tableData[row.index]);
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].buttonText = "刷新";
} }
} }
}); });
}, },
update(row) { update(row) {
if(vm.tableData[row.index].status == 1) { if (vm.tableData[row.index].status == 1) {
vm.downLoad(); vm.downLoad(row);
} else { } else {
this.$nextTick(function() { this.$nextTick(function() {
// vm.getDownLoadStatus(row); // vm.getDownLoadStatus(row);
console.log(vm.tableData[row.index]); console.log(vm.tableData[row.index]);
let nowTime = vm.totalTime; 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].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].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].buttonText = nowTime + "s后可以刷新";
if (nowTime <= 0) { if (nowTime <= 0) {
window.clearInterval(clock); 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].buttonText = "刷新";
vm.tableData[row.index].buttonStatus = false; //这里重新开启 vm.tableData[row.index].buttonStatus = false; //这里重新开启
vm.getDownLoadStatus(row); vm.getDownLoadStatus(row);
......
...@@ -180,8 +180,8 @@ export default { ...@@ -180,8 +180,8 @@ export default {
routerData.tableType = 1; routerData.tableType = 1;
routerData.courseId = data.courseId; routerData.courseId = data.courseId;
routerData.ids = operationData.getIds(vm.formInline,vm.organizationList,checkAll); routerData.ids = operationData.getIds(vm.formInline,vm.organizationList,checkAll);
routerData.type = operationData.getSearchType(vm.formInline,checkAll), routerData.type = operationData.getSearchType(vm.formInline,checkAll);
routerData.originalFlag = vm.formInline.checked == false ? 0 : 1 routerData.originalFlag = vm.formInline.checked == false ? 0 : 1;
this.$router.push({ path: '/name-list', query: routerData}); this.$router.push({ path: '/name-list', query: routerData});
}, },
......
...@@ -149,6 +149,7 @@ export default { ...@@ -149,6 +149,7 @@ export default {
curmbFirst: "学情报告", curmbFirst: "学情报告",
curmbSecond: "项目列表", curmbSecond: "项目列表",
projectId: "", projectId: "",
projectName: "",
organizationList: [], organizationList: [],
optionsRegion: [], optionsRegion: [],
props: { props: {
...@@ -453,11 +454,48 @@ export default { ...@@ -453,11 +454,48 @@ export default {
} }
}, },
exportExcel() { exportExcel() {
if (vm.formInline.region.length == 0) {
vm.$message("请选择地区");
return;
}
this.dialogVisible = true; 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() { toDownload() {
let checkAll = operationData.hasAll(vm.formInline.organization)
let routerData = { let routerData = {
projectId : vm.projectId, 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 }); vm.$router.push({ path: "export-download", query: routerData });
}, },
......
...@@ -176,7 +176,11 @@ export default { ...@@ -176,7 +176,11 @@ export default {
}, },
//跳转到报告详情页 //跳转到报告详情页
go(row) { 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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册