diff --git a/doc/价格管理平台.bmpr b/doc/价格管理平台.bmpr index 2e3bd02..a33839a 100644 Binary files a/doc/价格管理平台.bmpr and b/doc/价格管理平台.bmpr differ diff --git a/src/components/RequireAuth.jsx b/src/components/RequireAuth.jsx index d8feee7..cabef0b 100644 --- a/src/components/RequireAuth.jsx +++ b/src/components/RequireAuth.jsx @@ -1,19 +1,21 @@ import { Result } from 'antd' +import { usingStorage } from '@/hooks/usingStorage' import useAuthStore from '@/stores/Auth' -export default function RequireAuth({ children, ...props }, ) { +export default function RequireAuth({ children, ...props }) { const isPermitted = useAuthStore((state) => state.isPermitted) + const { userId } = usingStorage() if (isPermitted(props.subject)) { - // if (props.subject === '/account/management') { + // if (props.subject === '/account/management1') { return children } else if (props.result) { return ( ) } diff --git a/src/config.js b/src/config.js index b6e379a..86ed5a3 100644 --- a/src/config.js +++ b/src/config.js @@ -11,8 +11,22 @@ const __BUILD_VERSION__ = `__BUILD_VERSION__`.replace(/"/g, '') export const BUILD_VERSION = import.meta.env.PROD ? __BUILD_VERSION__ : import.meta.env.MODE; // 权限常量定义 +// 账号、权限管理 +// category: system export const PERM_ACCOUNT_MANAGEMENT = '/account/management' export const PERM_ACCOUNT_NEW = '/account/new' export const PERM_ACCOUNT_DISABLE = '/account/disable' export const PERM_ACCOUNT_RESET_PASSWORD = '/account/reset-password' export const PERM_ROLE_NEW = '/account/role/new' + +// 海外供应商 +// category: oversea +export const PERM_OVERSEA = '/oversea/all' + +// 国内供应商 +// category: domestic +export const PERM_DOMESTIC = '/domestic/all' + +// 机票供应商 +// category: air-ticket +export const PERM_AIR_TICKET = '/air-ticket/all' diff --git a/src/main.jsx b/src/main.jsx index 953db33..643a27e 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -32,7 +32,7 @@ import InvoicePaid from "@/views/invoice/Paid"; import InvoicePaidDetail from "@/views/invoice/PaidDetail"; import Airticket from "@/views/airticket/Index"; -import { PERM_ACCOUNT_MANAGEMENT } from '@/config' +import { PERM_ACCOUNT_MANAGEMENT, PERM_OVERSEA, PERM_AIR_TICKET } from '@/config' import './i18n'; @@ -52,22 +52,22 @@ const router = createBrowserRouter([ errorElement: , children: [ { index: true, element: }, - { path: "reservation/newest", element: }, - { path: "reservation/:reservationId", element: }, { path: "account/change-password", element: }, { path: "account/profile", element: }, { path: "account/management", element: }, - { path: "feedback", element: }, - { path: "feedback/:GRI_SN/:CII_SN/:RefNo", element: }, - { path: "feedback/:GRI_SN/:RefNo", element: }, - { path: "report", element: }, - { path: "notice", element: }, - { path: "notice/:CCP_BLID", element: }, - { path: "invoice",element:}, - { path: "invoice/detail/:GMDSN/:GSN",element:}, - { path: "invoice/paid",element:}, - { path: "invoice/paid/detail/:flid",element:}, - { path: "airticket",element:}, + { path: "reservation/newest", element: }, + { path: "reservation/:reservationId", element: }, + { path: "feedback", element: }, + { path: "feedback/:GRI_SN/:CII_SN/:RefNo", element: }, + { path: "feedback/:GRI_SN/:RefNo", element: }, + { path: "report", element: }, + { path: "notice", element: }, + { path: "notice/:CCP_BLID", element: }, + { path: "invoice",element:}, + { path: "invoice/detail/:GMDSN/:GSN",element:}, + { path: "invoice/paid",element:}, + { path: "invoice/paid/detail/:flid", element: }, + { path: "airticket",element: }, ] }, { diff --git a/src/stores/Auth.js b/src/stores/Auth.js index f7f31f3..59e27cc 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -55,13 +55,13 @@ const useAuthStore = create((set, get) => ({ // 以下是权限列表从数据库读取后使用的方法 // return this.permissionList.some((value, key, arry) => { // if (value.indexOf(WILDCARD_TOKEN) > -1) { - // return true; + // return true // } // if (value === perm) { - // return true; + // return true // } - // return false; - // }); + // return false + // }) }, diff --git a/src/views/account/Management.jsx b/src/views/account/Management.jsx index d98dbd8..4266fa3 100644 --- a/src/views/account/Management.jsx +++ b/src/views/account/Management.jsx @@ -12,6 +12,18 @@ import { PERM_ROLE_NEW } from '@/config' const { Title } = Typography const permissionData = [ + { + title: '海外供应商', + value: 'oversea-0', + key: 'oversea-0', + children: [ + { + title: '所有海外功能', + value: 'oversea-0-0', + key: 'oversea-0-0', + }, + ], + }, { title: '机票管理', value: '0-0', @@ -29,6 +41,11 @@ const permissionData = [ value: '0-1', key: '0-1', children: [ + { + title: '搜索供应商产品', + value: 'B-1-0', + key: 'B-1-0', + }, { title: '录入产品价格', value: '0-1-0', @@ -52,19 +69,29 @@ const permissionData = [ key: '2-1', children: [ { - title: '重置账号密码', - value: '2-1-0', - key: '2-1-0', + title: '搜索账号', + value: '2-1-01', + key: '2-1-01', + }, + { + title: '新增账号', + value: '2-1-11', + key: '2-1-11', }, { title: '禁用账号', - value: '2-1-1', - key: '2-1-1', + value: '2-1-21', + key: '2-1-21', }, { - title: '分配账号角色', - value: '2-1-2', - key: '2-1-2', + title: '重置账号密码', + value: '2-1-31', + key: '2-1-31', + }, + { + title: '新增角色', + value: '2-1-41', + key: '2-1-41', }, ], }, @@ -83,6 +110,10 @@ function Management() { title: t('account:realname'), dataIndex: 'realname', }, + { + title: t('account:travelAgency'), + dataIndex: 'travelAgency', + }, { title: t('account:email'), dataIndex: 'email', @@ -138,6 +169,7 @@ function Management() { key: 1, username: 'bjyiran', realname: '怡小芳', + travelAgency: '三千界', email: 'xiaofang@yiran.com', role: '国内供应商', lastLogin: '2024-06-12 13:53' @@ -146,6 +178,7 @@ function Management() { key: 2, username: 'int-robin', realname: 'Robin', + travelAgency: 'IAT', email: 'robin@int.com', role: '海外供应商', lastLogin: '2024-06-12 13:53' @@ -154,6 +187,7 @@ function Management() { key: 3, username: 'betty-wu', realname: '吴雪', + travelAgency: '桂林国旅', email: 'betty@hainatravel.com', role: '客服组', lastLogin: '2024-06-12 13:53' @@ -162,6 +196,7 @@ function Management() { key: 4, username: 'lancy', realname: '吴金倩', + travelAgency: '海纳国旅', email: 'lancy@hainatravel.com', role: '产品组', lastLogin: '2024-06-12 13:53' @@ -170,6 +205,7 @@ function Management() { key: 5, username: 'LYJ', realname: '廖一军', + travelAgency: '海纳国际旅行社', email: 'lyj@hainatravel.com', role: 'Web 开发组,海外测试供应商', lastLogin: '2024-06-12 13:53' @@ -178,9 +214,6 @@ function Management() { const formValuesToSub = useFormStore((state) => state.formValuesToSub) - - const isPermitted = useAuthStore((state) => state.isPermitted) - const [editAccountForm, editRoleForm] = Form.useForm() const [fetchReservationList] = useReservationStore((state) => @@ -286,6 +319,15 @@ function Management() { > + + +