spring
6 小时以前 b83e8417c341636a6da3a8eb7db7c151ef3c00cd
巡查菜单权限设置
已修改1个文件
32 ■■■■ 文件已修改
src/pages/index/index.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index/index.vue
@@ -18,8 +18,8 @@
    </wd-notice-bar>
    <!-- 快捷导航 -->
    <wd-grid clickable :column="1" class="mt-2">
      <view v-for="(item, index) in navList">
        <wd-grid-item v-if="item.show" :key="index" use-slot link-type="navigateTo" :url="item.url">
      <view v-for="(item, index) in navList" :key="index">
        <wd-grid-item v-if="item.show" use-slot link-type="navigateTo" :url="item.url">
          <view class="p-2">
            <image class="w-72rpx h-72rpx rounded-8rpx" :src="item.icon" />
          </view>
@@ -87,11 +87,12 @@
</template>
<script setup lang="ts">
import { reactive } from "vue";
import { reactive, computed } from "vue";
import { dayjs, useMessage, useToast } from "wot-design-uni";
import LogAPI, { VisitStatsVO } from "@/api/system/log";
import WorkerCallingCard from "@/components/worker-calling-card/index.vue";
import HomeApi from "@/api/home";
import { useUserStore } from "@/store/modules/user";
const visitStatsData = ref<VisitStatsVO>({
  todayUvCount: 0,
@@ -104,6 +105,22 @@
const message = useMessage();
const toast = useToast();
// 获取当前登录用户信息
const userStore = useUserStore();
const userInfo: any = computed(() => userStore.userInfo);
// 判断是否为巡检员角色
const isInspector = computed(() => {
  if (!userInfo.value || !userInfo.value.roles || !Array.isArray(userInfo.value.roles)) {
    return false;
  }
  console.log(
    "userInfo.value.roles",
    userInfo.value.roles.some((role: any) => role.roleKey === "qualitative-inspector")
  );
  return userInfo.value.roles.some((role: any) => role.roleKey === "qualitative-inspector");
});
const fileProgress = reactive({
  show: false,
@@ -181,7 +198,7 @@
    icon: "/static/icons/routingInspection.png",
    title: "巡检",
    url: "/pages/routingInspection/index",
    show: true,
    show: false,
  },
]);
@@ -231,7 +248,12 @@
const init = async () => {
  checkVersion();
  const { data } = await HomeApi.getIndex();
  if (data.deviceGroupName == "时效组") {
  // 判断是否为巡检员角色
  if (isInspector.value) {
    // 如果是巡检员,显示巡检菜单
    navList[2].show = true;
  } else if (data.deviceGroupName == "时效组") {
    navList[1].show = true;
  } else {
    navList[0].show = true;