Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
查尔斯-BUG万象集
Continew Admin
提交
a79b3e0e
Continew Admin
项目概览
查尔斯-BUG万象集
/
Continew Admin
8 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
分析
仓库
DevOps
项目成员
Pages
Continew Admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a79b3e0e
编写于
2月 26, 2023
作者:
查尔斯-BUG万象集
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增:新增公共查询枚举字典 API,优化前端获取枚举数据的方式
上级
8200ea82
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
205 addition
and
83 deletion
+205
-83
continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/ContiNewAdminProperties.java
...min/common/config/properties/ContiNewAdminProperties.java
+5
-0
continew-admin-common/src/main/java/top/charles7c/cnadmin/common/enums/SuccessFailureStatusEnum.java
...rles7c/cnadmin/common/enums/SuccessFailureStatusEnum.java
+42
-0
continew-admin-ui/components.d.ts
continew-admin-ui/components.d.ts
+0
-3
continew-admin-ui/src/api/common/index.ts
continew-admin-ui/src/api/common/index.ts
+8
-8
continew-admin-ui/src/main.ts
continew-admin-ui/src/main.ts
+4
-0
continew-admin-ui/src/store/index.ts
continew-admin-ui/src/store/index.ts
+2
-1
continew-admin-ui/src/store/modules/dict/index.ts
continew-admin-ui/src/store/modules/dict/index.ts
+54
-0
continew-admin-ui/src/store/modules/dict/types.ts
continew-admin-ui/src/store/modules/dict/types.ts
+9
-0
continew-admin-ui/src/utils/dict.ts
continew-admin-ui/src/utils/dict.ts
+27
-0
continew-admin-ui/src/views/monitor/log/login/index.vue
continew-admin-ui/src/views/monitor/log/login/index.vue
+3
-7
continew-admin-ui/src/views/monitor/log/operation/index.vue
continew-admin-ui/src/views/monitor/log/operation/index.vue
+2
-6
continew-admin-ui/src/views/system/dept/index.vue
continew-admin-ui/src/views/system/dept/index.vue
+3
-10
continew-admin-ui/src/views/system/menu/index.vue
continew-admin-ui/src/views/system/menu/index.vue
+3
-10
continew-admin-ui/src/views/system/post/index.vue
continew-admin-ui/src/views/system/post/index.vue
+2
-6
continew-admin-ui/src/views/system/role/index.vue
continew-admin-ui/src/views/system/role/index.vue
+4
-14
continew-admin-ui/src/views/system/user/index.vue
continew-admin-ui/src/views/system/user/index.vue
+7
-14
continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java
...7c/cnadmin/webapi/controller/common/CommonController.java
+28
-4
continew-admin-webapi/src/main/resources/application.yml
continew-admin-webapi/src/main/resources/application.yml
+2
-0
未找到文件。
continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/ContiNewAdminProperties.java
浏览文件 @
a79b3e0e
...
...
@@ -64,6 +64,11 @@ public class ContiNewAdminProperties {
*/
private
String
url
;
/**
* 基本包
*/
private
String
basePackage
;
/**
* 作者信息
*/
...
...
continew-admin-common/src/main/java/top/charles7c/cnadmin/common/enums/SuccessFailureStatusEnum.java
0 → 100644
浏览文件 @
a79b3e0e
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
top.charles7c.cnadmin.common.enums
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
top.charles7c.cnadmin.common.base.BaseEnum
;
/**
* 成功/失败状态枚举
*
* @author Charles7c
* @since 2023/2/26 21:35
*/
@Getter
@RequiredArgsConstructor
public
enum
SuccessFailureStatusEnum
implements
BaseEnum
<
Integer
,
String
>
{
/** 成功 */
SUCCESS
(
1
,
"成功"
),
/** 失败 */
FAILURE
(
2
,
"失败"
),;
private
final
Integer
value
;
private
final
String
description
;
}
continew-admin-ui/components.d.ts
浏览文件 @
a79b3e0e
...
...
@@ -10,7 +10,6 @@ declare module '@vue/runtime-core' {
AAffix
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Affix
'
]
AAlert
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Alert
'
]
AAvatar
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Avatar
'
]
AAvatarGroup
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
AvatarGroup
'
]
ABadge
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Badge
'
]
ABreadcrumb
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Breadcrumb
'
]
ABreadcrumbItem
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
BreadcrumbItem
'
]
...
...
@@ -20,7 +19,6 @@ declare module '@vue/runtime-core' {
ACardMeta
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
CardMeta
'
]
ACarousel
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Carousel
'
]
ACarouselItem
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
CarouselItem
'
]
ACascader
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Cascader
'
]
ACheckbox
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Checkbox
'
]
ACol
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Col
'
]
AConfigProvider
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
ConfigProvider
'
]
...
...
@@ -60,7 +58,6 @@ declare module '@vue/runtime-core' {
ASelect
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Select
'
]
ASkeleton
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Skeleton
'
]
ASkeletonLine
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
SkeletonLine
'
]
ASkeletonShape
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
SkeletonShape
'
]
ASpace
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Space
'
]
ASpin
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Spin
'
]
AStatistic
:
typeof
import
(
'
@arco-design/web-vue
'
)[
'
Statistic
'
]
...
...
continew-admin-ui/src/api/common/index.ts
浏览文件 @
a79b3e0e
...
...
@@ -5,11 +5,7 @@ import { MenuParam } from '@/api/system/menu';
import
{
RoleParam
}
from
'
@/api/system/role
'
;
import
{
PostParam
}
from
'
@/api/system/post
'
;
import
{
TreeNodeData
}
from
'
@arco-design/web-vue
'
;
export
interface
LabelValueRecord
{
label
:
string
;
value
:
any
;
}
import
{
LabelValueState
}
from
'
@/store/modules/dict/types
'
;
export
function
listDeptTree
(
params
:
DeptParam
)
{
return
axios
.
get
<
TreeNodeData
[]
>
(
'
/common/tree/dept
'
,
{
...
...
@@ -30,7 +26,7 @@ export function listMenuTree(params: MenuParam) {
}
export
function
listRoleDict
(
params
:
RoleParam
)
{
return
axios
.
get
<
LabelValue
Record
[]
>
(
'
/common/dict/role
'
,
{
return
axios
.
get
<
LabelValue
State
[]
>
(
'
/common/dict/role
'
,
{
params
,
paramsSerializer
:
(
obj
)
=>
{
return
qs
.
stringify
(
obj
);
...
...
@@ -39,10 +35,14 @@ export function listRoleDict(params: RoleParam) {
}
export
function
listPostDict
(
params
:
PostParam
)
{
return
axios
.
get
<
LabelValue
Record
[]
>
(
'
/common/dict/post
'
,
{
return
axios
.
get
<
LabelValue
State
[]
>
(
'
/common/dict/post
'
,
{
params
,
paramsSerializer
:
(
obj
)
=>
{
return
qs
.
stringify
(
obj
);
},
});
}
\ No newline at end of file
}
export
function
listEnumDict
(
enumTypeName
:
string
)
{
return
axios
.
get
<
LabelValueState
[]
>
(
`/common/dict/enum/
${
enumTypeName
}
`
);
}
continew-admin-ui/src/main.ts
浏览文件 @
a79b3e0e
...
...
@@ -4,6 +4,7 @@ import ArcoVueIcon from '@arco-design/web-vue/es/icon';
// eslint-disable-next-line import/no-unresolved
import
'
virtual:svg-icons-register
'
;
import
globalComponents
from
'
@/components
'
;
import
useDict
from
'
@/utils/dict
'
;
import
router
from
'
./router
'
;
import
store
from
'
./store
'
;
import
i18n
from
'
./locale
'
;
...
...
@@ -16,6 +17,9 @@ import '@/utils/request';
const
app
=
createApp
(
App
);
// 全局方法挂载
app
.
config
.
globalProperties
.
useDict
=
useDict
;
app
.
use
(
ArcoVue
,
{});
app
.
use
(
ArcoVueIcon
);
...
...
continew-admin-ui/src/store/index.ts
浏览文件 @
a79b3e0e
import
{
createPinia
}
from
'
pinia
'
;
import
useAppStore
from
'
./modules/app
'
;
import
useLoginStore
from
'
./modules/login
'
;
import
useDictStore
from
'
./modules/dict
'
;
import
useTabBarStore
from
'
./modules/tab-bar
'
;
const
pinia
=
createPinia
();
export
{
useAppStore
,
useLoginStore
,
useTabBarStore
};
export
{
useAppStore
,
useLoginStore
,
use
DictStore
,
use
TabBarStore
};
export
default
pinia
;
continew-admin-ui/src/store/modules/dict/index.ts
0 → 100644
浏览文件 @
a79b3e0e
import
{
defineStore
}
from
'
pinia
'
;
import
{
DictState
,
LabelValueState
}
from
'
@/store/modules/dict/types
'
;
const
useDictStore
=
defineStore
(
'
dict
'
,
{
state
:
()
=>
({
dict
:
[]
as
Array
<
DictState
>
}),
actions
:
{
// 获取字典
getDict
(
_name
:
string
)
{
if
(
_name
===
null
&&
_name
===
''
)
{
return
null
;
}
try
{
for
(
let
i
=
0
;
i
<
this
.
dict
.
length
;
i
+=
1
)
{
if
(
this
.
dict
[
i
].
name
===
_name
)
{
return
this
.
dict
[
i
].
detail
;
}
}
}
catch
(
e
)
{
console
.
log
(
e
);
}
return
null
;
},
// 设置字典
setDict
(
_name
:
string
,
detail
:
Array
<
LabelValueState
>
)
{
if
(
_name
!==
null
&&
_name
!==
''
)
{
this
.
dict
.
push
({
name
:
_name
,
detail
,
});
}
},
// 删除字典
deleteDict
(
_name
:
string
)
{
let
bln
=
false
;
try
{
for
(
let
i
=
0
;
i
<
this
.
dict
.
length
;
i
+=
1
)
{
if
(
this
.
dict
[
i
].
name
===
_name
)
{
this
.
dict
.
splice
(
i
,
1
);
return
true
;
}
}
}
catch
(
e
)
{
bln
=
false
;
}
return
bln
;
},
// 清空字典
cleanDict
()
{
this
.
dict
=
[];
},
},
});
export
default
useDictStore
;
continew-admin-ui/src/store/modules/dict/types.ts
0 → 100644
浏览文件 @
a79b3e0e
export
interface
LabelValueState
{
label
:
string
;
value
:
any
;
}
export
interface
DictState
{
name
:
string
;
detail
:
Array
<
LabelValueState
>
;
}
continew-admin-ui/src/utils/dict.ts
0 → 100644
浏览文件 @
a79b3e0e
import
{
ref
,
toRefs
}
from
'
vue
'
;
import
{
listEnumDict
}
from
'
@/api/common
'
;
import
{
useDictStore
}
from
'
@/store
'
;
/**
* 获取字典数据
*
* @param names 字典名列表
*/
export
default
function
useDict
(...
names
:
Array
<
string
>
)
{
const
res
=
ref
<
any
>
({});
return
(()
=>
{
names
.
forEach
((
name
:
string
)
=>
{
res
.
value
[
name
]
=
[];
const
dict
=
useDictStore
().
getDict
(
name
);
if
(
dict
)
{
res
.
value
[
name
]
=
dict
;
}
else
{
listEnumDict
(
name
).
then
((
resp
)
=>
{
res
.
value
[
name
]
=
resp
.
data
;
useDictStore
().
setDict
(
name
,
res
.
value
[
name
]);
});
}
});
return
toRefs
(
res
.
value
);
})();
}
continew-admin-ui/src/views/monitor/log/login/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -10,10 +10,10 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
SuccessFailureStatusEnum
"
placeholder=
"登录状态搜索"
allow-clear
style=
"width: 150px
;
"
style=
"width: 150px"
/>
</a-form-item>
<a-form-item
field=
"createTime"
hide-label
>
...
...
@@ -81,7 +81,6 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
}
from
'
@arco-design/web-vue
'
;
import
{
LoginLogParam
,
LoginLogRecord
,
...
...
@@ -89,14 +88,11 @@
}
from
'
@/api/monitor/log
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
SuccessFailureStatusEnum
}
=
proxy
.
useDict
(
'
SuccessFailureStatusEnum
'
);
const
loginLogList
=
ref
<
LoginLogRecord
[]
>
([]);
const
total
=
ref
(
0
);
const
loading
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
成功
'
,
value
:
1
},
{
label
:
'
失败
'
,
value
:
2
},
]);
const
data
=
reactive
({
// 查询参数
...
...
continew-admin-ui/src/views/monitor/log/operation/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -19,7 +19,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
SuccessFailureStatusEnum
"
placeholder=
"操作状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -91,7 +91,6 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
}
from
'
@arco-design/web-vue
'
;
import
{
OperationLogParam
,
OperationLogRecord
,
...
...
@@ -99,14 +98,11 @@
}
from
'
@/api/monitor/log
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
SuccessFailureStatusEnum
}
=
proxy
.
useDict
(
'
SuccessFailureStatusEnum
'
);
const
operationLogList
=
ref
<
OperationLogRecord
[]
>
([]);
const
total
=
ref
(
0
);
const
loading
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
成功
'
,
value
:
1
},
{
label
:
'
失败
'
,
value
:
2
},
]);
const
data
=
reactive
({
// 查询参数
...
...
continew-admin-ui/src/views/system/dept/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -19,7 +19,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
DisEnableStatusEnum
"
placeholder=
"状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -282,11 +282,7 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
,
TreeNodeData
,
TableData
,
}
from
'
@arco-design/web-vue
'
;
import
{
TreeNodeData
,
TableData
}
from
'
@arco-design/web-vue
'
;
import
{
DeptRecord
,
DeptParam
,
...
...
@@ -299,6 +295,7 @@
import
{
listDeptTree
}
from
'
@/api/common
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
DisEnableStatusEnum
}
=
proxy
.
useDict
(
'
DisEnableStatusEnum
'
);
const
deptList
=
ref
<
DeptRecord
[]
>
([]);
const
dept
=
ref
<
DeptRecord
>
({
...
...
@@ -322,10 +319,6 @@
const
exportLoading
=
ref
(
false
);
const
visible
=
ref
(
false
);
const
detailVisible
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
启用
'
,
value
:
1
},
{
label
:
'
禁用
'
,
value
:
2
},
]);
const
treeData
=
ref
<
TreeNodeData
[]
>
();
const
data
=
reactive
({
...
...
continew-admin-ui/src/views/system/menu/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -19,7 +19,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
DisEnableStatusEnum
"
placeholder=
"状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -335,11 +335,7 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
,
TreeNodeData
,
TableData
,
}
from
'
@arco-design/web-vue
'
;
import
{
TreeNodeData
,
TableData
}
from
'
@arco-design/web-vue
'
;
import
{
MenuRecord
,
MenuParam
,
...
...
@@ -352,6 +348,7 @@
import
{
listMenuTree
}
from
'
@/api/common
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
DisEnableStatusEnum
}
=
proxy
.
useDict
(
'
DisEnableStatusEnum
'
);
const
menuList
=
ref
<
MenuRecord
[]
>
([]);
const
ids
=
ref
<
Array
<
number
>>
([]);
...
...
@@ -364,10 +361,6 @@
const
expandAll
=
ref
(
false
);
const
visible
=
ref
(
false
);
const
showChooseIcon
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
启用
'
,
value
:
1
},
{
label
:
'
禁用
'
,
value
:
2
},
]);
const
treeData
=
ref
<
TreeNodeData
[]
>
();
const
data
=
reactive
({
...
...
continew-admin-ui/src/views/system/post/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -19,7 +19,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
DisEnableStatusEnum
"
placeholder=
"状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -267,7 +267,6 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
}
from
'
@arco-design/web-vue
'
;
import
{
PostRecord
,
PostParam
,
...
...
@@ -279,6 +278,7 @@
}
from
'
@/api/system/post
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
DisEnableStatusEnum
}
=
proxy
.
useDict
(
'
DisEnableStatusEnum
'
);
const
postList
=
ref
<
PostRecord
[]
>
([]);
const
post
=
ref
<
PostRecord
>
({
...
...
@@ -301,10 +301,6 @@
const
exportLoading
=
ref
(
false
);
const
visible
=
ref
(
false
);
const
detailVisible
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
启用
'
,
value
:
1
},
{
label
:
'
禁用
'
,
value
:
2
},
]);
const
data
=
reactive
({
// 查询参数
...
...
continew-admin-ui/src/views/system/role/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -19,7 +19,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
DisEnableStatusEnum
"
placeholder=
"状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -244,7 +244,7 @@
<a-form-item
label=
"数据权限"
field=
"dataScope"
>
<a-select
v-model=
"form.dataScope"
:options=
"
dataScopeOptions
"
:options=
"
DataScopeEnum
"
placeholder=
"请选择数据权限"
/>
</a-form-item>
...
...
@@ -378,7 +378,7 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
}
from
'
vue
'
;
import
{
SelectOptionData
,
TreeNodeData
}
from
'
@arco-design/web-vue
'
;
import
{
TreeNodeData
}
from
'
@arco-design/web-vue
'
;
import
{
RoleRecord
,
RoleParam
,
...
...
@@ -391,6 +391,7 @@
import
{
listMenuTree
,
listDeptTree
}
from
'
@/api/common
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
DataScopeEnum
,
DisEnableStatusEnum
}
=
proxy
.
useDict
(
'
DataScopeEnum
'
,
'
DisEnableStatusEnum
'
);
const
roleList
=
ref
<
RoleRecord
[]
>
([]);
const
role
=
ref
<
RoleRecord
>
({
...
...
@@ -417,17 +418,6 @@
const
exportLoading
=
ref
(
false
);
const
visible
=
ref
(
false
);
const
detailVisible
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
启用
'
,
value
:
1
},
{
label
:
'
禁用
'
,
value
:
2
},
]);
const
dataScopeOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
全部数据权限
'
,
value
:
1
},
{
label
:
'
本部门及以下数据权限
'
,
value
:
2
},
{
label
:
'
本部门数据权限
'
,
value
:
3
},
{
label
:
'
仅本人数据权限
'
,
value
:
4
},
{
label
:
'
自定义数据权限
'
,
value
:
5
},
]);
const
menuLoading
=
ref
(
false
);
const
deptLoading
=
ref
(
false
);
const
menuOptions
=
ref
<
TreeNodeData
[]
>
([]);
...
...
continew-admin-ui/src/views/system/user/index.vue
浏览文件 @
a79b3e0e
...
...
@@ -36,7 +36,7 @@
<a-form-item
field=
"status"
hide-label
>
<a-select
v-model=
"queryParams.status"
:options=
"
statusOptions
"
:options=
"
DisEnableStatusEnum
"
placeholder=
"状态搜索"
allow-clear
style=
"width: 150px"
...
...
@@ -484,7 +484,7 @@
<
script
lang=
"ts"
setup
>
import
{
getCurrentInstance
,
ref
,
toRefs
,
reactive
,
watch
}
from
'
vue
'
;
import
{
SelectOptionData
,
TreeNodeData
}
from
'
@arco-design/web-vue
'
;
import
{
TreeNodeData
}
from
'
@arco-design/web-vue
'
;
import
{
UserRecord
,
UserParam
,
...
...
@@ -496,15 +496,12 @@
resetPassword
,
updateUserRole
,
}
from
'
@/api/system/user
'
;
import
{
LabelValueRecord
,
listDeptTree
,
listPostDict
,
listRoleDict
,
}
from
'
@/api/common
'
;
import
{
listDeptTree
,
listPostDict
,
listRoleDict
}
from
'
@/api/common
'
;
import
{
LabelValueState
}
from
'
@/store/modules/dict/types
'
;
import
getAvatar
from
'
@/utils/avatar
'
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
DisEnableStatusEnum
}
=
proxy
.
useDict
(
'
DisEnableStatusEnum
'
);
const
userList
=
ref
<
UserRecord
[]
>
([]);
const
user
=
ref
<
UserRecord
>
({
...
...
@@ -535,16 +532,12 @@
const
visible
=
ref
(
false
);
const
userRoleVisible
=
ref
(
false
);
const
detailVisible
=
ref
(
false
);
const
statusOptions
=
ref
<
SelectOptionData
[]
>
([
{
label
:
'
启用
'
,
value
:
1
},
{
label
:
'
禁用
'
,
value
:
2
},
]);
const
deptLoading
=
ref
(
false
);
const
postLoading
=
ref
(
false
);
const
roleLoading
=
ref
(
false
);
const
deptOptions
=
ref
<
TreeNodeData
[]
>
([]);
const
postOptions
=
ref
<
LabelValue
Record
[]
>
([]);
const
roleOptions
=
ref
<
LabelValue
Record
[]
>
([]);
const
postOptions
=
ref
<
LabelValue
State
[]
>
([]);
const
roleOptions
=
ref
<
LabelValue
State
[]
>
([]);
const
deptTree
=
ref
<
TreeNodeData
[]
>
([]);
const
deptName
=
ref
(
''
);
...
...
continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java
浏览文件 @
a79b3e0e
...
...
@@ -16,7 +16,8 @@
package
top.charles7c.cnadmin.webapi.controller.common
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -24,12 +25,13 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
cn.hutool.core.lang.tree.Tree
;
import
cn.hutool.core.util.ClassUtil
;
import
top.charles7c.cnadmin.common.base.BaseEnum
;
import
top.charles7c.cnadmin.common.config.properties.ContiNewAdminProperties
;
import
top.charles7c.cnadmin.common.model.query.SortQuery
;
import
top.charles7c.cnadmin.common.model.vo.LabelValueVO
;
import
top.charles7c.cnadmin.common.model.vo.R
;
...
...
@@ -55,6 +57,7 @@ import top.charles7c.cnadmin.system.service.RoleService;
*/
@Tag
(
name
=
"公共 API"
)
@Log
(
ignore
=
true
)
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/common"
)
...
...
@@ -64,6 +67,7 @@ public class CommonController {
private
final
MenuService
menuService
;
private
final
RoleService
roleService
;
private
final
PostService
postService
;
private
final
ContiNewAdminProperties
properties
;
@Operation
(
summary
=
"查询部门树"
,
description
=
"查询树结构的部门列表"
)
@GetMapping
(
"/tree/dept"
)
...
...
@@ -96,4 +100,24 @@ public class CommonController {
List
<
LabelValueVO
<
Long
>>
dictList
=
postService
.
buildDict
(
list
);
return
R
.
ok
(
dictList
);
}
@Operation
(
summary
=
"查询枚举字典"
,
description
=
"查询枚举字典列表"
)
@GetMapping
(
"/dict/enum/{enumTypeName}"
)
public
R
<
List
<
LabelValueVO
>>
listEnumDict
(
@PathVariable
String
enumTypeName
)
{
// 扫描所有 BaseEnum 枚举基类的子类
Set
<
Class
<?>>
classSet
=
ClassUtil
.
scanPackageBySuper
(
properties
.
getBasePackage
(),
BaseEnum
.
class
);
Optional
<
Class
<?>>
first
=
classSet
.
stream
().
filter
(
c
->
c
.
getSimpleName
().
equalsIgnoreCase
(
enumTypeName
)).
findFirst
();
if
(!
first
.
isPresent
())
{
return
R
.
fail
(
"枚举字典不存在"
);
}
// 转换枚举为字典列表
Class
<?>
enumClass
=
first
.
get
();
Object
[]
enumConstants
=
enumClass
.
getEnumConstants
();
List
<
LabelValueVO
>
dictList
=
Arrays
.
stream
(
enumConstants
).
map
(
e
->
{
BaseEnum
<
Integer
,
String
>
baseEnum
=
(
BaseEnum
<
Integer
,
String
>)
e
;
return
new
LabelValueVO
(
baseEnum
.
getDescription
(),
baseEnum
.
getValue
());
}).
collect
(
Collectors
.
toList
());
return
R
.
ok
(
dictList
);
}
}
continew-admin-webapi/src/main/resources/application.yml
浏览文件 @
a79b3e0e
...
...
@@ -10,6 +10,8 @@ continew-admin:
description
:
ContiNew Admin 中后台管理框架(孵化中),Continue New Admin,持续以最新流行技术栈构建。
# URL
url
:
https://github.com/Charles7c/continew-admin
# 基本包
basePackage
:
top.charles7c.cnadmin
## 作者信息配置
author
:
name
:
Charles7c
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录