diff --git a/src/views/DataCollect/Dashboard/components/Card.vue b/src/views/DataCollect/Dashboard/components/Card.vue index 8980e0b2..542c13b4 100644 --- a/src/views/DataCollect/Dashboard/components/Card.vue +++ b/src/views/DataCollect/Dashboard/components/Card.vue @@ -83,6 +83,9 @@ const handleOptions = (x = [], y = []) => { const chart: any = chartRef.value; if (chart) { const myChart = echarts.init(chart); + const maxY: number = y.sort((a,b)=>{ + return b-a + })?.[0] const options = { xAxis: { type: 'category', @@ -93,8 +96,8 @@ const handleOptions = (x = [], y = []) => { type: 'value', }, grid: { - left: '80px', - right: '50px', + left: maxY < 1000 ? 60 : maxY.toString().length * 10, + right: '60px', }, tooltip: { trigger: 'axis', diff --git a/src/views/DataCollect/Dashboard/index.vue b/src/views/DataCollect/Dashboard/index.vue index 1b07cfe3..006f4cf3 100644 --- a/src/views/DataCollect/Dashboard/index.vue +++ b/src/views/DataCollect/Dashboard/index.vue @@ -12,7 +12,7 @@ /> - + @@ -26,14 +26,19 @@ import Card from './components/Card.vue'; import { getImage } from '@/utils/comm'; import { queryCount } from '@/api/data-collect/dashboard'; import { defaultParams, statusData } from './tool'; +import { useMenuStore } from '@/store/menu'; + +const menuPermission = useMenuStore().hasMenu; const StatusData = ref(statusData); const getNumberData = () => { StatusData.value.forEach(async (item: any) => { - const res = await queryCount(item[0].type, {}); - const resp = await queryCount(item[0].type, defaultParams); - item[0].total = res?.result; - item[0].value = resp?.result; + if(menuPermission(item[0]?.permission)) { + const res = await queryCount(item[0].type, {}); + const resp = await queryCount(item[0].type, defaultParams); + item[0].total = res?.result; + item[0].value = resp?.result; + } }); }; onMounted(() => { diff --git a/src/views/DataCollect/Dashboard/tool.ts b/src/views/DataCollect/Dashboard/tool.ts index 4fd5a133..a6c2cf5a 100644 --- a/src/views/DataCollect/Dashboard/tool.ts +++ b/src/views/DataCollect/Dashboard/tool.ts @@ -39,13 +39,13 @@ const getParams = (dt: any) => { }; } else if (time > days && time <= days * 7) { return { - limit: Math.abs(Math.ceil(time / days / 7)) + 1, + limit: Math.abs(Math.ceil(time / days)) + 1, interval: '1d', format: 'YYYY-MM-dd HH:mm', }; - } else if (time >= year) { + } else if (time > days*90) { return { - limit: Math.abs(Math.ceil(time / days / 31)) + 1, + limit: Math.abs(Math.ceil(time / days / 30)) + 1, interval: '1M', format: 'YYYY-MM-dd HH:mm', }; @@ -137,6 +137,7 @@ export const statusData = [ label: '通道数量', value: 0, total: 0, + permission: 'DataCollect/Channel' }, ], [ @@ -147,6 +148,7 @@ export const statusData = [ label: '采集器数量', value: 0, total: 0, + permission: 'DataCollect/Collector' }, ], [ @@ -157,6 +159,7 @@ export const statusData = [ label: '采集点位', value: 0, total: 0, + permission: 'DataCollect/Collector' }, ], ]; diff --git a/src/views/home/components/DeviceCountCard.vue b/src/views/home/components/DeviceCountCard.vue index 437378c7..755117a8 100644 --- a/src/views/home/components/DeviceCountCard.vue +++ b/src/views/home/components/DeviceCountCard.vue @@ -26,7 +26,7 @@ const { jumpPage } = useMenuStore(); const projectNum = ref(0); const deviceNum = ref(0); -const menuPermission = useMenuStore().hasPermission; +const menuPermission = useMenuStore().hasMenu; const getData = () => { // 有产品菜单权限则获取数据 menuPermission('device/Product') &&