Files

78 lines
2.0 KiB
JavaScript

/**
* 子系统注册表
*
* nav.vue(导航页,无 tabbar)按这里配置渲染子系统宫格;
* 点击卡片进入 pages/{slug}/home.vue,该子系统拥有自己的页面组与 tabbar。
*
* module 对应后端 yz_system_modules.code(菜单归属靠 path 前缀匹配),
* slug 是端上路由目录名,务必与 pages/{slug}/ 保持一致。
*/
export const SUBSYSTEMS = [
{
slug: 'crm',
module: 'crm',
name: '客户关系',
title: '客户关系管理',
icon: 'handshake',
tint: 'tint-0',
desc: '线索 · 客户 · 商机 · 合同 · 回款'
},
{
slug: 'erp',
module: 'erp',
name: '进销存',
title: '进销存管理',
icon: 'boxes-stacked',
tint: 'tint-1',
desc: '客户 · 供应商 · 账套 · 通讯录'
},
{
slug: 'oa',
module: 'oa',
name: 'OA 办公',
title: '协同办公',
icon: 'clipboard-check',
tint: 'tint-2',
desc: '日程 · 通知 · 文档 · 报销 · 人事'
},
{
slug: 'cms',
module: 'cms',
name: '网站管理',
title: '网站内容管理',
icon: 'globe',
tint: 'tint-3',
desc: '文章 · 产品 · 解决方案 · 站点'
},
{
slug: 'toolbox',
module: 'bianjiegongju',
name: '便捷工具',
title: '便捷工具',
icon: 'wrench',
tint: 'tint-4',
desc: '记事本 · 日程 · 密码库'
}
]
/** 按 slug 取子系统配置 */
export function getSubsystem(slug) {
return SUBSYSTEMS.find((s) => s.slug === slug) || null
}
/** 按后端模块 code 取子系统配置(menus[].module 与 yz_system_modules.code 对应) */
export function getSubsystemByModule(module) {
const key = String(module || '').toLowerCase()
return SUBSYSTEMS.find((s) => String(s.module).toLowerCase() === key) || null
}
/**
* 进入某子系统的概览页。
* 后端模块没有对应端上页面时(未在 SUBSYSTEMS 注册),返回 false 让调用方自行降级。
*/
export function goSubsystem(slug) {
if (!getSubsystem(slug)) return false
uni.navigateTo({ url: `/pages/sub/tabs?slug=${slug}` })
return true
}