From d33fe940732d38136c7b3f81b617208108b328e3 Mon Sep 17 00:00:00 2001 From: wh <1044541107@qq.com> Date: Tue, 15 Jul 2025 22:53:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E6=AD=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 14 +- src/api/dictApi.ts | 114 +++ src/views/system/dict/compoents/DictMain.vue | 721 +++++++++++++++++++ src/views/system/dict/compoents/DictNav.vue | 300 ++++++++ src/views/system/dict/index.vue | 34 +- 5 files changed, 1165 insertions(+), 18 deletions(-) create mode 100644 src/api/dictApi.ts create mode 100644 src/views/system/dict/compoents/DictMain.vue create mode 100644 src/views/system/dict/compoents/DictNav.vue diff --git a/auto-imports.d.ts b/auto-imports.d.ts index e4734c3..1f9f43c 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -9,6 +9,11 @@ declare global { const EffectScope: typeof import('vue')['EffectScope'] const addChildMenu: typeof import('./src/api/menu')['addChildMenu'] const addParentMenu: typeof import('./src/api/menu')['addParentMenu'] + const addChildDictionary: typeof import('./src/api/dictApi')['addChildDictionary'] + const addParentDic: typeof import('./src/api/dictApi')['addParentDic'] + const addParentDict: typeof import('./src/api/dictApi')['addParentDict'] + const addParentDictionaries: typeof import('./src/api/dictApi')['addParentDictionaries'] + const addParentDictionary: typeof import('./src/api/dictApi')['addParentDictionary'] const computed: typeof import('vue')['computed'] const createApp: typeof import('vue')['createApp'] const customRef: typeof import('vue')['customRef'] @@ -17,14 +22,19 @@ declare global { const deleteMenu: typeof import('./src/api/menu')['deleteMenu'] const deleteUser: typeof import('./src/api/roleApi')['deleteUser'] const editParentMenu: typeof import('./src/api/menu')['editParentMenu'] + const deleteChildDictionary: typeof import('./src/api/dictApi')['deleteChildDictionary'] + const deleteParentDictionary: typeof import('./src/api/dictApi')['deleteParentDictionary'] const effectScope: typeof import('vue')['effectScope'] const eidtChildMenu: typeof import('./src/api/menu')['eidtChildMenu'] const enable: typeof import('./src/api/roleApi')['enable'] const enableRole: typeof import('./src/api/roleApi')['enableRole'] const getAllMenu: typeof import('./src/api/menu')['getAllMenu'] + const getChildDictionary: typeof import('./src/api/dictApi')['getChildDictionary'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] - const getRoleList: typeof import('./src/api/roleApi')['getRoleList'] + const getParentDict: typeof import('./src/api/dictApi')['getParentDict'] + const getParentDictionaries: typeof import('./src/api/dictApi')['getParentDictionaries'] + const getParentDictionary: typeof import('./src/api/dictApi')['getParentDictionary'] const getUserInfo: typeof import('./src/api/userApi')['getUserInfo'] const getUserList: typeof import('./src/api/roleApi')['getUserList'] const h: typeof import('vue')['h'] @@ -68,6 +78,8 @@ declare global { const toValue: typeof import('vue')['toValue'] const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import('vue')['unref'] + const updateChildDictionary: typeof import('./src/api/dictApi')['updateChildDictionary'] + const updateParentDictionary: typeof import('./src/api/dictApi')['updateParentDictionary'] const useAttrs: typeof import('vue')['useAttrs'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import('vue')['useCssVars'] diff --git a/src/api/dictApi.ts b/src/api/dictApi.ts new file mode 100644 index 0000000..67584e3 --- /dev/null +++ b/src/api/dictApi.ts @@ -0,0 +1,114 @@ +import http from "@/utils/request"; + +const dictUrl = "/api/v1/AdminDictionary" + +interface DictRow { + uuid?: string + parentId?: string + parentValue?: string + label: string + labelEn?: string + remark?: string + value: string + tags?: string[] + createTime?: Date + createUserId?: string +} + +// 获取父级字典 +export function getParentDictionary(label: string) { + return http({ + url: "/api/v1/AdminDictionary/GetParentDictionaries", + method: 'POST', + data: label + }) +} +// 新增父级字典 +/** + * + * @param data 只需要label和value + * @returns + */ +export function addParentDictionary(data: DictRow) { + data.createTime = null; + data.createUserId = ''; + data.labelEn = ''; + data.remark = ''; + data.tags = []; + data.uuid = ''; + data.parentId = ''; + data.parentValue = ''; + return http({ + url: "/api/v1/AdminDictionary/AddParentDictionary", + method: 'POST', + data + }) +} +// 更新父级字典 +/** + * + * @param data 只需要label + * @returns + */ +export function updateParentDictionary(data: DictRow) { + return http({ + url: "/api/v1/AdminDictionary/UpdateParentDictionary", + method: 'PUT', + data + }) +} +// 删除父级字典 +export function deleteParentDictionary(uuid: string) { + return http({ + url: "/api/v1/AdminDictionary/DeleteParentDictionary", + method: 'DELETE', + data: uuid + }) +} +// 新增子级字典 +/** + * + * @param data 必需parentId, parentValue, label, value + * @returns + */ +export function addChildDictionary(data: DictRow) { + return http({ + url: "/api/v1/AdminDictionary/CreateChildDictionary", + method: 'POST', + data + }) +} +// 更新子级字典 +/** + * + * @param data 必需uuid, label, value + * @returns + */ +export function updateChildDictionary(data: DictRow) { + return http({ + url: "/api/v1/AdminDictionary/UpdateChildDictionary", + method: 'PUT', + data + }) +} +// 删除子级字典 +export function deleteChildDictionary(uuid: string) { + return http({ + url: "/api/v1/AdminDictionary/DeleteChildDictionary", + method: 'DELETE', + data: uuid + }) +} +// 获取子级字典 +/** + * + * @param data 必需value, 非必需tags + * @returns + */ +export function getChildDictionary(data: DictRow) { + return http({ + url: "/api/v1/AdminDictionary/GetChildDictionaries", + method: 'POSt', + data + }) +} \ No newline at end of file diff --git a/src/views/system/dict/compoents/DictMain.vue b/src/views/system/dict/compoents/DictMain.vue new file mode 100644 index 0000000..3d6cb37 --- /dev/null +++ b/src/views/system/dict/compoents/DictMain.vue @@ -0,0 +1,721 @@ + + + + + + + + + {{ tableTitle }} + + + + + + + + 查询 + + + + + + 新增 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ tag }} + + + + + + + 取消 + 提交 + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/system/dict/compoents/DictNav.vue b/src/views/system/dict/compoents/DictNav.vue new file mode 100644 index 0000000..460c2c9 --- /dev/null +++ b/src/views/system/dict/compoents/DictNav.vue @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + 新增父级字典 + + + + + + + {{ item.label }} + + modifyParentDict(e, item)"> + + + deleteParentDict(e, item)"> + + + + + + + + + + + + + + + + + + + + 取消 + 提交 + + + + + + + + + + \ No newline at end of file diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index a629b9c..88c2902 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - + + + + - \ No newline at end of file + + \ No newline at end of file