diff --git a/src/assets/svg/plus.svg b/src/assets/svg/plus.svg
new file mode 100644
index 0000000..c01a1b5
--- /dev/null
+++ b/src/assets/svg/plus.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/global.d.ts b/src/global.d.ts
index aeeaa9e..ee1c048 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -162,14 +162,14 @@ interface PageParam {
sortOrder?: string
}
-interface TableParams {
+interface TableParam {
pagination?: _TablePaginationConfig
sortField?: React.Key | readonly React.Key[]
sortOrder?: _SortOrder
filters?: Record
}
-interface GetSysLogParams extends PageParam {
+interface GetSysLogParam extends PageParam {
searchRequestUrl?: string
searchRegex?: boolean
searchStartTime?: string
@@ -195,7 +195,7 @@ interface SysLogGetVo {
operateUsername: string
}
-interface GetRoleParams extends PageParam {
+interface GetRoleParam extends PageParam {
searchName?: string
searchRegex?: boolean
}
@@ -210,3 +210,8 @@ interface RoleWithPowerGetVo {
operations: OperationVo[]
tree: _DataNode[]
}
+
+interface RoleChangeStatusParam {
+ id: string
+ enable: boolean
+}
diff --git a/src/pages/system/Log.tsx b/src/pages/system/Log.tsx
index 71a722f..0be913f 100644
--- a/src/pages/system/Log.tsx
+++ b/src/pages/system/Log.tsx
@@ -14,7 +14,7 @@ import FlexBox from '@/components/common/FlexBox'
const Log: React.FC = () => {
const [logData, setLogData] = useState([])
const [loading, setLoading] = useState(false)
- const [tableParams, setTableParams] = useState({
+ const [tableParams, setTableParams] = useState({
pagination: {
current: 1,
pageSize: 20,
diff --git a/src/pages/system/Role.tsx b/src/pages/system/Role.tsx
index 05c1804..a7be892 100644
--- a/src/pages/system/Role.tsx
+++ b/src/pages/system/Role.tsx
@@ -3,13 +3,19 @@ import FitFullScreen from '@/components/common/FitFullScreen'
import HideScrollbar from '@/components/common/HideScrollbar'
import FlexBox from '@/components/common/FlexBox'
import Card from '@/components/common/Card'
-import { r_getRole } from '@/services/system.tsx'
-import { DATABASE_SELECT_SUCCESS } from '@/constants/common.constants.ts'
+import { r_changeRoleStatus, r_getRole } from '@/services/system.tsx'
+import {
+ COLOR_ERROR_SECONDARY,
+ COLOR_FONT_SECONDARY,
+ COLOR_PRODUCTION,
+ DATABASE_SELECT_SUCCESS
+} from '@/constants/common.constants.ts'
+import Icon from '@ant-design/icons'
const Role: React.FC = () => {
const [roleData, setRoleData] = useState([])
const [loading, setLoading] = useState(false)
- const [tableParams, setTableParams] = useState({
+ const [tableParams, setTableParams] = useState({
pagination: {
current: 1,
pageSize: 20,
@@ -38,6 +44,35 @@ const Role: React.FC = () => {
align: 'center',
render: (value) =>
value ? 启用 : 禁用
+ },
+ {
+ title: '操作',
+ dataIndex: 'enable',
+ width: '15em',
+ align: 'center',
+ render: (value, record) => (
+ <>
+
+ {value ? (
+
+ 禁用
+
+ ) : (
+
+ 启用
+
+ )}
+ 编辑
+ 删除
+
+ >
+ )
}
]
@@ -105,6 +140,12 @@ const Role: React.FC = () => {
getRole()
}
+ const handleOnChangStatusBtnClick = (id: string, newStatus: boolean) => {
+ return () => {
+ void r_changeRoleStatus({ id, enable: newStatus })
+ }
+ }
+
const getRole = () => {
if (loading) {
return
@@ -244,7 +285,55 @@ const Role: React.FC = () => {
autoHideWaitingTime={500}
>
-
+
+
+
+
+
+
+
+
+ 名称
+
+ }
+ suffix={
+ <>
+ {!isRegexLegal ? (
+
+ 非法表达式
+
+ ) : undefined}
+
+ .*
+
+ >
+ }
+ allowClear
+ value={searchName}
+ onChange={handleOnSearchNameChange}
+ onKeyDown={handleOnSearchNameKeyDown}
+ status={isRegexLegal ? undefined : 'error'}
+ />
+
+
+
+ 查询
+
+
+
(url: string, data?: object): Promise>> {
return await request.request('PUT', url, { data })
},
+ async patch(url: string, data?: object): Promise>> {
+ return await request.request('PATCH', url, { data })
+ },
async delete(url: string, data?: object): Promise>> {
return await request.request('DELETE', url, { params: data })
},
diff --git a/src/services/system.tsx b/src/services/system.tsx
index ae3fa72..68bdc2e 100644
--- a/src/services/system.tsx
+++ b/src/services/system.tsx
@@ -1,8 +1,11 @@
import request from '@/services/index'
import { URL_API_SYS_LOG, URL_API_SYS_ROLE } from '@/constants/urls.constants'
-export const r_getSysLog = (param: GetSysLogParams) =>
+export const r_getSysLog = (param: GetSysLogParam) =>
request.get>(URL_API_SYS_LOG, { ...param })
-export const r_getRole = (parm: GetRoleParams) =>
- request.get>(URL_API_SYS_ROLE, { ...parm })
+export const r_getRole = (param: GetRoleParam) =>
+ request.get>(URL_API_SYS_ROLE, { ...param })
+
+export const r_changeRoleStatus = (param: RoleChangeStatusParam) =>
+ request.patch(URL_API_SYS_ROLE, { ...param })