feat:菜单可配置

This commit is contained in:
houjunxiang
2025-11-27 16:12:25 +08:00
parent f3c15b3692
commit 6c86dc0760
46 changed files with 79 additions and 162 deletions

View File

@@ -30,7 +30,7 @@ let props = defineProps({
}) })
const switchTabs = reactive([ const switchTabs = reactive([
{ {
pagePath: '/pages/lims/index/index', pagePath: '/pages/index/index',
iconName: 'home', iconName: 'home',
text: '首页', text: '首页',
name: 'home' name: 'home'
@@ -42,22 +42,6 @@ const switchTabs = reactive([
name: 'account' name: 'account'
} }
]) ])
// const switchTabs = computed(() => {
// return [
// {
// pagePath: '/pages/lims/index/index',
// iconName: 'home',
// text: '首页',
// name: 'home'
// },
// {
// pagePath: '/pages/me/index',
// iconName: 'account',
// text: '我的',
// name: 'account'
// }
// ]
// })
function changeTabIndex(e) { function changeTabIndex(e) {
let pagePath = switchTabs[e].pagePath let pagePath = switchTabs[e].pagePath

View File

@@ -7,7 +7,7 @@ const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.
const upgradeBaseUrl = 'http://192.168.26.116:888' const upgradeBaseUrl = 'http://192.168.26.116:888'
const tenantId = '1' const tenantId = '1'
export const clientId = 'lsky_lims' export const clientId = 'zgty_lims'
function initDefaultBaseUrl() { function initDefaultBaseUrl() {
uni.setStorageSync('base_url', BaseUrl) uni.setStorageSync('base_url', BaseUrl)

View File

@@ -69,7 +69,6 @@ const user = defineStore({
icon: 'success', icon: 'success',
title: '登录成功' title: '登录成功'
}) })
// await this.getRoleMenus()
// await this.getDeviceTimeout() // await this.getDeviceTimeout()
// this.startTimeoutChecker() // this.startTimeoutChecker()
// 如果已经存在默认模块就跳转到对应的模块 // 如果已经存在默认模块就跳转到对应的模块
@@ -86,19 +85,18 @@ const user = defineStore({
} }
}, },
async getUserInfo() { async getUserInfo() {
const { user } = await userApi.getInfo() const { user, menus } = await userApi.getInfo()
if (user) { if (user) {
this.userInfo = user this.userInfo = user
uni.setStorageSync('userInfo', this.userInfo) uni.setStorageSync('userInfo', this.userInfo)
this.getRoleMenus(menus)
} }
}, },
async getRoleMenus() { async getRoleMenus(menus) {
let params = { const parentNodePath = '/lims/mobile'
parentNodeUrl: '/lims/mobile' let result = menus.find(item => item.path === parentNodePath)
} if (result) {
const result = await userApi.getRoleMenusByParentMenuKey(params) this.roleMenus = result.children
if (result.length > 0) {
this.roleMenus = result.map(item => ({ url: item.url, name: item.name, icon: item.otherConf }))
uni.setStorageSync('roleMenus', this.roleMenus) uni.setStorageSync('roleMenus', this.roleMenus)
} }
}, },

View File

@@ -25,7 +25,7 @@
} }
}, },
{ {
"path": "pages/lims/index/index", "path": "pages/device/index/index",
"aliasPath": "/", "aliasPath": "/",
"style": { "style": {
"navigationBarTitleText": "设备管理系统", "navigationBarTitleText": "设备管理系统",
@@ -33,7 +33,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusDailyCheck/index", "path": "pages/device/deviceBusDailyCheck/index",
"style": { "style": {
"navigationBarTitleText": "点检", "navigationBarTitleText": "点检",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -45,7 +45,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusDailyCheck/list", "path": "pages/device/deviceBusDailyCheck/list",
"style": { "style": {
"navigationBarTitleText": "点检记录", "navigationBarTitleText": "点检记录",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -57,7 +57,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusMaintain/index", "path": "pages/device/deviceBusMaintain/index",
"style": { "style": {
"navigationBarTitleText": "维护保养", "navigationBarTitleText": "维护保养",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -69,7 +69,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusMaintain/list", "path": "pages/device/deviceBusMaintain/list",
"style": { "style": {
"navigationBarTitleText": "维护保养记录", "navigationBarTitleText": "维护保养记录",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -81,7 +81,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusUseRecord/index", "path": "pages/device/deviceBusUseRecord/index",
"style": { "style": {
"navigationBarTitleText": "使用记录", "navigationBarTitleText": "使用记录",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -93,7 +93,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusUseRecord/list", "path": "pages/device/deviceBusUseRecord/list",
"style": { "style": {
"navigationBarTitleText": "设备使用记录查看", "navigationBarTitleText": "设备使用记录查看",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -105,7 +105,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusInfo/index", "path": "pages/device/deviceBusInfo/index",
"style": { "style": {
"navigationBarTitleText": "设备查询", "navigationBarTitleText": "设备查询",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -117,7 +117,7 @@
} }
}, },
{ {
"path": "pages/lims/deviceBusInfo/baseInfo", "path": "pages/device/deviceBusInfo/baseInfo",
"style": { "style": {
"navigationBarTitleText": "设备信息", "navigationBarTitleText": "设备信息",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -129,7 +129,7 @@
} }
}, },
{ {
"path": "pages/lims/documentList/preview", "path": "pages/device/documentList/preview",
"style": { "style": {
"navigationBarTitleText": "文档预览", "navigationBarTitleText": "文档预览",
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -141,7 +141,7 @@
} }
}, },
{ {
"path": "pages/lims/knowledge/index", "path": "pages/device/knowledge/index",
"style": { "style": {
"navigationBarTitleText": "知识库查询", "navigationBarTitleText": "知识库查询",
"navigationStyle": "custom" "navigationStyle": "custom"

View File

@@ -1,18 +1,12 @@
<template> <template>
<view> <view>
<navbar-back <navbar-back title="实验室管理系统【分析管理】" titleWidth="800" :autoBack="false" leftIcon="" leftText="">
title="实验室管理系统【分析管理】"
titleWidth="800"
:autoBack="false"
leftIcon=""
:leftText="`您好!${userInfo.nickname}`"
>
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" /> <u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
</navbar-back> </navbar-back>
<up-grid :col="gridCol" :border="false"> <up-grid :col="gridCol" :border="false">
<up-grid-item class="mb20 mt20" v-for="item in menuItemList" :key="item.url" @click="goTo(item.url)"> <up-grid-item class="mb20 mt20" v-for="item in menuItemList" :key="item.id" @click="goTo(item.component)">
<u-icon :name="item.otherConf.icon" color="#0055A2" size="80" /> <u-icon :name="`/static/images/menus/${item.path}.png`" color="#0055A2" size="80" />
<view class="grid-text">{{ item.name }}</view> <view class="grid-text">{{ item.name }}</view>
</up-grid-item> </up-grid-item>
</up-grid> </up-grid>
@@ -30,26 +24,15 @@ import mePopup from '@/pages/index/me-popup.vue'
// 响应式数据 // 响应式数据
const popupShow = ref(false) const popupShow = ref(false)
const menuItemList = ref([ const menuItemList = computed(() => {
{ let roleMenus = nx.$store('user').roleMenus
url: '/pages/analysis/sample/sample-work-list', const result = roleMenus.find(item => item.path === 'fxgl')
otherConf: { icon: '/static/images/menus/ypfx.png' }, if (result) {
name: '样品分析' return result.children
}, } else {
{ return []
url: '/pages/analysis/sample/sample-report-search',
otherConf: { icon: '/static/images/menus/records.png' },
name: '分析记录'
},
{
url: '/pages/analysis/auncel/auncel-status',
otherConf: { icon: '/static/images/menus/tpck.png' },
name: '天平查看'
} }
]) })
// 计算属性
const userInfo = computed(() => nx.$store('user').userInfo)
// 方法 // 方法
const goTo = url => { const goTo = url => {

Some files were not shown because too many files have changed in this diff Show More