diff --git a/doc/RBAC 权限.sql b/doc/RBAC 权限.sql
new file mode 100644
index 0000000..6e70db9
--- /dev/null
+++ b/doc/RBAC 权限.sql
@@ -0,0 +1,66 @@
+CREATE TABLE auth_role
+(
+ [role_id] [int] IDENTITY(1,1) NOT NULL,
+ [role_name] [nvarchar](255) NOT NULL,
+ [created_on] [datetime] NOT NULL,
+ CONSTRAINT [PK_auth_role] PRIMARY KEY CLUSTERED
+(
+ [role_id] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+) ON [PRIMARY]
+
+ALTER TABLE auth_role ADD CONSTRAINT [DF_auth_role_created_on] DEFAULT (getdate()) FOR [created_on]
+
+CREATE TABLE auth_permission
+(
+ [role_id] [int] NOT NULL,
+ [res_id] [int] NOT NULL
+) ON [PRIMARY]
+
+CREATE TABLE auth_resource
+(
+ [res_id] [int] IDENTITY(1,1) NOT NULL,
+ [res_name] [nvarchar](255) NOT NULL,
+ [res_pattern] [nvarchar](255) NOT NULL,
+ [res_category] [nvarchar](255) NOT NULL,
+ CONSTRAINT [PK_auth_resource] PRIMARY KEY CLUSTERED
+(
+ [res_id] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+) ON [PRIMARY]
+
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('系统管理员')
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('国内供应商')
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('海外供应商')
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('客服组')
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('产品组')
+INSERT INTO [dbo].[auth_role] ([role_name])
+VALUES ('技术研发部')
+
+INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
+VALUES ('所有权限', '*', 'system')
+INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
+VALUES ('最新团计划', '/reservation/newest', 'oversea')
+INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
+VALUES ('账单', '/invoice', 'oversea')
+
+INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
+VALUES ('账号权限管理', '/account/management', 'system')
+INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
+VALUES ('新增角色', '/account/new-role', 'system')
+
+INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
+VALUES (1, 1)
+INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
+VALUES (6, 2)
+INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
+VALUES (6, 3)
+INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
+VALUES (6, 4)
+INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
+VALUES (6, 5)
diff --git a/doc/价格管理平台.bmpr b/doc/价格管理平台.bmpr
index f82ae80..5bd9d48 100644
Binary files a/doc/价格管理平台.bmpr and b/doc/价格管理平台.bmpr differ
diff --git a/src/views/account/Management.jsx b/src/views/account/Management.jsx
index 32092c6..77703ce 100644
--- a/src/views/account/Management.jsx
+++ b/src/views/account/Management.jsx
@@ -1,8 +1,6 @@
-import { NavLink, useLocation } from 'react-router-dom'
-import { useState, useEffect } from 'react'
+import { useState } from 'react'
import { Row, Col, Space, Button, Table, Select, TreeSelect, Typography, Modal, App, Form, Input } from 'antd'
-import dayjs from 'dayjs'
-import { isEmpty } from '@/utils/commons'
+import { ExclamationCircleFilled } from '@ant-design/icons'
import { useTranslation } from 'react-i18next'
import useFormStore from '@/stores/Form'
import useReservationStore from '@/stores/Reservation'
@@ -88,6 +86,7 @@ function Management() {
{
title: t('account:role'),
dataIndex: 'role',
+ render: roleRender
},
{
title: t('account:lastLogin'),
@@ -102,15 +101,21 @@ function Management() {
function accountRender(text) {
return (
-
+
+ )
+ }
+
+ function roleRender(text) {
+ return (
+
)
}
function actionRender() {
return (
-
-
+
+
)
}
@@ -119,6 +124,7 @@ function Management() {
console.log('onChange ', newValue);
setPermissionValue(newValue);
}
+
const [permissionValue, setPermissionValue] = useState(['0-0-0'])
const [isAccountModalOpen, setAccountModalOpen] = useState(false)
const [isRoleModalOpen, setRoleModalOpen] = useState(false)
@@ -168,12 +174,12 @@ function Management() {
const formValuesToSub = useFormStore((state) => state.formValuesToSub)
- const [form] = Form.useForm()
+ const [editAccountForm, editRoleForm] = Form.useForm()
const [fetchReservationList] =
useReservationStore((state) =>
[state.fetchAllGuideList, state.fetchReservationList, state.reservationList, state.reservationPage, state.cityList, state.selectReservation, state.getCityListByReservationId])
- const { notification } = App.useApp()
+ const { notification, modal } = App.useApp()
const handleAccountOk = () => {
}
@@ -202,6 +208,34 @@ function Management() {
const onSearchClick = (current=1, status=null) => {
}
+ const showDisableConfirm = () => {
+ modal.confirm({
+ title: 'Do you want to disable this account?',
+ icon: ,
+ content: 'Username: Ivy, Realname: 怡小芳',
+ onOk() {
+ console.log('OK')
+ },
+ onCancel() {
+ console.log('Cancel')
+ },
+ })
+ }
+
+ const showResetPasswordConfirm = () => {
+ modal.confirm({
+ title: 'Do you want to reset password?',
+ icon: ,
+ content: 'Username: Ivy, Realname: 怡小芳',
+ onOk() {
+ console.log('OK')
+ },
+ onCancel() {
+ console.log('Cancel')
+ },
+ })
+ }
+
return (
<>