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