mirror of https://github.com/openspug/spug
U 角色关联的账户信息现可以通过弹窗查看
parent
d248a7ebbd
commit
a92f7fa4a4
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) OpenSpug Organization. https://github.com/openspug/spug
|
||||||
|
* Copyright (c) <spug.dev@gmail.com>
|
||||||
|
* Released under the AGPL-3.0 License.
|
||||||
|
*/
|
||||||
|
import React from 'react';
|
||||||
|
import { observer } from 'mobx-react';
|
||||||
|
import { Badge, Table } from 'antd';
|
||||||
|
import uStore from '../account/store';
|
||||||
|
|
||||||
|
|
||||||
|
export default observer(function (props) {
|
||||||
|
const users = uStore.records.filter(x => x.role_ids.includes(props.id))
|
||||||
|
return (
|
||||||
|
<Table rowKey="id" dataSource={users} pagination={false}>
|
||||||
|
<Table.Column title="姓名" dataIndex="nickname"/>
|
||||||
|
<Table.Column title="状态" dataIndex="is_active"
|
||||||
|
render={v => v ? <Badge status="success" text="正常"/> : <Badge status="default" text="禁用"/>}/>
|
||||||
|
<Table.Column title="最近登录" dataIndex="last_login"/>
|
||||||
|
</Table>
|
||||||
|
)
|
||||||
|
})
|
|
@ -5,16 +5,22 @@
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Modal, message } from 'antd';
|
import { Modal, Popover, Button, message } from 'antd';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import { TableCard, AuthButton, Action } from 'components';
|
import { TableCard, AuthButton, Action } from 'components';
|
||||||
|
import RoleUsers from './RoleUsers';
|
||||||
import http from 'libs/http';
|
import http from 'libs/http';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
|
import uStore from '../account/store';
|
||||||
|
import styles from './index.module.css';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class ComTable extends React.Component {
|
class ComTable extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
store.fetchRecords()
|
store.fetchRecords()
|
||||||
|
if (uStore.records.length === 0) {
|
||||||
|
uStore.fetchRecords()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
columns = [{
|
columns = [{
|
||||||
|
@ -22,7 +28,11 @@ class ComTable extends React.Component {
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
}, {
|
}, {
|
||||||
title: '关联账户',
|
title: '关联账户',
|
||||||
dataIndex: 'used',
|
render: info => info.used ? (
|
||||||
|
<Popover overlayClassName={styles.roleUser} content={<RoleUsers id={info.id}/>}>
|
||||||
|
<Button type="link">{info.used}</Button>
|
||||||
|
</Popover>
|
||||||
|
) : <Button type="link" disabled>{info.used}</Button>
|
||||||
}, {
|
}, {
|
||||||
title: '描述信息',
|
title: '描述信息',
|
||||||
dataIndex: 'desc',
|
dataIndex: 'desc',
|
||||||
|
@ -58,7 +68,7 @@ class ComTable extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<TableCard
|
<TableCard
|
||||||
rowKey="sr"
|
rowKey="id"
|
||||||
title="角色列表"
|
title="角色列表"
|
||||||
loading={store.isFetching}
|
loading={store.isFetching}
|
||||||
dataSource={store.dataSource}
|
dataSource={store.dataSource}
|
||||||
|
|
|
@ -36,4 +36,8 @@
|
||||||
|
|
||||||
.delIcon:hover {
|
.delIcon:hover {
|
||||||
color: #f5222d;
|
color: #f5222d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roleUser :global(.ant-popover-inner-content) {
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue