import { defineStore } from "pinia"; import { GlobalState } from "@/stores/interface"; import { DEFAULT_PRIMARY } from "@/config"; import piniaPersistConfig from "@/config/piniaPersist"; import type { ObjToKeyValArray } from "@/typings/global"; export const useGlobalStore = defineStore({ id: "longjoe-global", // 修改默认值之后,需清除 localStorage 数据 state: (): GlobalState => ({ // 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns) layout: "classic", // element 组件大小 assemblySize: "small", // 当前系统语言 language: "zh-cn", // 当前页面是否全屏 maximize: false, // 主题颜色 primary: DEFAULT_PRIMARY, // 深色模式 isDark: false, // 灰色模式 isGrey: false, // 色弱模式 isWeak: false, // 侧边栏反转 (目前仅支持 'vertical' 模式) asideInverted: false, // 折叠菜单 isCollapse: true, // 面包屑导航 breadcrumb: false, // 面包屑导航图标 breadcrumbIcon: false, // 标签页 tabs: true, // 标签页图标 tabsIcon: true, // 页脚 footer: false, // 切换动画 tabsAnimating: true, // 自动锁屏时间, 0不设置 autoLockTime: 0, globalLabelWidth: 120, globalAlign: "left", detailBlank: false, pageSizes: {}, autocomplete: {}, baseMsgTags: [], //菜单是否纵向展示:0: 横向;1:纵向 menuArrangedVertically: false, mxFloat: [], homeLayoutCollapse: false, noviceTutorial: [], is408: false, isSuper: false, detailtabs: null, isShowOriginFormulaMattress: false }), getters: { // 按钮权限列表 mxFloatGet: state => state.mxFloat }, actions: { // Set GlobalState setGlobalState(...args: ObjToKeyValArray) { // setGlobalState(...args: ObjToKeyValArray) { args && this.$patch({ [args[0]]: args[1] }); } }, persist: piniaPersistConfig("longjoe-global") });