style 一些注释和删减

This commit is contained in:
DaxPay
2024-07-05 08:50:43 +08:00
parent 86abf23d48
commit 70a585b1de
5 changed files with 7 additions and 140 deletions

View File

@@ -44,6 +44,5 @@ export interface PermMenu {
sortNo: number
keepAlive: boolean
targetOutside: boolean
hiddenHeaderContent: boolean
children: Array<PermMenu>
}

View File

@@ -1,11 +1,9 @@
export enum PageEnum {
// basic login path
// 基础登录页
BASE_LOGIN = '/login',
// basic home path
// 登陆后主页
BASE_HOME = '/dashboard',
// error page path
// 错误页
ERROR_PAGE = '/exception',
// error log page path
ERROR_LOG_PAGE = '/error-log/list',
}
export const PageWrapperFixedHeightKey = 'PageWrapperFixedHeight'

View File

@@ -198,12 +198,11 @@ export const useMultipleTabStore = defineStore({
// If the current is the leftmost tab
if (index === 0) {
// There is only one tab, then jump to the homepage, otherwise jump to the right tab
// 只有一个标签页,然后跳到主页,否则跳到右边标签页
if (this.tabList.length === 1) {
const userStore = useUserStore()
toTarget = userStore.getUserInfo.homePath || PageEnum.BASE_HOME
toTarget = PageEnum.BASE_HOME
} else {
// Jump to the right tab
// 跳转到右侧标签页
const page = this.tabList[index + 1]
toTarget = getToTarget(page)
}

View File

@@ -19,20 +19,14 @@ import { PermMenu } from '@/api/sys/model/menuModel'
import { getAppEnvConfig } from '@/utils/env'
interface PermissionState {
// Permission code list
// 权限代码列表
permCodeList: string[] | number[]
// Whether the route has been dynamically added
// 路由是否动态添加
isDynamicAddedRoute: boolean
// To trigger a menu update
// 触发菜单更新
lastBuildMenuTime: number
// Backstage menu list
// 后台菜单列表
backMenuList: Menu[]
// 菜单列表
frontMenuList: Menu[]
}
export const usePermissionStore = defineStore({
@@ -40,18 +34,12 @@ export const usePermissionStore = defineStore({
state: (): PermissionState => ({
// 权限代码列表
permCodeList: [],
// Whether the route has been dynamically added
// 路由是否动态添加
// 路由是否加载完成
isDynamicAddedRoute: false,
// To trigger a menu update
// 触发菜单更新
lastBuildMenuTime: 0,
// Backstage menu list
// 后台菜单列表
backMenuList: [],
// menu List
// 菜单列表
frontMenuList: [],
}),
getters: {
getPermCodeList(): string[] | number[] {
@@ -60,9 +48,6 @@ export const usePermissionStore = defineStore({
getBackMenuList(): Menu[] {
return this.backMenuList
},
getFrontMenuList(): Menu[] {
return this.frontMenuList
},
getLastBuildMenuTime(): number {
return this.lastBuildMenuTime
},
@@ -74,16 +59,11 @@ export const usePermissionStore = defineStore({
setPermCodeList(codeList: string[]) {
this.permCodeList = codeList
},
setBackMenuList(list: Menu[]) {
this.backMenuList = list
list?.length > 0 && this.setLastBuildMenuTime()
},
setFrontMenuList(list: Menu[]) {
this.frontMenuList = list
},
setLastBuildMenuTime() {
this.lastBuildMenuTime = new Date().getTime()
},

View File

@@ -1,109 +0,0 @@
import { defineStore } from 'pinia'
import { TABLE_SETTING_KEY } from '@/enums/cacheEnum'
import { Persistent } from '@/utils/cache/persistent'
import type { TableSetting } from '#/store'
import type { SizeType, ColumnOptionsType } from '@/components/Table/src/types/table'
interface TableSettingState {
setting: Nullable<Partial<TableSetting>>
}
export const useTableSettingStore = defineStore({
id: 'table-setting',
state: (): TableSettingState => ({
setting: Persistent.getLocal(TABLE_SETTING_KEY),
}),
getters: {
getTableSetting(state): Nullable<Partial<TableSetting>> {
return state.setting
},
//
getTableSize(state) {
return state.setting?.size || 'middle'
},
//
getShowIndexColumn(state) {
return (routerName: string) => {
return state.setting?.showIndexColumn?.[routerName]
}
},
//
getShowRowSelection(state) {
return (routerName: string) => {
return state.setting?.showRowSelection?.[routerName]
}
},
//
getColumns(state) {
return (routerName: string) => {
return state.setting?.columns && state.setting?.columns[routerName]
? state.setting?.columns[routerName]
: null
}
},
},
actions: {
setTableSetting(setting: Partial<TableSetting>) {
this.setting = Object.assign({}, this.setting, setting)
Persistent.setLocal(TABLE_SETTING_KEY, this.setting, true)
},
resetTableSetting() {
Persistent.removeLocal(TABLE_SETTING_KEY, true)
this.setting = null
},
//
setTableSize(size: SizeType) {
this.setTableSetting(
Object.assign({}, this.setting, {
size,
}),
)
},
//
setShowIndexColumn(routerName: string, show: boolean) {
this.setTableSetting(
Object.assign({}, this.setting, {
showIndexColumn: {
...this.setting?.showIndexColumn,
[routerName]: show,
},
}),
)
},
//
setShowRowSelection(routerName: string, show: boolean) {
this.setTableSetting(
Object.assign({}, this.setting, {
showRowSelection: {
...this.setting?.showRowSelection,
[routerName]: show,
},
}),
)
},
//
setColumns(routerName: string, columns: Array<ColumnOptionsType>) {
this.setTableSetting(
Object.assign({}, this.setting, {
columns: {
...this.setting?.columns,
[routerName]: columns,
},
}),
)
},
clearColumns(routerName: string) {
this.setTableSetting(
Object.assign({}, this.setting, {
columns: {
...this.setting?.columns,
[routerName]: undefined,
},
}),
)
},
},
})