refactor: 重命名 CRUD 组件为 Crud 并简化字典标签类型
- CURD 组件 PageModal、PageSearch、PageContent、usePage 重命名为 CrudModal、CrudSearch、CrudTable、useCrudPage - 字典项标签类型改用 primary/success/warning/danger/info,保留历史单字母值兼容读取 - 字典项页面拆分为独立子组件,移除 GithubCorner 组件 - 新增 icon 工具与 screen 样式 - 新增路由缓存、路由跳转、大屏与表格 CRUD 示例页
This commit is contained in:
1 parent
3ccbdb7c06
commit
89d45da839
224 files changed
+7926
-3052
No files matched your search
+142
-56
@@ -14,8 +14,20 @@ export default defineMock([
|
||||
dictCode: "gender",
|
||||
status: 1,
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "通知类型",
|
||||
dictCode: "notice_type",
|
||||
status: 1,
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "通知级别",
|
||||
dictCode: "notice_level",
|
||||
status: 1,
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
total: 3,
|
||||
},
|
||||
msg: "一切ok",
|
||||
},
|
||||
@@ -34,6 +46,14 @@ export default defineMock([
|
||||
value: "gender",
|
||||
label: "性别",
|
||||
},
|
||||
{
|
||||
value: "notice_type",
|
||||
label: "通知类型",
|
||||
},
|
||||
{
|
||||
value: "notice_level",
|
||||
label: "通知级别",
|
||||
},
|
||||
],
|
||||
msg: "一切ok",
|
||||
},
|
||||
@@ -99,41 +119,16 @@ export default defineMock([
|
||||
{
|
||||
url: "dicts/:dictCode/items",
|
||||
method: ["GET"],
|
||||
body: {
|
||||
code: "00000",
|
||||
data: {
|
||||
list: [
|
||||
{
|
||||
id: "1",
|
||||
dictCode: "gender",
|
||||
label: "男",
|
||||
value: "1",
|
||||
sort: 1,
|
||||
status: 1,
|
||||
tagType: "P",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
dictCode: "gender",
|
||||
label: "女",
|
||||
value: "2",
|
||||
sort: 2,
|
||||
status: 1,
|
||||
tagType: "D",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
dictCode: "gender",
|
||||
label: "保密",
|
||||
value: "0",
|
||||
sort: 3,
|
||||
status: 1,
|
||||
tagType: "I",
|
||||
},
|
||||
],
|
||||
total: 3,
|
||||
},
|
||||
msg: "一切ok",
|
||||
body: ({ params }) => {
|
||||
const list = dictItemList[params.dictCode] ?? [];
|
||||
return {
|
||||
code: "00000",
|
||||
data: {
|
||||
list,
|
||||
total: list.length,
|
||||
},
|
||||
msg: "一切ok",
|
||||
};
|
||||
},
|
||||
},
|
||||
// 字典项列表
|
||||
@@ -281,32 +276,123 @@ const dictMap: Record<string, any> = {
|
||||
dictCode: "gender",
|
||||
status: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// 字典项映射表数据
|
||||
const dictItemMap: Record<string, any> = {
|
||||
1: {
|
||||
id: "1",
|
||||
value: "1",
|
||||
label: "男",
|
||||
sort: 1,
|
||||
status: 1,
|
||||
tagType: "P",
|
||||
},
|
||||
2: {
|
||||
id: "2",
|
||||
value: "2",
|
||||
label: "女",
|
||||
sort: 2,
|
||||
name: "通知类型",
|
||||
dictCode: "notice_type",
|
||||
status: 1,
|
||||
tagType: "D",
|
||||
},
|
||||
3: {
|
||||
id: "3",
|
||||
value: "0",
|
||||
label: "保密",
|
||||
sort: 3,
|
||||
name: "通知级别",
|
||||
dictCode: "notice_level",
|
||||
status: 1,
|
||||
tagType: "I",
|
||||
},
|
||||
};
|
||||
|
||||
// 字典项数据:tagType 用全称,与 sql/youlai-admin.sql 种子数据保持一致
|
||||
const dictItemList: Record<string, any[]> = {
|
||||
gender: [
|
||||
{
|
||||
id: "1",
|
||||
dictCode: "gender",
|
||||
label: "男",
|
||||
value: "1",
|
||||
sort: 1,
|
||||
status: 1,
|
||||
tagType: "primary",
|
||||
},
|
||||
{ id: "2", dictCode: "gender", label: "女", value: "2", sort: 2, status: 1, tagType: "danger" },
|
||||
{ id: "3", dictCode: "gender", label: "保密", value: "0", sort: 3, status: 1, tagType: "info" },
|
||||
],
|
||||
notice_type: [
|
||||
{
|
||||
id: "4",
|
||||
dictCode: "notice_type",
|
||||
label: "系统升级",
|
||||
value: "1",
|
||||
sort: 1,
|
||||
status: 1,
|
||||
tagType: "success",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
dictCode: "notice_type",
|
||||
label: "系统维护",
|
||||
value: "2",
|
||||
sort: 2,
|
||||
status: 1,
|
||||
tagType: "primary",
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
dictCode: "notice_type",
|
||||
label: "安全警告",
|
||||
value: "3",
|
||||
sort: 3,
|
||||
status: 1,
|
||||
tagType: "danger",
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
dictCode: "notice_type",
|
||||
label: "假期通知",
|
||||
value: "4",
|
||||
sort: 4,
|
||||
status: 1,
|
||||
tagType: "success",
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
dictCode: "notice_type",
|
||||
label: "公司新闻",
|
||||
value: "5",
|
||||
sort: 5,
|
||||
status: 1,
|
||||
tagType: "primary",
|
||||
},
|
||||
{
|
||||
id: "9",
|
||||
dictCode: "notice_type",
|
||||
label: "其他",
|
||||
value: "99",
|
||||
sort: 99,
|
||||
status: 1,
|
||||
tagType: "info",
|
||||
},
|
||||
],
|
||||
notice_level: [
|
||||
{
|
||||
id: "10",
|
||||
dictCode: "notice_level",
|
||||
label: "低",
|
||||
value: "L",
|
||||
sort: 1,
|
||||
status: 1,
|
||||
tagType: "info",
|
||||
},
|
||||
{
|
||||
id: "11",
|
||||
dictCode: "notice_level",
|
||||
label: "中",
|
||||
value: "M",
|
||||
sort: 2,
|
||||
status: 1,
|
||||
tagType: "warning",
|
||||
},
|
||||
{
|
||||
id: "12",
|
||||
dictCode: "notice_level",
|
||||
label: "高",
|
||||
value: "H",
|
||||
sort: 3,
|
||||
status: 1,
|
||||
tagType: "danger",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 字典项映射表数据(按 id 取单条,供编辑回显)
|
||||
const dictItemMap: Record<string, any> = Object.values(dictItemList)
|
||||
.flat()
|
||||
.reduce((map, item) => ({ ...map, [item.id]: item }), {});
|
||||
Reference in new issue
Block a user