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([
{
pagePath: '/pages/lims/index/index',
pagePath: '/pages/index/index',
iconName: 'home',
text: '首页',
name: 'home'
@@ -42,22 +42,6 @@ const switchTabs = reactive([
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) {
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 tenantId = '1'
export const clientId = 'lsky_lims'
export const clientId = 'zgty_lims'
function initDefaultBaseUrl() {
uni.setStorageSync('base_url', BaseUrl)

View File

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

View File

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

View File

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

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