通用中后台框架第一版

This commit is contained in:
BBIT-Kai
2026-04-28 16:27:16 +08:00
commit b8d25869c6
115 changed files with 15223 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
import type { TagProps } from 'naive-ui'
export function statusLabel(status?: string | null) {
const map: Record<string, string> = {
ENABLED: '启用',
DISABLED: '禁用',
SUCCESS: '成功',
FAIL: '失败'
}
return status ? (map[status] ?? status) : '-'
}
export function statusTagType(status?: string | null): TagProps['type'] {
if (status === 'ENABLED' || status === 'SUCCESS') return 'success'
if (status === 'DISABLED') return 'warning'
if (status === 'FAIL') return 'error'
return 'default'
}
export function menuTypeLabel(type?: string | null) {
const map: Record<string, string> = {
CATALOG: '目录',
MENU: '菜单',
BUTTON: '按钮'
}
return type ? (map[type] ?? type) : '-'
}
export function dataScopeLabel(scope?: string | null) {
const map: Record<string, string> = {
ALL: '全部数据',
DEPT: '本组织及下级',
DEPT_ONLY: '本组织',
SELF: '仅本人'
}
return scope ? (map[scope] ?? scope) : '-'
}
export function httpMethodLabel(method?: string | null) {
const map: Record<string, string> = {
GET: '查询',
POST: '新增',
PUT: '更新',
PATCH: '局部更新',
DELETE: '删除'
}
return method ? (map[method] ?? method) : '-'
}
export function operationTypeLabel(type?: string | null) {
const map: Record<string, string> = {
CREATE: '新增',
UPDATE: '更新',
DELETE: '删除',
UPDATE_STATUS: '更新状态',
RESET_PASSWORD: '重置密码',
ASSIGN_ROLE: '分配角色',
ASSIGN_MENU: '分配菜单'
}
return type ? (map[type] ?? type) : '-'
}
+11
View File
@@ -0,0 +1,11 @@
type PagePrefixInfo = {
page: number
pageCount: number
itemCount?: number
}
export function renderPagePrefix(info: PagePrefixInfo) {
const pageCount = Math.max(info.pageCount, 1)
const itemCount = info.itemCount ?? 0
return `${info.page} / ${pageCount} 页,共 ${itemCount}`
}