feat: 更新价格界面原型;所有海外供应商路由加上权证验证

perf/export-docx
Jimmy Liow 1 year ago
parent 849e6ceef0
commit bfc994cd12

Binary file not shown.

@ -1,19 +1,21 @@
import { Result } from 'antd' import { Result } from 'antd'
import { usingStorage } from '@/hooks/usingStorage'
import useAuthStore from '@/stores/Auth' import useAuthStore from '@/stores/Auth'
export default function RequireAuth({ children, ...props }, ) { export default function RequireAuth({ children, ...props }) {
const isPermitted = useAuthStore((state) => state.isPermitted) const isPermitted = useAuthStore((state) => state.isPermitted)
const { userId } = usingStorage()
if (isPermitted(props.subject)) { if (isPermitted(props.subject)) {
// if (props.subject === '/account/management') { // if (props.subject === '/account/management1') {
return children return children
} else if (props.result) { } else if (props.result) {
return ( return (
<Result <Result
status='403' status='403'
title='403' title='403'
subTitle={'抱歉,你没有权限使用该功能。'} subTitle={`抱歉,你(${userId})没有权限使用该功能。`}
/> />
) )
} }

@ -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; 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_MANAGEMENT = '/account/management'
export const PERM_ACCOUNT_NEW = '/account/new' export const PERM_ACCOUNT_NEW = '/account/new'
export const PERM_ACCOUNT_DISABLE = '/account/disable' export const PERM_ACCOUNT_DISABLE = '/account/disable'
export const PERM_ACCOUNT_RESET_PASSWORD = '/account/reset-password' export const PERM_ACCOUNT_RESET_PASSWORD = '/account/reset-password'
export const PERM_ROLE_NEW = '/account/role/new' 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'

@ -32,7 +32,7 @@ import InvoicePaid from "@/views/invoice/Paid";
import InvoicePaidDetail from "@/views/invoice/PaidDetail"; import InvoicePaidDetail from "@/views/invoice/PaidDetail";
import Airticket from "@/views/airticket/Index"; 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'; import './i18n';
@ -52,22 +52,22 @@ const router = createBrowserRouter([
errorElement: <ErrorPage />, errorElement: <ErrorPage />,
children: [ children: [
{ index: true, element: <Index /> }, { index: true, element: <Index /> },
{ path: "reservation/newest", element: <ReservationNewest />},
{ path: "reservation/:reservationId", element: <ReservationDetail />},
{ path: "account/change-password", element: <ChangePassword />}, { path: "account/change-password", element: <ChangePassword />},
{ path: "account/profile", element: <AccountProfile />}, { path: "account/profile", element: <AccountProfile />},
{ path: "account/management", element: <RequireAuth subject={PERM_ACCOUNT_MANAGEMENT} result={true}><AccountManagement /></RequireAuth>}, { path: "account/management", element: <RequireAuth subject={PERM_ACCOUNT_MANAGEMENT} result={true}><AccountManagement /></RequireAuth>},
{ path: "feedback", element: <FeedbackIndex />}, { path: "reservation/newest", element: <RequireAuth subject={PERM_OVERSEA} result={true}><ReservationNewest /></RequireAuth>},
{ path: "feedback/:GRI_SN/:CII_SN/:RefNo", element: <FeedbackCustomerDetail />}, { path: "reservation/:reservationId", element: <RequireAuth subject={PERM_OVERSEA} result={true}><ReservationDetail /></RequireAuth>},
{ path: "feedback/:GRI_SN/:RefNo", element: <FeedbackDetail />}, { path: "feedback", element: <RequireAuth subject={PERM_OVERSEA} result={true}><FeedbackIndex /></RequireAuth>},
{ path: "report", element: <ReportIndex />}, { path: "feedback/:GRI_SN/:CII_SN/:RefNo", element: <RequireAuth subject={PERM_OVERSEA} result={true}><FeedbackCustomerDetail /></RequireAuth>},
{ path: "notice", element: <NoticeIndex />}, { path: "feedback/:GRI_SN/:RefNo", element: <RequireAuth subject={PERM_OVERSEA} result={true}><FeedbackDetail /></RequireAuth>},
{ path: "notice/:CCP_BLID", element: <NoticeDetail />}, { path: "report", element: <RequireAuth subject={PERM_OVERSEA} result={true}><ReportIndex /></RequireAuth>},
{ path: "invoice",element:<InvoiceIndex />}, { path: "notice", element: <RequireAuth subject={PERM_OVERSEA} result={true}><NoticeIndex /></RequireAuth>},
{ path: "invoice/detail/:GMDSN/:GSN",element:<InvoiceDetail />}, { path: "notice/:CCP_BLID", element: <RequireAuth subject={PERM_OVERSEA} result={true}><NoticeDetail /></RequireAuth>},
{ path: "invoice/paid",element:<InvoicePaid />}, { path: "invoice",element:<RequireAuth subject={PERM_OVERSEA} result={true}><InvoiceIndex /></RequireAuth>},
{ path: "invoice/paid/detail/:flid",element:<InvoicePaidDetail />}, { path: "invoice/detail/:GMDSN/:GSN",element:<RequireAuth subject={PERM_OVERSEA} result={true}><InvoiceDetail /></RequireAuth>},
{ path: "airticket",element:<Airticket />}, { path: "invoice/paid",element:<RequireAuth subject={PERM_OVERSEA} result={true}><InvoicePaid /></RequireAuth>},
{ path: "invoice/paid/detail/:flid", element: <RequireAuth subject={PERM_OVERSEA} result={true}><InvoicePaidDetail /></RequireAuth>},
{ path: "airticket",element: <RequireAuth subject={PERM_AIR_TICKET} result={true}><Airticket /></RequireAuth>},
] ]
}, },
{ {

@ -55,13 +55,13 @@ const useAuthStore = create((set, get) => ({
// 以下是权限列表从数据库读取后使用的方法 // 以下是权限列表从数据库读取后使用的方法
// return this.permissionList.some((value, key, arry) => { // return this.permissionList.some((value, key, arry) => {
// if (value.indexOf(WILDCARD_TOKEN) > -1) { // if (value.indexOf(WILDCARD_TOKEN) > -1) {
// return true; // return true
// } // }
// if (value === perm) { // if (value === perm) {
// return true; // return true
// } // }
// return false; // return false
// }); // })
}, },

@ -12,6 +12,18 @@ import { PERM_ROLE_NEW } from '@/config'
const { Title } = Typography const { Title } = Typography
const permissionData = [ const permissionData = [
{
title: '海外供应商',
value: 'oversea-0',
key: 'oversea-0',
children: [
{
title: '所有海外功能',
value: 'oversea-0-0',
key: 'oversea-0-0',
},
],
},
{ {
title: '机票管理', title: '机票管理',
value: '0-0', value: '0-0',
@ -29,6 +41,11 @@ const permissionData = [
value: '0-1', value: '0-1',
key: '0-1', key: '0-1',
children: [ children: [
{
title: '搜索供应商产品',
value: 'B-1-0',
key: 'B-1-0',
},
{ {
title: '录入产品价格', title: '录入产品价格',
value: '0-1-0', value: '0-1-0',
@ -52,19 +69,29 @@ const permissionData = [
key: '2-1', key: '2-1',
children: [ children: [
{ {
title: '重置账号密码', title: '搜索账号',
value: '2-1-0', value: '2-1-01',
key: '2-1-0', key: '2-1-01',
},
{
title: '新增账号',
value: '2-1-11',
key: '2-1-11',
}, },
{ {
title: '禁用账号', title: '禁用账号',
value: '2-1-1', value: '2-1-21',
key: '2-1-1', key: '2-1-21',
}, },
{ {
title: '分配账号角色', title: '重置账号密码',
value: '2-1-2', value: '2-1-31',
key: '2-1-2', key: '2-1-31',
},
{
title: '新增角色',
value: '2-1-41',
key: '2-1-41',
}, },
], ],
}, },
@ -83,6 +110,10 @@ function Management() {
title: t('account:realname'), title: t('account:realname'),
dataIndex: 'realname', dataIndex: 'realname',
}, },
{
title: t('account:travelAgency'),
dataIndex: 'travelAgency',
},
{ {
title: t('account:email'), title: t('account:email'),
dataIndex: 'email', dataIndex: 'email',
@ -138,6 +169,7 @@ function Management() {
key: 1, key: 1,
username: 'bjyiran', username: 'bjyiran',
realname: '怡小芳', realname: '怡小芳',
travelAgency: '三千界',
email: 'xiaofang@yiran.com', email: 'xiaofang@yiran.com',
role: '国内供应商', role: '国内供应商',
lastLogin: '2024-06-12 13:53' lastLogin: '2024-06-12 13:53'
@ -146,6 +178,7 @@ function Management() {
key: 2, key: 2,
username: 'int-robin', username: 'int-robin',
realname: 'Robin', realname: 'Robin',
travelAgency: 'IAT',
email: 'robin@int.com', email: 'robin@int.com',
role: '海外供应商', role: '海外供应商',
lastLogin: '2024-06-12 13:53' lastLogin: '2024-06-12 13:53'
@ -154,6 +187,7 @@ function Management() {
key: 3, key: 3,
username: 'betty-wu', username: 'betty-wu',
realname: '吴雪', realname: '吴雪',
travelAgency: '桂林国旅',
email: 'betty@hainatravel.com', email: 'betty@hainatravel.com',
role: '客服组', role: '客服组',
lastLogin: '2024-06-12 13:53' lastLogin: '2024-06-12 13:53'
@ -162,6 +196,7 @@ function Management() {
key: 4, key: 4,
username: 'lancy', username: 'lancy',
realname: '吴金倩', realname: '吴金倩',
travelAgency: '海纳国旅',
email: 'lancy@hainatravel.com', email: 'lancy@hainatravel.com',
role: '产品组', role: '产品组',
lastLogin: '2024-06-12 13:53' lastLogin: '2024-06-12 13:53'
@ -170,6 +205,7 @@ function Management() {
key: 5, key: 5,
username: 'LYJ', username: 'LYJ',
realname: '廖一军', realname: '廖一军',
travelAgency: '海纳国际旅行社',
email: 'lyj@hainatravel.com', email: 'lyj@hainatravel.com',
role: 'Web 开发组,海外测试供应商', role: 'Web 开发组,海外测试供应商',
lastLogin: '2024-06-12 13:53' lastLogin: '2024-06-12 13:53'
@ -178,9 +214,6 @@ function Management() {
const formValuesToSub = useFormStore((state) => state.formValuesToSub) const formValuesToSub = useFormStore((state) => state.formValuesToSub)
const isPermitted = useAuthStore((state) => state.isPermitted)
const [editAccountForm, editRoleForm] = Form.useForm() const [editAccountForm, editRoleForm] = Form.useForm()
const [fetchReservationList] = const [fetchReservationList] =
useReservationStore((state) => useReservationStore((state) =>
@ -286,6 +319,15 @@ function Management() {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item label={t('account:management.travelAgency')}>
<Select>
<Select.Option value='1'>供应商1</Select.Option>
<Select.Option value='2'>地接2</Select.Option>
<Select.Option value='3'>国内供应商3</Select.Option>
<Select.Option value='4'>海外供应商4</Select.Option>
<Select.Option value='5'>还有什么</Select.Option>
</Select>
</Form.Item>
<Form.Item <Form.Item
label={t('account:management.email')} label={t('account:management.email')}
name='email' name='email'
@ -321,7 +363,7 @@ function Management() {
layout='vertical' layout='vertical'
size='large' size='large'
style={{ style={{
maxWidth: 600, maxWidth: 800,
}} }}
onFinish={onFinish} onFinish={onFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
@ -343,7 +385,7 @@ function Management() {
<Form.Item label={t('account:management.permission')}> <Form.Item label={t('account:management.permission')}>
<TreeSelect treeData={permissionData} value={permissionValue} <TreeSelect treeData={permissionData} value={permissionValue}
dropdownStyle={{ dropdownStyle={{
maxHeight: 500, maxHeight: 600,
overflow: 'auto', overflow: 'auto',
}} }}
placement='bottomLeft' placement='bottomLeft'

Loading…
Cancel
Save