| | |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, nextTick, reactive, computed } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import { userLoginFacotryList } from "@/api/login"; |
| | | import { getProductWorkOrderById } from "@/api/productionManagement/productionReporting"; |
| | | import { createVersionUpgradeChecker } from "@/utils/versionUpgrade"; |
| | | import DownloadProgressMask from "@/components/DownloadProgressMask.vue"; |
| | | import modal from "@/plugins/modal"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { triggerVersionCheck } = createVersionUpgradeChecker({ logPrefix: "[version-works]" }); |
| | | const show = ref(false); |
| | | const factoryList = ref([]); |
| | | const factoryListTem = ref([]); |
| | |
| | | icon: "/static/images/icon/caigouguanli.svg", |
| | | label: "采购退货", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/gongyingshangdangan.svg", |
| | | label: "供应商档案", |
| | | }, |
| | | ]); |
| | | |
| | | // 财务管理功能数据 |
| | |
| | | const archiveManagementItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/gongyingshangdangan.svg", |
| | | label: "供应商档案", |
| | | label: "借阅登记", |
| | | }, |
| | | ]); |
| | | { |
| | | icon: "/static/images/icon/hetongguanli.svg", |
| | | label: "归还登记", |
| | | } |
| | | ]) |
| | | |
| | | // 售后服务功能数据 |
| | | const afterSalesServiceItems = reactive([ |
| | |
| | | url: "/pages/customerService/afterSalesHandling/index", |
| | | }); |
| | | break; |
| | | case "借阅登记": |
| | | uni.navigateTo({ |
| | | url: "/pages/fileManagement/borrow/index", |
| | | }); |
| | | break; |
| | | case "归还登记": |
| | | uni.navigateTo({ |
| | | url: "/pages/fileManagement/return/index", |
| | | }); |
| | | break; |
| | | default: |
| | | uni.showToast({ |
| | | title: `点击了${item.label}`, |
| | |
| | | // 定义菜单配置映射 |
| | | const menuMapping = { |
| | | collaboration: { target: collaborationItems, specialMapping: { "规章制度": "规章制度管理" } }, |
| | | archiveManagement: { target: archiveManagementItems, specialMapping: { "供应商档案": "供应商管理" } }, |
| | | purchase: { specialMapping: { "供应商档案": "供应商管理" } }, |
| | | }; |
| | | console.log(allowedMenuTitles) |
| | | // 通用过滤函数 |
| | |
| | | |
| | | // 过滤各个模块 |
| | | filterArray(marketingItems); |
| | | filterArray(purchaseItems); |
| | | filterArray(purchaseItems, menuMapping.purchase.specialMapping); |
| | | filterArray(financeManagementItems); |
| | | filterArray(archiveManagementItems, menuMapping.archiveManagement.specialMapping); |
| | | filterArray(collaborationItems, menuMapping.collaboration.specialMapping); |
| | | filterArray(safetyItems); |
| | | filterArray(humanResourcesItems); |
| | |
| | | filterArray(qualityItems); |
| | | filterArray(productionItems); |
| | | filterArray(equipmentItems); |
| | | filterArray(archiveManagementItems); |
| | | }; |
| | | |
| | | // 检查模块是否有菜单项需要显示 |
| | | const hasMarketingItems = computed(() => marketingItems.length > 0); |
| | | const hasPurchaseItems = computed(() => purchaseItems.length > 0); |
| | | const hasFinanceManagementItems = computed(() => financeManagementItems.length > 0); |
| | | const hasArchiveManagementItems = computed(() => archiveManagementItems.length > 0); |
| | | const hasAfterSalesServiceItems = computed(() => afterSalesServiceItems.length > 0); |
| | | const hasCollaborationItems = computed(() => collaborationItems.length > 0); |
| | | const hasSafetyItems = computed(() => safetyItems.length > 0); |
| | |
| | | const hasWarehouseLogisticsItems = computed(() => warehouseLogisticsItems.length > 0); |
| | | const hasProductionItems = computed(() => productionItems.length > 0); |
| | | const hasEquipmentItems = computed(() => equipmentItems.length > 0); |
| | | const hasArchiveManagementItems = computed(() => archiveManagementItems.length > 0); |
| | | |
| | | onMounted(() => { |
| | | triggerVersionCheck("onMounted"); |
| | | // 每次进入首页都强制刷新用户信息和路由权限,不做本地缓存判断 |
| | | userStore.getInfo().then(() => { |
| | | userStore |
| | |
| | | getUserLoginFacotryList(); |
| | | // 启动通知状态定时器 |
| | | startStatusTimer(); |
| | | }); |
| | | |
| | | onShow(() => { |
| | | triggerVersionCheck("onShow"); |
| | | }); |
| | | </script> |
| | | |