From 53282f94532a404c0f3fe2e1ed97968f38ec0d56 Mon Sep 17 00:00:00 2001 From: chansee97 Date: Sun, 31 Aug 2025 17:25:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppMain.vue | 2 +- src/api/system/user.ts | 2 +- src/constants/Regex.ts | 2 +- src/constants/User.ts | 5 - src/constants/index.ts | 1 - src/typings/entities/dict.d.ts | 44 ++-- src/typings/entities/role.d.ts | 4 +- src/typings/entities/user.d.ts | 8 +- src/utils/alova/alova.ts | 11 +- .../build-in/login/components/Login/index.vue | 2 +- src/views/demo/list/common-list/index.vue | 2 +- src/views/setting/dict/columns.tsx | 188 ++++++--------- .../setting/dict/components/DictDataModal.vue | 143 +++++++++++ .../setting/dict/components/DictModal.vue | 202 ---------------- .../setting/dict/components/DictTypeList.vue | 171 +++++++++++++ .../setting/dict/components/DictTypeModal.vue | 133 +++++++++++ src/views/setting/dict/index.vue | 224 ++++++++---------- src/views/setting/menu/columns.tsx | 2 +- .../setting/menu/components/MenuModal.vue | 16 +- src/views/setting/menu/index.vue | 4 +- src/views/setting/role/columns.tsx | 37 +-- .../setting/role/components/RoleModal.vue | 45 ++-- src/views/setting/role/index.vue | 22 +- src/views/setting/user/columns.tsx | 17 +- .../setting/user/components/UserModal.vue | 66 ++++-- src/views/setting/user/index.vue | 22 +- 26 files changed, 792 insertions(+), 583 deletions(-) delete mode 100644 src/constants/User.ts create mode 100644 src/views/setting/dict/components/DictDataModal.vue delete mode 100644 src/views/setting/dict/components/DictModal.vue create mode 100644 src/views/setting/dict/components/DictTypeList.vue create mode 100644 src/views/setting/dict/components/DictTypeModal.vue diff --git a/src/AppMain.vue b/src/AppMain.vue index 66fe6e3..ce7e6e2 100644 --- a/src/AppMain.vue +++ b/src/AppMain.vue @@ -45,7 +45,7 @@ const propOverrides = { cols: 4, }, ProModalForm: { - labelWidth: 120, + labelWidth: 100, labelPlacement: 'left', preset: 'card', }, diff --git a/src/api/system/user.ts b/src/api/system/user.ts index f06abac..7451461 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -6,7 +6,7 @@ interface UserQueryParams { pageSize?: number username?: string gender?: 'male' | 'female' | 'unknown' - userStatus?: number + status?: number deptId?: number } diff --git a/src/constants/Regex.ts b/src/constants/Regex.ts index d675af7..b255c6d 100644 --- a/src/constants/Regex.ts +++ b/src/constants/Regex.ts @@ -8,5 +8,5 @@ export enum Regex { Email = '^(([^<>()[\\]\\\\.,;:\\s@"]+(\\.[^<>()[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$', - RouteName = '^[\\w_!@#$%^&*~-]+$', + Phone = '^1[3-9]\d{9}$', } diff --git a/src/constants/User.ts b/src/constants/User.ts deleted file mode 100644 index a8104ea..0000000 --- a/src/constants/User.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** Gender */ -export enum Gender { - male, - female, -} diff --git a/src/constants/index.ts b/src/constants/index.ts index a2b4ead..9cc303a 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,2 +1 @@ export * from './Regex' -export * from './User' diff --git a/src/typings/entities/dict.d.ts b/src/typings/entities/dict.d.ts index 04ab2e2..e900197 100644 --- a/src/typings/entities/dict.d.ts +++ b/src/typings/entities/dict.d.ts @@ -3,14 +3,18 @@ /** 数据库表字段 */ namespace Entity { interface DictType { + /** + * 主键ID + */ + id?: number /** * 字典名称 */ - dictName: string + name: string /** * 字典类型 */ - dictType: string + type: string /** * 备注信息 */ @@ -19,21 +23,29 @@ namespace Entity { * 状态 */ status?: number + /** + * 创建时间 + */ + createTime?: string + /** + * 更新时间 + */ + updateTime?: string } interface DictData { /** - * 样式属性 + * 主键ID */ - cssClass?: string + id?: number /** - * 字典标签 + * 字典名称 */ - dictLabel: string + name: string /** * 字典排序 */ - dictSort?: number + sort?: number /** * 字典类型 */ @@ -41,15 +53,7 @@ namespace Entity { /** * 字典键值 */ - dictValue: string - /** - * 是否默认 - */ - isDefault?: number - /** - * 表格回显样式 - */ - listClass?: string + value: string /** * 备注信息 */ @@ -58,5 +62,13 @@ namespace Entity { * 状态 */ status?: number + /** + * 创建时间 + */ + createTime?: string + /** + * 更新时间 + */ + updateTime?: string } } diff --git a/src/typings/entities/role.d.ts b/src/typings/entities/role.d.ts index 2c97d93..d62e397 100644 --- a/src/typings/entities/role.d.ts +++ b/src/typings/entities/role.d.ts @@ -8,7 +8,7 @@ namespace Entity { /** * 角色ID */ - roleId: number + id: number /** * 菜单ID数组 */ @@ -28,7 +28,7 @@ namespace Entity { /** * 角色状态 */ - roleStatus?: number + status?: number /** * 显示顺序 */ diff --git a/src/typings/entities/user.d.ts b/src/typings/entities/user.d.ts index b86828e..9e57ff6 100644 --- a/src/typings/entities/user.d.ts +++ b/src/typings/entities/user.d.ts @@ -4,7 +4,7 @@ namespace Entity { interface User { /** 用户id */ - userId: number + id: number /** 部门id */ deptId?: any /** 用户名 */ @@ -22,13 +22,9 @@ namespace Entity { /** 头像 */ avatar?: string /** 用户状态 */ - userStatus: number - /** 创建人 */ - createBy?: string + status: number /** 创建时间 */ createTime: string - /** 更新人 */ - updateBy?: string /** 更新时间 */ updateTime: string /** 备注 */ diff --git a/src/utils/alova/alova.ts b/src/utils/alova/alova.ts index a35c17b..0382685 100644 --- a/src/utils/alova/alova.ts +++ b/src/utils/alova/alova.ts @@ -72,24 +72,23 @@ export function createAlovaInstance( const { status } = response let errorMessage = '' + const res = await response.clone().json() if (status === 200) { // 返回blob数据 if (method.meta?.isBlob) return response.blob() - // 返回json数据 - const apiData = await response.json() // 请求成功 - if (apiData[_backendConfig.codeKey] === _backendConfig.successCode) - return apiData + if (res[_backendConfig.codeKey] === _backendConfig.successCode) + return res // 业务请求失败 - errorMessage = apiData[_backendConfig.msgKey] + errorMessage = res[_backendConfig.msgKey] } else { // 接口请求失败 const errorCode = response.status as ErrorStatus - errorMessage = ERROR_STATUS[errorCode] || ERROR_STATUS.default + errorMessage = res[_backendConfig.msgKey] || ERROR_STATUS[errorCode] || ERROR_STATUS.default } window.$message?.error(errorMessage) throw new Error(errorMessage) diff --git a/src/views/build-in/login/components/Login/index.vue b/src/views/build-in/login/components/Login/index.vue index f614145..2c358ca 100644 --- a/src/views/build-in/login/components/Login/index.vue +++ b/src/views/build-in/login/components/Login/index.vue @@ -49,7 +49,7 @@ const rules = computed(() => { }) const formValue = ref({ account: 'admin', - pwd: '12345', + pwd: '123456', captcha: '', }) const isRemember = ref(false) diff --git a/src/views/demo/list/common-list/index.vue b/src/views/demo/list/common-list/index.vue index 7081850..40fe188 100644 --- a/src/views/demo/list/common-list/index.vue +++ b/src/views/demo/list/common-list/index.vue @@ -185,7 +185,7 @@ function handleAddTable() { - 新建 + 新增