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

下载Excel

上级 10f884cd
......@@ -77,8 +77,13 @@ export default {
setButton() {
for (let i = 0; i < vm.tableData.length; i++) {
vm.tableData[i].index = i;
vm.tableData[i].buttonText = "刷新";
vm.tableData[i].buttonStatus = false;
if(vm.tableData[i].option == false) {
vm.tableData[i].buttonText = "刷新";
vm.tableData[i].buttonStatus = false;
} else {
vm.tableData[i].buttonText = "下载";
vm.tableData[i].buttonStatus = false;
}
}
},
search() {
......@@ -88,45 +93,73 @@ export default {
name:
"浙江省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
time: 1562221264000,
status: 1
status: 1,
option: false,
},
{
id: 233,
name:
"江西省心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
time: 1562221874000,
status: 1
status: 1,
option: false,
},
{
id: 666,
name:
"上海市心脑项目,浙江省杭州市区西湖区,第二人民医院杭州市中医院---",
time: 1562225864000,
status: 1
status: 1,
option: false,
}
];
this.setButton();
},
downLoad() {
console.log('下载Excel');
// 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对象
},
update(row) {
this.$nextTick(function() {
console.log(vm.tableData[row.index]);
let nowTime = vm.totalTime;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
vm.tableData[row.index].buttonStatus = true;
let clock = window.setInterval(() => {
nowTime--;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
if(vm.tableData[row.index].option == true) {
vm.downLoad();
} else {
this.$nextTick(function() {
console.log(vm.tableData[row.index]);
let nowTime = vm.totalTime;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
if (nowTime < 0) {
window.clearInterval(clock);
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
vm.tableData[row.index].buttonText = "刷新";
vm.tableData[row.index].buttonStatus = false; //这里重新开启
}
}, 1000);
});
vm.tableData[row.index].buttonStatus = true;
let clock = window.setInterval(() => {
nowTime--;
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
vm.tableData[row.index].buttonText = nowTime + "s后可以刷新";
if (nowTime < 0) {
window.clearInterval(clock);
vm.tableData[row.index].name = vm.tableData[row.index].name+ ' ';
// vm.tableData[row.index].buttonText = "刷新";
vm.tableData[row.index].buttonStatus = false; //这里重新开启
vm.tableData[row.index].option = Boolean(Math.round(Math.random()));
if(vm.tableData[row.index].option == false) {
vm.tableData[row.index].buttonText = "刷新";
} else {
vm.tableData[row.index].buttonText = "下载";
}
}
}, 1000);
});
}
},
// 更改数据显示数量
handleSizeChange(val) {
......
<template>
<div class="crowd-analysis-wrap">
<el-radio-group class="crowd-radio" v-model="radio" size="small" @change="updateRadio">
<el-radio-group v-show="showData" class="crowd-radio" v-model="radio" size="small" @change="updateRadio">
<el-radio-button label="1">全部用户</el-radio-button>
<el-radio-button label="2">参与项目</el-radio-button>
<el-radio-button label="3">通过项目</el-radio-button>
</el-radio-group>
<div class="chart">
<div class="chart" v-show="showData">
<div class="item" id="education" ref="education"></div>
<div class="item item-right" id="job" ref="job"></div>
<div class="item">
......@@ -53,7 +53,8 @@ export default {
radio: 1,
sexData: [],
projectId: "",
crowdData: {}
crowdData: {},
showData: false,
};
},
created() {
......@@ -96,11 +97,18 @@ export default {
vm.reportGET("report/portal/getPeoplesDetails", req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.showData = true;
this.crowdData = res.data;
this.educationDivision();
this.jobDivision();
this.getSexData();
this.ageDivision();
setTimeout(function() {
vm.educationDivision();
vm.jobDivision();
vm.getSexData();
vm.ageDivision();
},20);
// this.educationDivision();
// this.jobDivision();
// this.getSexData();
// this.ageDivision();
}
});
},
......@@ -123,6 +131,9 @@ export default {
//用户性别分布
getSexData() {
let sexList = this.crowdData.sexList;
if(sexList.length <3) {
return;
}
this.sexData = [
{
src: require("../../assets/image/man.png"),
......
......@@ -58,7 +58,7 @@
<!-- <el-button type="default" size="small" @click="update" v-else>修改范围</el-button> -->
<el-button type="default" size="small" @click="exportExcel">导出明细</el-button>
</div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tabs v-model="activeName" @tab-click="handleClick" :before-leave="beforeLeave">
<el-tab-pane label="参与情况" name="first">
<part-in
ref="childPart"
......@@ -228,6 +228,9 @@ export default {
commonUtil.resizeHeight();
},
methods: {
beforeLeave(activeName, oldActiveName) {
console.log('action',activeName,'oldActive',oldActiveName)
},
handleClick(tab, event) {
//console.log(tab, event);
// if(tab.name == this.activeName) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册