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 => {

View File

@@ -132,7 +132,7 @@ let detailInfo = ref({})
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (newVal && nx.$router.getCurrentPage().route == 'pages/lims/deviceBusDailyCheck/index') {
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusDailyCheck/index') {
try {
const codeObj = JSON.parse(newVal)
if (!pageLoading.value) {
@@ -215,7 +215,7 @@ function handleSubmit(type) {
icon: 'none'
})
}
detailInfo.value.checkDate = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss')
detailInfo.value.checkDate = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss')
modalType.value = type
modalShow.value = true
console.log(detailInfo.value)
@@ -226,7 +226,6 @@ async function confirm() {
if (submitLoading.value) return
submitLoading.value = true
await dailyCheckApi.submit({ ...detailInfo.value, submitFlag: modalType.value }).finally(() => {
submitLoading.value = false
modalShow.value = false
@@ -245,7 +244,7 @@ function handleCheckRecord() {
deviceName: detailInfo.value.deviceName
}
nx.$store('biz').deviceInfo = deviceInfo
nx.$router.go('/pages/lims/deviceBusDailyCheck/list')
nx.$router.go('/pages/device/deviceBusDailyCheck/list')
}
//
function handleCreateDailyCheck() {

View File

@@ -25,19 +25,19 @@
<script setup>
import { ref, reactive, onMounted, computed } from 'vue'
import nx from '@/nx'
import BaseInfoCard from '@/pages/lims/deviceBusInfo/baseInfoCard'
import AcceptDetail from '@/pages/lims/accept/detail'
import DailyCheckList from '@/pages/lims/deviceBusDailyCheck/list'
import MaintainList from '@/pages/lims/deviceBusMaintain/list'
import UseRecordList from '@/pages/lims/deviceBusUseRecord/list'
import PeriodCheckList from '@/pages/lims/periodCheckList/index'
import CalibrationList from '@/pages/lims/calibrationList/index'
import RepairList from '@/pages/lims/repair/list'
import BorrowList from '@/pages/lims/borrow/list'
import GivebackList from '@/pages/lims/giveback/list'
import StopList from '@/pages/lims/stop/list'
import DocumentList from '@/pages/lims/documentList/index'
import ScrapInfo from '@/pages/lims/scrap/detail'
import BaseInfoCard from '@/pages/device/deviceBusInfo/baseInfoCard'
import AcceptDetail from '@/pages/device/accept/detail'
import DailyCheckList from '@/pages/device/deviceBusDailyCheck/list'
import MaintainList from '@/pages/device/deviceBusMaintain/list'
import UseRecordList from '@/pages/device/deviceBusUseRecord/list'
import PeriodCheckList from '@/pages/device/periodCheckList/index'
import CalibrationList from '@/pages/device/calibrationList/index'
import RepairList from '@/pages/device/repair/list'
import BorrowList from '@/pages/device/borrow/list'
import GivebackList from '@/pages/device/giveback/list'
import StopList from '@/pages/device/stop/list'
import DocumentList from '@/pages/device/documentList/index'
import ScrapInfo from '@/pages/device/scrap/detail'
import { tabList } from './deviceBusInfo.data'
let activeIndex = ref(0)

View File

@@ -77,7 +77,7 @@ const roomTreeData = ref([])
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (newVal && nx.$router.getCurrentPage().route == 'pages/lims/deviceBusInfo/index') {
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusInfo/index') {
try {
const codeObj = JSON.parse(newVal)
handleDetail({ id: codeObj.id })
@@ -175,7 +175,7 @@ function handleReset() {
async function handleDetail(row, index) {
nx.$store('biz').deviceInfo = row
await getDeviceBusInfoById(row.id)
nx.$router.go('/pages/lims/deviceBusInfo/baseInfo')
nx.$router.go('/pages/device/deviceBusInfo/baseInfo')
}
</script>

View File

@@ -126,7 +126,7 @@ let detailInfo = ref({})
let checkList = ref([])
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (newVal && nx.$router.getCurrentPage().route == 'pages/lims/deviceBusMaintain/index') {
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusMaintain/index') {
try {
const codeObj = JSON.parse(newVal)
if (!pageLoading.value) {
@@ -222,7 +222,7 @@ function handleCheckRecord() {
deviceName: detailInfo.value.deviceName
}
nx.$store('biz').deviceInfo = deviceInfo
nx.$router.go('/pages/lims/deviceBusMaintain/list')
nx.$router.go('/pages/device/deviceBusMaintain/list')
}
</script>

View File

@@ -123,7 +123,7 @@ let detailInfo = ref({})
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (newVal && nx.$router.getCurrentPage().route == 'pages/lims/deviceBusUseRecord/index') {
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusUseRecord/index') {
try {
const codeObj = JSON.parse(newVal)
if (!pageLoading.value) {
@@ -295,7 +295,7 @@ function reset() {
}
function handleUseRecord() {
nx.$store('biz').deviceInfo = detailInfo.value
nx.$router.go('/pages/lims/deviceBusUseRecord/list')
nx.$router.go('/pages/device/deviceBusUseRecord/list')
}
</script>

View File

@@ -105,7 +105,7 @@ async function handleDetail(row) {
fileInfo.value.documentContent = documentContent
fileShow.value = true
} else {
nx.$router.go('/pages/lims/documentList/preview', { documentUrl: row.documentUrl })
nx.$router.go('/pages/device/documentList/preview', { documentUrl: row.documentUrl })
}
}
</script>

View File

@@ -1,11 +1,6 @@
<template>
<view>
<navbar-back
title="实验室管理系统【设备管理】"
:autoBack="false"
leftIcon=""
:leftText="`您好!${userInfo.realname}`"
>
<navbar-back title="实验室管理系统【设备管理】" :autoBack="false" leftIcon="" leftText="">
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
</navbar-back>
<up-grid :border="false" :col="gridCol">
@@ -31,11 +26,11 @@ import mePopup from '@/pages/index/me-popup.vue'
const { gridCol } = useGridCol([400, 600], [2, 3, 4])
let popupShow = ref(false)
let list = reactive([
{ url: '/pages/lims/deviceBusDailyCheck/index', name: '点检', icon: 'dailyCheck' },
{ url: '/pages/lims/deviceBusMaintain/index', name: '维护保养', icon: 'maintain' },
{ url: '/pages/lims/deviceBusUseRecord/index', name: '使用', icon: 'useRecord' },
{ url: '/pages/lims/deviceBusInfo/index', name: '设备查询', icon: 'baseInfo' },
{ url: '/pages/lims/knowledge/index', name: '知识库查询', icon: 'knowledge' }
{ url: '/pages/device/deviceBusDailyCheck/index', name: '点检', icon: 'dailyCheck' },
{ url: '/pages/device/deviceBusMaintain/index', name: '维护保养', icon: 'maintain' },
{ url: '/pages/device/deviceBusUseRecord/index', name: '使用', icon: 'useRecord' },
{ url: '/pages/device/deviceBusInfo/index', name: '设备查询', icon: 'baseInfo' },
{ url: '/pages/device/knowledge/index', name: '知识库查询', icon: 'knowledge' }
])
const roleMenus = computed(() => nx.$store('user').roleMenus)

View File

@@ -127,7 +127,7 @@ async function handleDetail(row) {
fileInfo.value.documentContent = documentContent
fileShow.value = true
} else {
nx.$router.go('/pages/lims/documentList/preview', { documentUrl: row.documentUrl })
nx.$router.go('/pages/device/documentList/preview', { documentUrl: row.documentUrl })
}
}
</script>

View File

@@ -1,8 +1,8 @@
<template>
<view class="page bg-w pt30">
<up-grid :border="false" :col="gridCol">
<up-grid-item class="mb25 mt25" v-for="(item, listIndex) in list" :key="listIndex" @click="goSystem(item.url)">
<image style="width: 80px; height: 80px" :src="`/static/images/menus/${item.icon}.png`"></image>
<up-grid-item class="mb25 mt25" v-for="item in roleMenus" :key="item.id" @click="goSystem(item.component)">
<image style="width: 80px; height: 80px" :src="`/static/images/menus/${item.path}.png`"></image>
<text class="grid-text">{{ item.name }}</text>
</up-grid-item>
</up-grid>
@@ -13,13 +13,8 @@
import { reactive, ref, computed, onMounted } from 'vue'
import nx from '@/nx'
import { useGridCol } from '@/nx/hooks/useGridCol'
let list = reactive([
// { url: '/pages/lims/index/index', name: '设备管理', icon: '设备管理' },
{ url: '/pages/analysis/index/index', name: '分析管理', icon: 'fxgl' },
{ url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: 'ypkgl' }
])
// const sysMenus = computed(() => nx.$store('user').sysMenus)
const roleMenus = computed(() => nx.$store('user').roleMenus)
function goSystem(url) {
uni.setStorageSync('defaultModule', url)
uni.reLaunch({ url })

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="60" />
<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="60" />
<view class="grid-text">{{ item.name }}</view>
</up-grid-item>
</up-grid>
@@ -31,46 +25,15 @@ import mePopup from '@/pages/index/me-popup.vue'
// 响应式数据
const popupShow = ref(false)
const menuItemList = ref([
{
url: '/pages/sampleWarehouse/sampleSearch/index',
otherConf: { icon: '/static/images/menus/records.png' },
name: '样品查询'
},
{
url: '/pages/sampleWarehouse/returnToStock/index',
otherConf: { icon: '/static/images/menus/ypgk.png' },
name: '样品归库'
},
{
url: '/pages/sampleWarehouse/execChangeLocation/index',
otherConf: { icon: '/static/images/menus/kwbg.png' },
name: '库位变更'
},
{
url: '/pages/sampleWarehouse/sampleDispatchInternal/index',
otherConf: { icon: '/static/images/menus/nbdb.png' },
name: '内部调拨'
},
{
url: '/pages/sampleWarehouse/sampleDispatchExternal/index',
otherConf: { icon: '/static/images/menus/wbdb.png' },
name: '外部调拨'
},
{
url: '/pages/sampleWarehouse/dispatchGiveBack/index',
otherConf: { icon: '/static/images/menus/dbgh.png' },
name: '调拨归还'
},
{
url: '/pages/sampleWarehouse/sampleTakeOff/index',
otherConf: { icon: '/static/images/menus/ypxj.png' },
name: '样品下架'
const menuItemList = computed(() => {
let roleMenus = nx.$store('user').roleMenus
const result = roleMenus.find(item => item.path === 'ypkgl')
if (result) {
return result.children
} else {
return []
}
])
// 计算属性
const userInfo = computed(() => nx.$store('user').userInfo)
})
// 方法
const goTo = url => {

View File

@@ -17,7 +17,7 @@
<up-input
class="mt10"
v-model="targetCode"
placeholder="请扫描需要调拨的样品编号"
placeholder="请扫描需要下架的样品编号"
prefixIcon="scan"
fontSize="16"
prefixIconStyle="font-size: 30px;"
@@ -25,7 +25,7 @@
>
</up-input>
<uni-section v-if="sampleList.length > 0" type="line" title="调拨样品明细" titleFontSize="15px">
<uni-section v-if="sampleList.length > 0" type="line" title="下架样品明细" titleFontSize="15px">
<template #right> <up-text type="error" size="18" bold :text="sampleList.length"></up-text></template>
<scroll-view style="height: 49vh" scroll-y scroll-with-animation>
<uni-card margin="5px" v-for="item in sampleList" class="sample-item">

View File

@@ -81,7 +81,7 @@ export default {
async goIndex() {
await this.$store.dispatch('getRoleMenus', this.$store.state.postCode)
uni.reLaunch({
url: 'pages/lims/index/index'
url: 'pages/device/index/index'
})
},
submitForm() {