更新
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user