|
|
|
@ -161,48 +161,32 @@ function Management() {
|
|
|
|
|
setPermissionValue(newValue)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onAccountSeleted = async (account) => {
|
|
|
|
|
selectAccount(account)
|
|
|
|
|
console.info(account)
|
|
|
|
|
const roleList = await fetchRoleList()
|
|
|
|
|
setRoleAllList(roleList.map(r => {
|
|
|
|
|
return {
|
|
|
|
|
value: r.role_id,
|
|
|
|
|
label: r.role_name,
|
|
|
|
|
disabled: r.role_id === 1
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
setAccountModalOpen(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 [editAccountForm, editRoleForm] = Form.useForm()
|
|
|
|
|
const [accountForm] = Form.useForm()
|
|
|
|
|
const [searchAccountByCriteria, accountList, disableAccount, selectedAccount, saveOrUpdateAccount, selectAccount] =
|
|
|
|
|
useAccountStore((state) =>
|
|
|
|
|
[state.searchAccountByCriteria, state.accountList, state.disableAccount, state.selectedAccount, state.saveOrUpdateAccount, state.selectAccount])
|
|
|
|
|
|
|
|
|
|
const { notification, modal } = App.useApp()
|
|
|
|
|
|
|
|
|
|
const handleAccountOk = () => {
|
|
|
|
|
console.info('handleAccountOk')
|
|
|
|
|
console.info(editAccountForm)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleAccountCancel = () => {
|
|
|
|
|
setAccountModalOpen(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleRoleOk = () => {
|
|
|
|
|
console.info('handleRoleOk')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleRoleCancel = () => {
|
|
|
|
|
setRoleModalOpen(false)
|
|
|
|
|
const onAccountSeleted = async (account) => {
|
|
|
|
|
accountForm.setFieldsValue(account)
|
|
|
|
|
selectAccount(account)
|
|
|
|
|
console.info(account)
|
|
|
|
|
const roleList = await fetchRoleList()
|
|
|
|
|
setRoleAllList(roleList.map(r => {
|
|
|
|
|
return {
|
|
|
|
|
value: r.role_id,
|
|
|
|
|
label: r.role_name,
|
|
|
|
|
disabled: r.role_id === 1
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
setAccountModalOpen(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onAccountFinish = (values) => {
|
|
|
|
@ -219,7 +203,7 @@ function Management() {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onAccountFinishFailed = (error) => {
|
|
|
|
|
const onAccountFailed = (error) => {
|
|
|
|
|
console.log('Failed:', error)
|
|
|
|
|
// form.resetFields()
|
|
|
|
|
}
|
|
|
|
@ -259,20 +243,20 @@ function Management() {
|
|
|
|
|
htmlType: 'submit',
|
|
|
|
|
}}
|
|
|
|
|
title={t('account:management.newAccount')}
|
|
|
|
|
open={isAccountModalOpen} onOk={handleAccountOk} onCancel={handleAccountCancel}
|
|
|
|
|
destroyOnClose
|
|
|
|
|
open={isAccountModalOpen} onOk={() => setAccountModalOpen(false)} onCancel={() => setAccountModalOpen(false)}
|
|
|
|
|
destroyOnClose={true}
|
|
|
|
|
clearOnDestroy={true}
|
|
|
|
|
modalRender={(dom) => (
|
|
|
|
|
<Form
|
|
|
|
|
name='AccountForm'
|
|
|
|
|
form={editAccountForm}
|
|
|
|
|
initialValues={selectedAccount}
|
|
|
|
|
form={accountForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 600,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onAccountFinish}
|
|
|
|
|
onFinishFailed={onAccountFinishFailed}
|
|
|
|
|
onFinishFailed={onAccountFailed}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
>
|
|
|
|
|
{dom}
|
|
|
|
@ -341,58 +325,6 @@ function Management() {
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Modal>
|
|
|
|
|
{/* Role Edit */}
|
|
|
|
|
<Modal
|
|
|
|
|
centered
|
|
|
|
|
open={isRoleModalOpen} onOk={handleRoleOk} onCancel={handleRoleCancel}
|
|
|
|
|
>
|
|
|
|
|
<Form
|
|
|
|
|
name='RoleForm'
|
|
|
|
|
form={editRoleForm}
|
|
|
|
|
layout='vertical'
|
|
|
|
|
size='large'
|
|
|
|
|
style={{
|
|
|
|
|
maxWidth: 800,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={onAccountFinish}
|
|
|
|
|
onFinishFailed={onAccountFinishFailed}
|
|
|
|
|
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'),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label={t('account:management.permission')}>
|
|
|
|
|
<TreeSelect treeData={permissionData} value={permissionValue}
|
|
|
|
|
dropdownStyle={{
|
|
|
|
|
maxHeight: 600,
|
|
|
|
|
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>
|
|
|
|
|
<SearchForm
|
|
|
|
@ -423,9 +355,6 @@ function Management() {
|
|
|
|
|
<Col span={24}>
|
|
|
|
|
<Space>
|
|
|
|
|
<Button onClick={() => setAccountModalOpen(true)}>{t('account:management.newAccount')}</Button>
|
|
|
|
|
<RequireAuth subject={PERM_ROLE_NEW}>
|
|
|
|
|
<Button onClick={() => setRoleModalOpen(true)}>{t('account:management.newRole')}</Button>
|
|
|
|
|
</RequireAuth>
|
|
|
|
|
</Space>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|