fix: 物联卡引导页菜单、按钮权限
This commit is contained in:
parent
355bc6df64
commit
619d21f3f1
|
@ -70,6 +70,7 @@
|
|||
<Guide title="流量统计">
|
||||
<template #extra>
|
||||
<TimeSelect
|
||||
key="flow-static"
|
||||
:type="'week'"
|
||||
:quickBtnList="quickBtnList"
|
||||
@change="getEcharts"
|
||||
|
@ -93,6 +94,7 @@
|
|||
<Guide title="流量使用TOP10">
|
||||
<template #extra>
|
||||
<TimeSelect
|
||||
key="flow-top10"
|
||||
:quickBtn="false"
|
||||
:type="'week'"
|
||||
@change="getTopRang"
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
<div class="home-statistics">
|
||||
<Guide title="基础统计">
|
||||
<template #extra>
|
||||
<span class="extra-text">详情</span>
|
||||
<span class="extra-text" @click="jumpDashboard"
|
||||
>详情</span
|
||||
>
|
||||
</template>
|
||||
</Guide>
|
||||
<div class="home-statistics-body">
|
||||
|
@ -72,7 +74,10 @@
|
|||
</a-col>
|
||||
<a-col :span="24" style="min-height: 580px">
|
||||
<div class="home-body">
|
||||
<Guide title="平台架构图" english="PLATFORM ARCHITECTURE DIAGRAM" />
|
||||
<Guide
|
||||
title="平台架构图"
|
||||
english="PLATFORM ARCHITECTURE DIAGRAM"
|
||||
/>
|
||||
<div class="home-body-img">
|
||||
<img :src="getImage('/iot-card/iotcard-home.png')" />
|
||||
</div>
|
||||
|
@ -89,6 +94,8 @@ import { message } from 'ant-design-vue';
|
|||
import moment from 'moment';
|
||||
import { queryFlow, list } from '@/api/iot-card/home';
|
||||
import * as echarts from 'echarts';
|
||||
import { useMenuStore } from '@/store/menu';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = <any>getCurrentInstance();
|
||||
|
@ -103,6 +110,19 @@ interface GuideItemProps {
|
|||
auth: boolean;
|
||||
}
|
||||
|
||||
const menuHasPermission = useMenuStore().hasPermission;
|
||||
const btnHasPermission = usePermissionStore().hasPermission;
|
||||
|
||||
// 菜单权限
|
||||
const dashBoardUrl = menuHasPermission('/iot-card/Dashboard');
|
||||
const platformUrl = menuHasPermission('/iot-card/Platform/Detail');
|
||||
const recordUrl = menuHasPermission('/iot-card/Record');
|
||||
const cardUrl = menuHasPermission('/iot-card/CardManagement');
|
||||
|
||||
// 按钮权限
|
||||
const paltformPermission = btnHasPermission(`/iot-card/Platform:add`);
|
||||
const cardPermission = btnHasPermission(`/iot-card/CardManagement:add`);
|
||||
|
||||
const Image = {
|
||||
1: getImage('/home/1.png'),
|
||||
2: getImage('/home/2.png'),
|
||||
|
@ -113,23 +133,23 @@ const guideList = [
|
|||
key: 'EQUIPMENT',
|
||||
name: '平台对接',
|
||||
english: 'STEP1',
|
||||
auth: '',
|
||||
url: '',
|
||||
auth: paltformPermission,
|
||||
url: platformUrl,
|
||||
},
|
||||
{
|
||||
key: 'SCREEN',
|
||||
name: '物联卡管理',
|
||||
english: 'STEP2',
|
||||
auth: '',
|
||||
url: '',
|
||||
auth: !!cardPermission,
|
||||
url: cardUrl,
|
||||
param: { save: true },
|
||||
},
|
||||
{
|
||||
key: 'CASCADE',
|
||||
name: '操作记录',
|
||||
english: 'STEP3',
|
||||
auth: '',
|
||||
url: '',
|
||||
auth: !!recordUrl,
|
||||
url: recordUrl,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -158,7 +178,15 @@ const pieChartData = ref<any[]>([
|
|||
|
||||
const jumpPage = (data: GuideItemProps) => {
|
||||
if (data.url && data.auth) {
|
||||
router.push(`${data.url}`, data.param);
|
||||
router.push({ path: `${data.url}`, ...data.param });
|
||||
} else {
|
||||
message.warning('暂无权限,请联系管理员');
|
||||
}
|
||||
};
|
||||
|
||||
const jumpDashboard = () => {
|
||||
if (dashBoardUrl) {
|
||||
router.push(`${dashBoardUrl}`);
|
||||
} else {
|
||||
message.warning('暂无权限,请联系管理员');
|
||||
}
|
||||
|
@ -248,7 +276,9 @@ const createBarChart = () => {
|
|||
color: '#FACD89',
|
||||
// barWidth: '5%', // 设单柱状置宽度
|
||||
showBackground: true, //设置柱状的背景虚拟
|
||||
data: barChartData.value.map((m) => parseFloat(m.value.toFixed(2))),
|
||||
data: barChartData.value.map((m) =>
|
||||
parseFloat(m.value.toFixed(2)),
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue