修改主页界面

This commit is contained in:
ival 2019-08-16 16:55:16 +08:00
parent 25e3cb19a4
commit 483f7ac12b

View File

@ -2,7 +2,7 @@
<div> <div>
<div :id="id" :style="{height: size.height+'px', width: size.width+'px'}" /> <div :id="id" :style="{height: size.height+'px', width: size.width+'px'}" />
<div class="lesson-select"> <div class="lesson-select">
<el-select v-model="mapName" placeholder="请选择课程" size="mini" style="width: 300px"> <el-select v-model="mapName" placeholder="请选择地图线路" size="mini" style="width: 300px">
<el-option v-for="name in mapNameList" :key="name" :label="name" :value="name" /> <el-option v-for="name in mapNameList" :key="name" :label="name" :value="name" />
</el-select> </el-select>
</div> </div>
@ -32,6 +32,9 @@ export default {
title: { title: {
text: '', text: '',
subtext: '', subtext: '',
subtextStyle: {
color: '#909399'
},
y: 10, y: 10,
left: 'center', left: 'center',
textAlign: 'center' textAlign: 'center'
@ -112,6 +115,7 @@ export default {
initChart() { initChart() {
listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => { listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => {
this.permissionList = resp.data.list.filter(elem => { return parseInt(elem.status) > 0; }); this.permissionList = resp.data.list.filter(elem => { return parseInt(elem.status) > 0; });
this.permissionList = [];
this.mapNameList = [...new Set(this.permissionList.map(elem => { return elem.mapName; })), '']; this.mapNameList = [...new Set(this.permissionList.map(elem => { return elem.mapName; })), ''];
this.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; }); this.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; });
}); });
@ -119,7 +123,6 @@ export default {
this.chart.setOption(this.option); this.chart.setOption(this.option);
}, },
async loadExamData(mapName) { async loadExamData(mapName) {
this.option.title.text = '所属用户剩余权限分布图';
if (mapName) { if (mapName) {
var data = {}; var data = {};
var list = this.permissionList.filter(elem => { return elem.mapName == mapName; }); var list = this.permissionList.filter(elem => { return elem.mapName == mapName; });
@ -134,6 +137,7 @@ export default {
const keys = Object.keys(data); const keys = Object.keys(data);
const values = Object.values(data); const values = Object.values(data);
const sum = keys.length > 0? values.reduce((total, num) => total + num) : 0; const sum = keys.length > 0? values.reduce((total, num) => total + num) : 0;
this.option.title.text = `剩余权限分布图(${mapName}`;
this.option.title.subtext = `权限总计${sum}`; this.option.title.subtext = `权限总计${sum}`;
this.option.xAxis.show = true; this.option.xAxis.show = true;
this.option.yAxis.show = true; this.option.yAxis.show = true;
@ -143,7 +147,8 @@ export default {
} else { } else {
this.option.xAxis.show = false; this.option.xAxis.show = false;
this.option.yAxis.show = false; this.option.yAxis.show = false;
this.option.title.subtext = `暂无数据`; this.option.title.text = `剩余权限分布图(暂无地图线路数据)`;
this.option.title.subtext = `权限总计0个`;
} }
this.chart.setOption(this.option); this.chart.setOption(this.option);