From 47bd58577ba2b596f87ff2aa579c73d0a3a9ae69 Mon Sep 17 00:00:00 2001
From: Leo_Ding <2405260743@qq.com>
Date: Fri, 3 Oct 2025 15:19:27 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/modules/dict.js | 26 ++
src/hooks/index.js | 1 +
src/hooks/useSpining.js | 15 +
src/locales/lang/zh-CN/menu.js | 2 +
src/router/routes/dict.js | 10 +
src/router/routes/system.js | 22 ++
.../system/dict/components/EditDictDialog.vue | 3 +
.../dictionary/components/Department.vue | 169 +++++++++++
.../components/EditDepartmentDialog.vue | 131 ++++++++
.../dictionary/components/EditDialog.vue | 154 ++++++++++
.../components/EditDialogDetail.vue | 166 ++++++++++
src/views/system/dictionary/detail.vue | 176 +++++++++++
src/views/system/dictionary/index.vue | 284 ++++++++++++++++++
13 files changed, 1159 insertions(+)
create mode 100644 src/apis/modules/dict.js
create mode 100644 src/hooks/useSpining.js
create mode 100644 src/router/routes/dict.js
create mode 100644 src/views/system/dictionary/components/Department.vue
create mode 100644 src/views/system/dictionary/components/EditDepartmentDialog.vue
create mode 100644 src/views/system/dictionary/components/EditDialog.vue
create mode 100644 src/views/system/dictionary/components/EditDialogDetail.vue
create mode 100644 src/views/system/dictionary/detail.vue
create mode 100644 src/views/system/dictionary/index.vue
diff --git a/src/apis/modules/dict.js b/src/apis/modules/dict.js
new file mode 100644
index 0000000..ad32544
--- /dev/null
+++ b/src/apis/modules/dict.js
@@ -0,0 +1,26 @@
+/**
+ * 区域模块接口
+ */
+import request from '@/utils/request'
+// 获取项目列表
+export const getProjectList = (params) => request.basic.get('/api/v1/dictionary-categories', params)
+// 获取单挑数据
+export const getItem = (id) => request.basic.get(`/api/v1/dictionary-categories/${id}`)
+// 添加条目
+export const createItem = (params) => request.basic.post('/api/v1/dictionary-categories', params)
+// 更新role
+export const updateItem = (id, params) => request.basic.put(`/api/v1/dictionary-categories/${id}`, params)
+// 删除数据
+export const delItem = (id) => request.basic.delete(`/api/v1/dictionary-categories/${id}`)
+
+// 获取单挑数据
+export const getDetailCode = (params) => request.basic.get(`/api/v1/dictionaries`,params)
+// 获取单挑数据
+export const getDetailItem = (id) => request.basic.get(`/api/v1/dictionaries/${id}`)
+// 添加条目
+export const createDetailItem = (params) => request.basic.post('/api/v1/dictionaries', params)
+// 更新role
+export const updateDetailItem = (id, params) => request.basic.put(`/api/v1/dictionaries/${id}`, params)
+// 删除数据
+export const delDetailItem = (id) => request.basic.delete(`/api/v1/dictionaries/${id}`)
+
diff --git a/src/hooks/index.js b/src/hooks/index.js
index 2eeeb6b..b8900ea 100644
--- a/src/hooks/index.js
+++ b/src/hooks/index.js
@@ -4,3 +4,4 @@ export { default as useMenu } from './useMenu'
export { default as useModal } from './useModal'
export { default as useMultiTab } from './useMultiTab'
export { default as usePagination } from './usePagination'
+export { default as useSpining } from './useSpining'
diff --git a/src/hooks/useSpining.js b/src/hooks/useSpining.js
new file mode 100644
index 0000000..2b02ce2
--- /dev/null
+++ b/src/hooks/useSpining.js
@@ -0,0 +1,15 @@
+import { ref } from 'vue'
+export default () => {
+ const spining = ref(false) // 直接使用基本类型ref
+ const showSpining = () => {
+ spining.value = true
+ }
+ const hideSpining = () => {
+ spining.value = false
+ }
+ return {
+ spining, // 直接暴露ref
+ showSpining,
+ hideSpining,
+ }
+}
diff --git a/src/locales/lang/zh-CN/menu.js b/src/locales/lang/zh-CN/menu.js
index 42d2e5b..43cd0cd 100644
--- a/src/locales/lang/zh-CN/menu.js
+++ b/src/locales/lang/zh-CN/menu.js
@@ -32,4 +32,6 @@ export default {
account: '个人页',
'account.trigger': '触发报错',
'account.logout': '退出登录',
+ 'dict': '字典管理',
+ 'dict-detail': '字典数据',
}
diff --git a/src/router/routes/dict.js b/src/router/routes/dict.js
new file mode 100644
index 0000000..63131fb
--- /dev/null
+++ b/src/router/routes/dict.js
@@ -0,0 +1,10 @@
+export default [
+ {
+ path: '/system/dict',
+ name: 'dict',
+ component: () => import('/system/dict/index.vue'),
+ meta: {
+ title: '字典管理',
+ },
+ },
+]
\ No newline at end of file
diff --git a/src/router/routes/system.js b/src/router/routes/system.js
index 768e3ce..6d968e0 100644
--- a/src/router/routes/system.js
+++ b/src/router/routes/system.js
@@ -57,6 +57,28 @@ export default [
permission: '*',
},
},
+ {
+ path: 'dict',
+ name: 'dict',
+ component: 'system/dictionary/index.vue',
+ meta: {
+ title: '字典管理',
+ isMenu: true,
+ keepAlive: true,
+ permission: '*',
+ },
+ },
+ {
+ path: 'dict-detail',
+ name: 'dict-detail',
+ component: 'system/dictionary/detail.vue',
+ meta: {
+ title: '字典数据',
+ isMenu: true,
+ keepAlive: true,
+ permission: '*',
+ },
+ },
],
},
]
diff --git a/src/views/system/dict/components/EditDictDialog.vue b/src/views/system/dict/components/EditDictDialog.vue
index 804b531..5300204 100644
--- a/src/views/system/dict/components/EditDictDialog.vue
+++ b/src/views/system/dict/components/EditDictDialog.vue
@@ -66,6 +66,7 @@ function handleEdit(record = {}) {
* 确定
*/
function handleOk() {
+ console.log('handleOk')
formRef.value
.validateFields()
.then(async (values) => {
@@ -77,6 +78,7 @@ function handleOk() {
let result = null
switch (modal.value.type) {
case 'create':
+ console.log('create')
result = await apis.common.create(params).catch(() => {
throw new Error()
})
@@ -93,6 +95,7 @@ function handleOk() {
emit('ok')
}
} catch (error) {
+ console.log(error)
hideLoading()
}
})
diff --git a/src/views/system/dictionary/components/Department.vue b/src/views/system/dictionary/components/Department.vue
new file mode 100644
index 0000000..efaefad
--- /dev/null
+++ b/src/views/system/dictionary/components/Department.vue
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+ 添加子部门
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+ 新建部门
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dictionary/components/EditDepartmentDialog.vue b/src/views/system/dictionary/components/EditDepartmentDialog.vue
new file mode 100644
index 0000000..e5a271f
--- /dev/null
+++ b/src/views/system/dictionary/components/EditDepartmentDialog.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dictionary/components/EditDialog.vue b/src/views/system/dictionary/components/EditDialog.vue
new file mode 100644
index 0000000..5e74c1a
--- /dev/null
+++ b/src/views/system/dictionary/components/EditDialog.vue
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dictionary/components/EditDialogDetail.vue b/src/views/system/dictionary/components/EditDialogDetail.vue
new file mode 100644
index 0000000..00b6c8c
--- /dev/null
+++ b/src/views/system/dictionary/components/EditDialogDetail.vue
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dictionary/detail.vue b/src/views/system/dictionary/detail.vue
new file mode 100644
index 0000000..65de5ed
--- /dev/null
+++ b/src/views/system/dictionary/detail.vue
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('button.reset') }}
+
+ {{ $t('button.search') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加数据
+
+
+
+
+
+
+
+ {{ $t('pages.system.user.edit') }}
+
+
+
+ 字典数据
+
+
+
+ {{ $t('pages.system.delete') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dictionary/index.vue b/src/views/system/dictionary/index.vue
new file mode 100644
index 0000000..6ade96a
--- /dev/null
+++ b/src/views/system/dictionary/index.vue
@@ -0,0 +1,284 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('button.reset') }}
+
+ {{ $t('button.search') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加字典
+
+
+
+
+
+ 启用
+ 停用
+
+
+
+
+ {{ $t('pages.system.user.edit') }}
+
+
+
+ 字典数据
+
+
+
+ {{ $t('pages.system.delete') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加数据
+
+
+
+
+
+
+ 启用
+ 停用
+
+
+
+
+ {{ $t('pages.system.user.edit') }}
+
+
+
+ {{ $t('pages.system.delete') }}
+
+
+
+
+
+
+
+
+
+
+
+