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

下载Excel

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