From d8e7965ffd2d4774ea45f66a97f148965f1dd103 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 21 Aug 2019 09:14:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E8=A1=A8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/baseUrl.js | 4 +- src/views/dashboard/echarts/permission.vue | 197 ++++----------------- 2 files changed, 41 insertions(+), 160 deletions(-) diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 4050e7e22..2e575c51e 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -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; diff --git a/src/views/dashboard/echarts/permission.vue b/src/views/dashboard/echarts/permission.vue index b6b018ea5..c2c7898ce 100644 --- a/src/views/dashboard/echarts/permission.vue +++ b/src/views/dashboard/echarts/permission.vue @@ -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%', - 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, + top: '17%', + width: '50%', + 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,26 +73,6 @@ 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%'], @@ -211,77 +119,50 @@ 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; - } + 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); From 82222027c089201c8a9204783e1523681a4c1ca4 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 21 Aug 2019 09:18:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/echarts/permission.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/echarts/permission.vue b/src/views/dashboard/echarts/permission.vue index c2c7898ce..ba3886fa3 100644 --- a/src/views/dashboard/echarts/permission.vue +++ b/src/views/dashboard/echarts/permission.vue @@ -42,7 +42,7 @@ export default { }, grid: [{ top: '17%', - width: '50%', + width: '45%', bottom: '5%', left: 50, containLabel: true @@ -138,7 +138,11 @@ export default { }; (this.permissionList.filter(elem => { return elem.mapName == mapName; })|| []).forEach(elem => { - permissionMap[`${elem.mapProductName}-${permissionDict[elem.type]}`] = elem.remains; + 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(permissionMap); From 5273554ba0a731f9db6751ed032cfdb78f33c79a Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 21 Aug 2019 09:20:40 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A5=BC=E5=BD=A2=E5=9B=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E6=95=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/echarts/permission.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/dashboard/echarts/permission.vue b/src/views/dashboard/echarts/permission.vue index ba3886fa3..0f8d22452 100644 --- a/src/views/dashboard/echarts/permission.vue +++ b/src/views/dashboard/echarts/permission.vue @@ -78,7 +78,7 @@ export default { 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: [] }]