|
|
|
@ -1,14 +1,12 @@
|
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
|
import { Row, Col, Space, Button, Table, Select, TreeSelect, Typography, Modal, App, Form, Input } from 'antd'
|
|
|
|
|
import SearchForm from '@/components/SearchForm'
|
|
|
|
|
import useAccountStore, { fetchRoleList, fetchTravelAgencyByName } from '@/stores/Account'
|
|
|
|
|
import useFormStore from '@/stores/Form'
|
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
|
import { ExclamationCircleFilled } from '@ant-design/icons'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import { fetchTravelAgencyByName } from '@/stores/Account'
|
|
|
|
|
import { App, Button, Col, Form, Input, Modal, Row, Select, Space, Table, Typography } from 'antd'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
|
import useAccountStore from '@/stores/Account'
|
|
|
|
|
import useFormStore from '@/stores/Form'
|
|
|
|
|
import { fetchRoleList } from '@/stores/Account'
|
|
|
|
|
import SearchForm from '@/components/SearchForm'
|
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
|
|
|
|
|
const { Title } = Typography
|
|
|
|
|
|
|
|
|
@ -26,7 +24,7 @@ function Management() {
|
|
|
|
|
dataIndex: 'realname',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('account:travelAgency'),
|
|
|
|
|
title: t('account:travelAgencyName'),
|
|
|
|
|
dataIndex: 'travelAgencyName',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -34,7 +32,7 @@ function Management() {
|
|
|
|
|
dataIndex: 'email',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('account:role'),
|
|
|
|
|
title: t('account:roleName'),
|
|
|
|
|
dataIndex: 'role'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -43,7 +41,7 @@ function Management() {
|
|
|
|
|
render: (text) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD HH:mm:ss'))
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('account:action'),
|
|
|
|
|
title: t('account:action.edit'),
|
|
|
|
|
dataIndex: 'account:action',
|
|
|
|
|
render: actionRender
|
|
|
|
|
},
|
|
|
|
@ -78,7 +76,7 @@ function Management() {
|
|
|
|
|
const formValues = useFormStore(state => state.formValues)
|
|
|
|
|
const { notification, modal } = App.useApp()
|
|
|
|
|
|
|
|
|
|
useEffect (() => {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchRoleList()
|
|
|
|
|
.then((roleList) => {
|
|
|
|
|
setRoleAllList(roleList.map(r => {
|
|
|
|
@ -189,7 +187,6 @@ function Management() {
|
|
|
|
|
duration: 60,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
console.log('ResetPassword')
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
},
|
|
|
|
@ -204,32 +201,32 @@ function Management() {
|
|
|
|
|
autoFocus: true,
|
|
|
|
|
htmlType: 'submit',
|
|
|
|
|
}}
|
|
|
|
|
title={t('account:management.newAccount')}
|
|
|
|
|
title={t('account:detail')}
|
|
|
|
|
open={isAccountModalOpen} onOk={() => setAccountModalOpen(false)} onCancel={() => setAccountModalOpen(false)}
|
|
|
|
|
destroyOnClose={true}
|
|
|
|
|
clearOnDestroy={true}
|
|
|
|
|
modalRender={(dom) => (
|
|
|
|
|
<Form
|
|
|
|
|
name='AccountForm'
|
|
|
|
|
form={accountForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onAccountFinish}
|
|
|
|
|
onFinishFailed={onAccountFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
name='AccountForm'
|
|
|
|
|
form={accountForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onAccountFinish}
|
|
|
|
|
onFinishFailed={onAccountFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
{dom}
|
|
|
|
|
</Form>
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Form.Item name='userId' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='lmi_sn' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='lmi2_sn' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='userId' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='lmi_sn' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='lmi2_sn' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.username')}
|
|
|
|
|
label={t('account:username')}
|
|
|
|
|
name='username'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -241,7 +238,7 @@ function Management() {
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.realname')}
|
|
|
|
|
label={t('account:realname')}
|
|
|
|
|
name='realname'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -253,7 +250,7 @@ function Management() {
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.email')}
|
|
|
|
|
label={t('account:email')}
|
|
|
|
|
name='email'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -265,7 +262,7 @@ function Management() {
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.travelAgency')}
|
|
|
|
|
label={t('account:travelAgencyName')}
|
|
|
|
|
name='travelAgencyId'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -287,7 +284,7 @@ function Management() {
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('account:management.role')}
|
|
|
|
|
label={t('account:roleName')}
|
|
|
|
|
name='roleId'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -296,17 +293,22 @@ function Management() {
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Select options={roleAllList}>
|
|
|
|
|
<Select
|
|
|
|
|
options={roleAllList}
|
|
|
|
|
filterOption={false}
|
|
|
|
|
notFoundContent={null}
|
|
|
|
|
>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Modal>
|
|
|
|
|
<Space direction='vertical' style={{ width: '100%' }}>
|
|
|
|
|
<Title level={3}>{t('account:management.tile')}</Title>
|
|
|
|
|
<Title level={3}>{t('account:accountList')}</Title>
|
|
|
|
|
<SearchForm
|
|
|
|
|
fieldsConfig={{
|
|
|
|
|
shows: ['username', 'realname', 'dates'],
|
|
|
|
|
shows: ['username', 'realname'],
|
|
|
|
|
fieldProps: {
|
|
|
|
|
dates: { label: t('group:ArrivalDate') },
|
|
|
|
|
username: { label: t('account:username') },
|
|
|
|
|
realname: { label: t('account:realname') },
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
onSubmit={() => {
|
|
|
|
@ -316,7 +318,7 @@ function Management() {
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={24}>
|
|
|
|
|
<Space>
|
|
|
|
|
<Button onClick={() => setAccountModalOpen(true)}>{t('account:management.newAccount')}</Button>
|
|
|
|
|
<Button onClick={() => setAccountModalOpen(true)}>{t('account:newAccount')}</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|