|
|
|
|
@ -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,23 +101,30 @@ function Management() {
|
|
|
|
|
|
|
|
|
|
function accountRender(text) {
|
|
|
|
|
return (
|
|
|
|
|
<Button type='link' onClick={() => console.info('account:action.assignRole')}>{text}</Button>
|
|
|
|
|
<Button type='link' onClick={() => setAccountModalOpen(true)}>{text}</Button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function roleRender(text) {
|
|
|
|
|
return (
|
|
|
|
|
<Button type='link' onClick={() => setRoleModalOpen(true)}>{text}</Button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function actionRender() {
|
|
|
|
|
return (
|
|
|
|
|
<Space key='actionRenderSpace' size='middle'>
|
|
|
|
|
<Button type='link' key='disable' onClick={() => console.info('account:action.disable')}>{t('account:action.disable')}</Button>
|
|
|
|
|
<Button type='link' key='resetPassword' onClick={() => console.info('account:action.resetPassword')}>{t('account:action.resetPassword')}</Button>
|
|
|
|
|
<Button type='link' key='disable' onClick={() => showDisableConfirm()}>{t('account:action.disable')}</Button>
|
|
|
|
|
<Button type='link' key='resetPassword' onClick={() => showResetPasswordConfirm()}>{t('account:action.resetPassword')}</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onPermissionChange = (newValue) => {
|
|
|
|
|
const onPermissionChange = (newValue) => {
|
|
|
|
|
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 = () => {
|
|
|
|
|
}
|
|
|
|
|
@ -199,7 +205,35 @@ function Management() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 默认重新搜索第一页,所有状态的计划
|
|
|
|
|
const onSearchClick = (current=1, status=null) => {
|
|
|
|
|
const onSearchClick = (current = 1, status = null) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showDisableConfirm = () => {
|
|
|
|
|
modal.confirm({
|
|
|
|
|
title: 'Do you want to disable this account?',
|
|
|
|
|
icon: <ExclamationCircleFilled />,
|
|
|
|
|
content: 'Username: Ivy, Realname: 怡小芳',
|
|
|
|
|
onOk() {
|
|
|
|
|
console.log('OK')
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
console.log('Cancel')
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showResetPasswordConfirm = () => {
|
|
|
|
|
modal.confirm({
|
|
|
|
|
title: 'Do you want to reset password?',
|
|
|
|
|
icon: <ExclamationCircleFilled />,
|
|
|
|
|
content: 'Username: Ivy, Realname: 怡小芳',
|
|
|
|
|
onOk() {
|
|
|
|
|
console.log('OK')
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
console.log('Cancel')
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -209,65 +243,65 @@ function Management() {
|
|
|
|
|
open={isAccountModalOpen} onOk={handleAccountOk} onCancel={handleAccountCancel}
|
|
|
|
|
>
|
|
|
|
|
<Form
|
|
|
|
|
name='basic'
|
|
|
|
|
form={form}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
onFinishFailed={onFinishFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
<Form.Item><Title level={2}>{t('account:management.newAccount')}</Title></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.username')}
|
|
|
|
|
name='username'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.username'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.realname')}
|
|
|
|
|
name='realname'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.realname'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.email')}
|
|
|
|
|
name='email'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.email'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
name='basic'
|
|
|
|
|
form={editAccountForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
onFinishFailed={onFinishFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label={t('account:management.role')}>
|
|
|
|
|
<Select>
|
|
|
|
|
<Select.Option value='1'>客服组</Select.Option>
|
|
|
|
|
<Select.Option value='2'>产品组</Select.Option>
|
|
|
|
|
<Select.Option value='3'>国内供应商</Select.Option>
|
|
|
|
|
<Select.Option value='4'>海外供应商</Select.Option>
|
|
|
|
|
<Select.Option value='5'>技术研发部</Select.Option>
|
|
|
|
|
<Select.Option value='0' disabled>系统管理员</Select.Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
<Form.Item><Title level={2}>{t('account:management.newAccount')}</Title></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.username')}
|
|
|
|
|
name='username'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.username'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.realname')}
|
|
|
|
|
name='realname'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.realname'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.email')}
|
|
|
|
|
name='email'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.email'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label={t('account:management.role')}>
|
|
|
|
|
<Select>
|
|
|
|
|
<Select.Option value='1'>客服组</Select.Option>
|
|
|
|
|
<Select.Option value='2'>产品组</Select.Option>
|
|
|
|
|
<Select.Option value='3'>国内供应商</Select.Option>
|
|
|
|
|
<Select.Option value='4'>海外供应商</Select.Option>
|
|
|
|
|
<Select.Option value='5'>技术研发部</Select.Option>
|
|
|
|
|
<Select.Option value='0' disabled>系统管理员</Select.Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Modal>
|
|
|
|
|
{/* Role Edit */}
|
|
|
|
|
<Modal
|
|
|
|
|
@ -275,51 +309,51 @@ function Management() {
|
|
|
|
|
open={isRoleModalOpen} onOk={handleRoleOk} onCancel={handleRoleCancel}
|
|
|
|
|
>
|
|
|
|
|
<Form
|
|
|
|
|
name='basic'
|
|
|
|
|
form={form}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
onFinishFailed={onFinishFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
<Form.Item><Title level={2}>{t('account:management.newRole')}</Title></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.roleName')}
|
|
|
|
|
name='roleName'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.roleName'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
name='basic'
|
|
|
|
|
form={editRoleForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
onFinishFailed={onFinishFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label={t('account:management.permission')}>
|
|
|
|
|
<TreeSelect treeData={permissionData} value={permissionValue}
|
|
|
|
|
dropdownStyle={{
|
|
|
|
|
maxHeight: 500,
|
|
|
|
|
overflow: 'auto',
|
|
|
|
|
}}
|
|
|
|
|
placement='bottomLeft'
|
|
|
|
|
showSearch
|
|
|
|
|
allowClear
|
|
|
|
|
multiple
|
|
|
|
|
treeDefaultExpandAll
|
|
|
|
|
treeLine={true}
|
|
|
|
|
onChange={onPermissionChange}
|
|
|
|
|
treeCheckable={true}
|
|
|
|
|
showCheckedStrategy={TreeSelect.SHOW_CHILD}
|
|
|
|
|
placeholder={'Please select'}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
}} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
<Form.Item><Title level={2}>{t('account:management.newRole')}</Title></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.roleName')}
|
|
|
|
|
name='roleName'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t('account:Validation.roleName'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label={t('account:management.permission')}>
|
|
|
|
|
<TreeSelect treeData={permissionData} value={permissionValue}
|
|
|
|
|
dropdownStyle={{
|
|
|
|
|
maxHeight: 500,
|
|
|
|
|
overflow: 'auto',
|
|
|
|
|
}}
|
|
|
|
|
placement='bottomLeft'
|
|
|
|
|
showSearch
|
|
|
|
|
allowClear
|
|
|
|
|
multiple
|
|
|
|
|
treeDefaultExpandAll
|
|
|
|
|
treeLine={true}
|
|
|
|
|
onChange={onPermissionChange}
|
|
|
|
|
treeCheckable={true}
|
|
|
|
|
showCheckedStrategy={TreeSelect.SHOW_CHILD}
|
|
|
|
|
placeholder={'Please select'}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
}} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Modal>
|
|
|
|
|
<Space direction='vertical' style={{ width: '100%' }}>
|
|
|
|
|
<Title level={3}>{t('account:management.tile')}</Title>
|
|
|
|
|
@ -367,9 +401,9 @@ function Management() {
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
showLessItems: true,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showTotal: (total) => { return `总数:${total}` }
|
|
|
|
|
showTotal: (total) => { return t('Total') + `:${total}` }
|
|
|
|
|
}}
|
|
|
|
|
onChange={(pagination) => {onSearchClick(pagination.current)}}
|
|
|
|
|
onChange={(pagination) => { onSearchClick(pagination.current) }}
|
|
|
|
|
columns={accountListColumns} dataSource={accountList}
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
|