This commit is contained in:
fan 2019-08-21 09:23:08 +08:00
commit dc3f334a93
2 changed files with 44 additions and 159 deletions

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -28,7 +28,7 @@ export default {
return {
option: {
backgroundColor: '#F0F2F5',
title: [{
title: {
text: '',
subtext: '',
subtextStyle: {
@ -37,106 +37,34 @@ export default {
y: 10,
left: 'center',
textAlign: 'center'
}, {
top: '12%',
left: '25%',
text: '',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
}, {
top: '35%',
left: '25%',
text: '',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
}, {
top: '58%',
left: '25%',
text: '',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
}],
},
tooltip: {
},
grid: [{
top: '15%',
top: '17%',
width: '45%',
bottom: '68%',
left: 10,
containLabel: true
}, {
top: '38%',
width: '45%',
bottom: '45%',
left: 10,
containLabel: true
}, {
top: '62%',
width: '45%',
bottom: '7%',
left: 10,
bottom: '5%',
left: 50,
containLabel: true
}],
xAxis: [{
type: 'value',
show: false,
minInterval: 1,
name: '权限(个)'
}, {
type: 'value',
show: false,
gridIndex: 1,
minInterval: 1,
name: '权限(个)'
}, {
type: 'value',
show: false,
gridIndex: 2,
minInterval: 1,
name: '权限(个)'
}],
yAxis: [{
xAxis: {
type: 'category',
show: false,
axisLabel: {
interval: 0,
rotate: 30
rotate: 60
},
splitLine: {
show: false
},
data: []
}, {
type: 'category',
},
yAxis: {
type: 'value',
show: false,
gridIndex: 1,
axisLabel: {
interval: 0,
rotate: 30
},
splitLine: {
show: false
},
data: []
}, {
type: 'category',
show: false,
gridIndex: 2,
axisLabel: {
interval: 0,
rotate: 30
},
splitLine: {
show: false
},
data: []
}],
minInterval: 1,
name: '权限(个)'
},
series: [{
type: 'bar',
z: 3,
@ -145,32 +73,12 @@ export default {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'bar',
z: 3,
xAxisIndex: 1,
yAxisIndex: 1,
barWidth: 10,
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'bar',
z: 3,
xAxisIndex: 2,
yAxisIndex: 2,
barWidth: 10,
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'pie',
radius: [0, '70%'],
center: ['75%', '52%'],
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.percent}%`; }
formatter: params => { return `${params.marker} ${params.name}: ${params.percent}% ${params.value}个)`; }
},
data: []
}]
@ -211,77 +119,54 @@ export default {
},
async loadExamData(mapName) {
if (mapName) {
var permissionMap = {};
var permissionDict = {};
var permissionList = await this.$Dictionary.permissionType();
(permissionList ||[]).forEach(elem => {
permissionDict[elem.code] = elem.name;
});
if (permissionList) {
(permissionList ||[]).forEach(elem => {
permissionMap[elem.code] = elem.name;
});
}
var lessonMap = {
var permissionMap = {
'ATS现地工作站-课程权限': 0,
'ATS行调工作站-课程权限': 0
};
var examMap = {
'ATS行调工作站-课程权限': 0,
'ATS现地工作站-考试权限': 0,
'ATS行调工作站-考试权限': 0
};
var simulationMap = {
'ATS行调工作站-考试权限': 0,
'ATS现地工作站-仿真权限': 0,
'ATS行调工作站-仿真权限': 0,
'综合演练云平台-仿真权限': 0,
'司机模拟驾驶系统-仿真权限': 0,
'大屏系统权限': 0
};
(this.permissionList.filter(elem => { return elem.mapName == mapName; })|| []).forEach(elem => {
switch (elem.type) {
case '01':
lessonMap[`${elem.mapProductName}-${permissionMap[elem.type]}`] = elem.remains;
break;
case '02':
examMap[`${elem.mapProductName}-${permissionMap[elem.type]}`] = elem.remains;
break;
case '03':
simulationMap[`${elem.mapProductName}-${permissionMap[elem.type]}`] = elem.remains;
break;
if (elem.mapProductName == Object.keys(permissionMap)[Object.keys(permissionMap).length -1]) {
permissionMap[`${elem.mapProductName}`] = elem.remains;
} else {
permissionMap[`${elem.mapProductName}-${permissionDict[elem.type]}`] = elem.remains;
}
});
const keys = [...Object.keys(lessonMap), ...Object.keys(examMap), ...Object.keys(simulationMap)];
const values = [...Object.values(lessonMap), ...Object.values(examMap), ...Object.values(simulationMap)];
const keys = Object.keys(permissionMap);
const values = Object.values(permissionMap);
const sum = values.reduce((total, num) => total + num);
this.option.title[0].text = `剩余权限分布图(${mapName}`;
this.option.title[0].subtext = `权限总计${sum}`;
this.option.title[1].text = `课程权限`;
this.option.title[2].text = `考试权限`;
this.option.title[3].text = `仿真权限`;
this.option.title.text = `剩余权限分布图(${mapName}`;
this.option.title.subtext = `权限总计${sum}`;
this.option.xAxis[0].show = this.option.xAxis[1].show = this.option.xAxis[2].show = true;
this.option.yAxis[0].show = this.option.yAxis[1].show = this.option.yAxis[2].show = true;
this.option.xAxis.show = true;
this.option.yAxis.show = true;
this.option.yAxis[0].data = Object.keys(lessonMap);
this.option.series[0].data = Object.values(lessonMap);
this.option.xAxis.data = keys;
this.option.yAxis[1].data = Object.keys(examMap);
this.option.series[1].data = Object.values(examMap);
this.option.yAxis[2].data = Object.keys(simulationMap);
this.option.series[2].data = Object.values(simulationMap);
this.option.series[3].data = keys.map((name, index) => { return {name, value: values[index]}; });
this.option.series[0].data = values;
this.option.series[1].data = keys.map(name => { return {name, value: permissionMap[name]}; });
} else {
this.option.title[0].text = `剩余权限分布图(暂无地图线路数据)`;
this.option.title[0].subtext = `权限总计0个`;
this.option.title[1].text = ``;
this.option.title[2].text = ``;
this.option.title[3].text = ``;
this.option.xAxis[0].show = this.option.xAxis[1].show = this.option.xAxis[2].show = false;
this.option.yAxis[0].show = this.option.yAxis[1].show = this.option.yAxis[2].show = false;
this.option.yAxis[0].data = this.option.yAxis[1].data = this.option.yAxis[2].data = [];
this.option.series[0].data = this.option.series[1].data = this.option.series[2].data = [];
this.option.title.text = `剩余权限分布图(暂无地图线路数据)`;
this.option.title.subtext = `权限总计0个`;
this.option.xAxis.show = false;
this.option.yAxis.show = false;
this.option.xAxis.data = [];
this.option.series[0].data = [];
this.option.series[1].data = [];
}
this.chart.setOption(this.option);