diff --git a/src/views/cost/index.vue b/src/views/cost/index.vue index a725853c..ebcaae60 100644 --- a/src/views/cost/index.vue +++ b/src/views/cost/index.vue @@ -34,6 +34,7 @@ size="mini" type="text" style="font-size: 24px; color: white; margin-right: 30px" + :disabled="!permission" @click="goDetail"> 详细 @@ -273,7 +274,7 @@ export default { this.showTime = moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD'); getUserProfile().then((response) => { this.user = response.data; - if (this.user.nickname !== '技术中心') { + if (this.user.roles[0].name !== 'dashborad') { this.permission = true; this.getData(); } else { diff --git a/src/views/dashboard/allDashboard/BarChart.vue b/src/views/dashboard/allDashboard/BarChart.vue index 7069bac4..f4ab8c0a 100644 --- a/src/views/dashboard/allDashboard/BarChart.vue +++ b/src/views/dashboard/allDashboard/BarChart.vue @@ -42,7 +42,7 @@ export default { this.chart = null; }, methods: { - initChart() { + initChart(permission) { var option = { tooltip: { trigger: 'axis', @@ -231,7 +231,9 @@ export default { }, ], }; - + if(permission){ + option.series[2]=[] + } if (this.chart) { this.chart.setOption(option); } else { diff --git a/src/views/dashboard/allDashboard/index.vue b/src/views/dashboard/allDashboard/index.vue index ff97b564..e89bc9ea 100644 --- a/src/views/dashboard/allDashboard/index.vue +++ b/src/views/dashboard/allDashboard/index.vue @@ -140,6 +140,7 @@ import screenfull from 'screenfull'; import { debounce } from '@/utils/debounce'; import baseTable from '../components/baseTable.vue'; import BarChart from './BarChart.vue'; +import { getUserProfile } from '@/api/system/user'; const tableProps1 = [ { @@ -246,11 +247,21 @@ export default { tableProps2, tableData2: [], echartData: [], + permission: false, }; }, created() { this.init(); - this.initWebSocket(); + this.permission = false; + getUserProfile().then((response) => { + const user = response.data; + if (user.roles[0].name !== 'dashborad') { + this.permission = true; + } else { + this.permission = false; + } + this.initWebSocket(); + }); }, destroy() { this.destroy(); @@ -341,17 +352,36 @@ export default { // 数据接收 if ('factoryState' in dataJson) { this.topData = dataJson.factoryState; + if(!this.permission){ + this.topData.monthAreaCost = '***' + this.topData.monthSum = '***' + this.topData.yestodaySum = '***' + } } if ('factoryCostTableList' in dataJson) { this.tableData1 = dataJson.factoryCostTableList; + if(!this.permission){ + this.tableData1.forEach(item=>{ + item.priceS = null + item.matPriceS = null + item.energyPriceS = null + item.otherPriceS = null + item.areaPriceS = null + }) + } } if ('factoryEnergyTableList' in dataJson) { this.tableData2 = dataJson.factoryEnergyTableList; + if(!this.permission){ + this.tableData2.forEach(item=>{ + item.price = null + }) + } } if ('factoryCostTrendList' in dataJson) { this.echartData = dataJson.factoryCostTrendList; this.$nextTick(()=>{ - this.$refs.chartRef.initChart(); + this.$refs.chartRef.initChart(!this.permission); }) } }, diff --git a/src/views/dashboard/deepDashboard/BarChart.vue b/src/views/dashboard/deepDashboard/BarChart.vue index 56de6ef9..a597d459 100644 --- a/src/views/dashboard/deepDashboard/BarChart.vue +++ b/src/views/dashboard/deepDashboard/BarChart.vue @@ -48,7 +48,7 @@ export default { this.chart = null; }, methods: { - initChart() { + initChart(permission) { var option = { tooltip: { trigger: 'axis', @@ -292,6 +292,9 @@ export default { ], }; + if(permission){ + option.series[1]=[] + } if (this.chart) { this.chart.setOption(option); } else { diff --git a/src/views/dashboard/deepDashboard/index.vue b/src/views/dashboard/deepDashboard/index.vue index 9b90a538..33795816 100644 --- a/src/views/dashboard/deepDashboard/index.vue +++ b/src/views/dashboard/deepDashboard/index.vue @@ -110,6 +110,7 @@ import { debounce } from '@/utils/debounce'; import baseTable from '../components/baseTable.vue'; import BarChart from './BarChart.vue'; import interval from './interval.vue'; +import { getUserProfile } from '@/api/system/user'; const tableProps1 = [ { @@ -224,12 +225,22 @@ export default { tableData2: [], tableProps3, tableData3: [], - echartData: [] + echartData: [], + permission: false, }; }, created() { this.init(); - this.initWebSocket(); + this.permission = false; + getUserProfile().then((response) => { + const user = response.data; + if (user.roles[0].name !== 'dashborad') { + this.permission = true; + } else { + this.permission = false; + } + this.initWebSocket(); + }); }, destroy() { this.destroy(); @@ -319,12 +330,27 @@ export default { // 数据接收 if ('DeepState' in dataJson) { this.topData = dataJson.DeepState; + if(!this.permission){ + this.topData.yestodaySum = '***' + this.topData.monthSum = '***' + this.topData.monthAreaCost = '***' + } } if ('DeepEnergyTableList' in dataJson) { this.tableData1 = dataJson.DeepEnergyTableList; + if(!this.permission){ + this.tableData1.forEach(item=>{ + item.elecPrice = null + }) + } } if ('DeepCostTableList' in dataJson) { this.tableData2 = dataJson.DeepCostTableList; + if(!this.permission){ + this.tableData2.forEach(item=>{ + item.priceD = null + }) + } } if ('DeepPdTables' in dataJson) { this.tableData3 = dataJson.DeepPdTables; @@ -332,7 +358,7 @@ export default { if ('DeepCostTrendList' in dataJson) { this.echartData = dataJson.DeepCostTrendList; this.$nextTick(() => { - this.$refs.chartRef.initChart(); + this.$refs.chartRef.initChart(!this.permission); }); } }, diff --git a/src/views/dashboard/rawDashboard/BarChart.vue b/src/views/dashboard/rawDashboard/BarChart.vue index 10b102a1..8adfe35a 100644 --- a/src/views/dashboard/rawDashboard/BarChart.vue +++ b/src/views/dashboard/rawDashboard/BarChart.vue @@ -48,7 +48,7 @@ export default { this.chart = null; }, methods: { - initChart() { + initChart(permission) { var option = { tooltip: { @@ -293,6 +293,9 @@ export default { ], } + if(permission){ + option.series[1]=[] + } if (this.chart) { this.chart.setOption(option); } else { diff --git a/src/views/dashboard/rawDashboard/index.vue b/src/views/dashboard/rawDashboard/index.vue index 86498be7..725c26bb 100644 --- a/src/views/dashboard/rawDashboard/index.vue +++ b/src/views/dashboard/rawDashboard/index.vue @@ -144,6 +144,7 @@ import screenfull from 'screenfull'; import { debounce } from '@/utils/debounce'; import baseTable from '../components/baseTable.vue'; import BarChart from './BarChart.vue'; +import { getUserProfile } from '@/api/system/user'; const tableProps1 = [ { @@ -229,11 +230,21 @@ export default { tableProps2, tableData2: [], echartData: [], + permission: false, }; }, created() { this.init(); - this.initWebSocket(); + this.permission = false; + getUserProfile().then((response) => { + const user = response.data; + if (user.roles[0].name !== 'dashborad') { + this.permission = true; + } else { + this.permission = false; + } + this.initWebSocket(); + }); }, destroy() { this.destroy(); @@ -324,17 +335,35 @@ export default { // 数据接收 if ('OriginState' in dataJson) { this.topData = dataJson.OriginState; + if(!this.permission){ + this.topData.monthAreaCost = '***' + this.topData.monthMat = '***' + this.topData.yestodaySum = '***' + this.topData.yestodayMat = '***' + } } if ('OriginEnergyTableList' in dataJson) { this.tableData1 = dataJson.OriginEnergyTableList; + if(!this.permission){ + this.tableData1.forEach(item=>{ + item.elecPrice = null + item.gasPrice = null + item.price = null + }) + } } if ('OriginCostTableList' in dataJson) { this.tableData2 = dataJson.OriginCostTableList; + if(!this.permission){ + this.tableData2.forEach(item=>{ + item.priceO = null + }) + } } if ('OriginCostTrendList' in dataJson) { this.echartData = dataJson.OriginCostTrendList; this.$nextTick(()=>{ - this.$refs.chartRef.initChart(); + this.$refs.chartRef.initChart(!this.permission); }) } },