diff --git a/zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/home/enforcementHome.vue b/zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/home/enforcementHome.vue index d4b73e15..d8f76775 100644 --- a/zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/home/enforcementHome.vue +++ b/zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/home/enforcementHome.vue @@ -84,11 +84,26 @@ import Vconsolefrom from 'vconsole'; import { ref, computed, onMounted } from 'vue'; import { useRouter } from 'vue-router'; +import { showToast } from 'vant'; import FooterBar from '@/components/FooterBar.vue'; import { getNoticeInfoList, getCarouselBannerList, getSzyptLoginAuth } from '@/api/enforcement/index'; import { baseUrl } from '@/config/env'; const router = useRouter(); +const { useCommon } = $globalStore; + +// ========== 权限控制 ========== +// 是否执法人员(hasLaw=true 时所有模块可用,false 时仅非行政执法可用) +const hasLaw = computed(() => !!useCommon.hasLaw); + +// 非执法人员点击受限模块时的提示 +const checkLawPermission = () => { + if (!hasLaw.value) { + showToast('您非执法人员,无法使用该功能'); + return false; + } + return true; +}; // ========== 通知数据 ========== const noticeList = ref([]); @@ -137,6 +152,8 @@ const fetchBannerList = () => { * @param {string} type 执法类型:enforcement=行政执法,non-enforcement=非行政执法 */ const toScanEntQRCode = (type) => { + // 行政执法需要执法人员权限,非行政执法不受限 + if (type === 'enforcement' && !checkLawPermission()) return; router.push({ path: '/enforcement/scanEntQRCode', query: { type }, @@ -147,6 +164,7 @@ const toScanEntQRCode = (type) => { * 跳转行政执法信息列表页面 */ const toEnforcementList = () => { + if (!checkLawPermission()) return; router.push({ path: '/enforcement/enforcementList', }); @@ -156,6 +174,7 @@ const toEnforcementList = () => { * 跳转统计分析页面 */ const toStatisticsAnalysis = () => { + if (!checkLawPermission()) return; router.push({ path: '/enforcement/statisticsAnalysis', });