修改主页界面

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 :id="id" :style="{height: size.height+'px', width: size.width+'px'}" />
<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-select>
</div>
@ -32,6 +32,9 @@ export default {
title: {
text: '',
subtext: '',
subtextStyle: {
color: '#909399'
},
y: 10,
left: 'center',
textAlign: 'center'
@ -112,6 +115,7 @@ export default {
initChart() {
listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => {
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.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; });
});
@ -119,7 +123,6 @@ export default {
this.chart.setOption(this.option);
},
async loadExamData(mapName) {
this.option.title.text = '所属用户剩余权限分布图';
if (mapName) {
var data = {};
var list = this.permissionList.filter(elem => { return elem.mapName == mapName; });
@ -134,6 +137,7 @@ export default {
const keys = Object.keys(data);
const values = Object.values(data);
const sum = keys.length > 0? values.reduce((total, num) => total + num) : 0;
this.option.title.text = `剩余权限分布图(${mapName}`;
this.option.title.subtext = `权限总计${sum}`;
this.option.xAxis.show = true;
this.option.yAxis.show = true;
@ -143,7 +147,8 @@ export default {
} else {
this.option.xAxis.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);