|
|
|
@ -12,92 +12,6 @@ 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',
|
|
|
|
|
key: '0-0',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
title: '录入机票价格',
|
|
|
|
|
value: '0-0-0',
|
|
|
|
|
key: '0-0-0',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '产品管理',
|
|
|
|
|
value: '0-1',
|
|
|
|
|
key: '0-1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
title: '搜索供应商产品',
|
|
|
|
|
value: 'B-1-0',
|
|
|
|
|
key: 'B-1-0',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '录入产品价格',
|
|
|
|
|
value: '0-1-0',
|
|
|
|
|
key: '0-1-0',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '新增产品描述',
|
|
|
|
|
value: '0-1-1',
|
|
|
|
|
key: '0-1-1',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '复制供应商产品信息',
|
|
|
|
|
value: '0-1-2',
|
|
|
|
|
key: '0-1-2',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '账号管理',
|
|
|
|
|
value: '2-1',
|
|
|
|
|
key: '2-1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
title: '搜索账号',
|
|
|
|
|
value: '2-1-01',
|
|
|
|
|
key: '2-1-01',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '新增账号',
|
|
|
|
|
value: '2-1-11',
|
|
|
|
|
key: '2-1-11',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '禁用账号',
|
|
|
|
|
value: '2-1-21',
|
|
|
|
|
key: '2-1-21',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '重置账号密码',
|
|
|
|
|
value: '2-1-31',
|
|
|
|
|
key: '2-1-31',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '新增角色',
|
|
|
|
|
value: '2-1-41',
|
|
|
|
|
key: '2-1-41',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
function Management() {
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
|
@ -121,8 +35,7 @@ function Management() {
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('account:role'),
|
|
|
|
|
dataIndex: 'role',
|
|
|
|
|
render: roleRender
|
|
|
|
|
dataIndex: 'role'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('account:lastLogin'),
|
|
|
|
@ -141,12 +54,6 @@ function Management() {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function roleRender(text) {
|
|
|
|
|
return (
|
|
|
|
|
<Button type='link' onClick={() => setRoleModalOpen(true)}>{text}</Button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function actionRender(text, account) {
|
|
|
|
|
return (
|
|
|
|
|
<Space key='actionRenderSpace' size='middle'>
|
|
|
|
@ -156,28 +63,19 @@ function Management() {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
const [dataLoading, setDataLoading] = useState(false)
|
|
|
|
|
const [roleAllList, setRoleAllList] = useState([])
|
|
|
|
|
|
|
|
|
|
const [accountForm] = Form.useForm()
|
|
|
|
|
const [searchAccountByCriteria, accountList, disableAccount, selectedAccount, saveOrUpdateAccount, selectAccount] =
|
|
|
|
|
const [searchAccountByCriteria, accountList, disableAccount, saveOrUpdateAccount, resetAccountPassword] =
|
|
|
|
|
useAccountStore((state) =>
|
|
|
|
|
[state.searchAccountByCriteria, state.accountList, state.disableAccount, state.selectedAccount, state.saveOrUpdateAccount, state.selectAccount])
|
|
|
|
|
[state.searchAccountByCriteria, state.accountList, state.disableAccount, state.saveOrUpdateAccount, state.resetAccountPassword])
|
|
|
|
|
|
|
|
|
|
const { notification, modal } = App.useApp()
|
|
|
|
|
|
|
|
|
|
const onAccountSeleted = async (account) => {
|
|
|
|
|
accountForm.setFieldsValue(account)
|
|
|
|
|
selectAccount(account)
|
|
|
|
|
console.info(account)
|
|
|
|
|
const roleList = await fetchRoleList()
|
|
|
|
|
setRoleAllList(roleList.map(r => {
|
|
|
|
|
return {
|
|
|
|
@ -193,7 +91,6 @@ function Management() {
|
|
|
|
|
console.log(values)
|
|
|
|
|
saveOrUpdateAccount(values)
|
|
|
|
|
.catch(ex => {
|
|
|
|
|
console.info(ex.message)
|
|
|
|
|
notification.error({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: ex.message,
|
|
|
|
@ -222,11 +119,21 @@ function Management() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showResetPasswordConfirm = (account) => {
|
|
|
|
|
const randomPassword = account.username + (Math.floor(Math.random() * 900) + 100)
|
|
|
|
|
modal.confirm({
|
|
|
|
|
title: 'Do you want to reset password?',
|
|
|
|
|
icon: <ExclamationCircleFilled />,
|
|
|
|
|
content: `Username: ${account.username}, Realname: ${account.realname}`,
|
|
|
|
|
onOk() {
|
|
|
|
|
resetAccountPassword(account.userId, randomPassword)
|
|
|
|
|
.then(() => {
|
|
|
|
|
notification.info({
|
|
|
|
|
message: '新密码:' + randomPassword,
|
|
|
|
|
description: `请复制密码给 [${account.realname}]`,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 60,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
console.log('ResetPassword')
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
@ -263,6 +170,9 @@ function Management() {
|
|
|
|
|
</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
|
|
|
|
|
label={t('account:management.username')}
|
|
|
|
|
name='username'
|
|
|
|
|