update 细节处理
This commit is contained in:
@@ -5,24 +5,41 @@ function renderActions() {
|
|||||||
const { children } = this.props
|
const { children } = this.props
|
||||||
const actions = []
|
const actions = []
|
||||||
|
|
||||||
Array.isArray(children) ? children
|
Array.isArray(children)
|
||||||
.filter(action => action)
|
? children
|
||||||
.forEach((action, i) => {
|
.filter(action => action)
|
||||||
actions.push(action)
|
.forEach((action, i) => {
|
||||||
if (i < this.props.children.length - 1) {
|
actions.push(action, <Divider type="vertical" key={i} />)
|
||||||
actions.push(<Divider type="vertical" key={i} />)
|
})
|
||||||
}
|
: actions.push(children)
|
||||||
}) : (actions.push(children))
|
|
||||||
|
|
||||||
return actions
|
return actions
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class QueryTableActions extends Component {
|
export default class QueryTableActions extends Component {
|
||||||
|
componentDidMount() {
|
||||||
|
// 删除多余的间隔线
|
||||||
|
const className = 'ant-divider ant-divider-vertical'
|
||||||
|
let series = false
|
||||||
|
for (const node of this.refs.inner.childNodes) {
|
||||||
|
if (
|
||||||
|
(series && node.className == className) ||
|
||||||
|
(!node.nextElementSibling && node.className == className)
|
||||||
|
) {
|
||||||
|
node.remove()
|
||||||
|
series = false
|
||||||
|
} else if (node.className == className) {
|
||||||
|
series = true
|
||||||
|
} else {
|
||||||
|
series = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="yo-table-actions">
|
<div className="yo-table-actions">
|
||||||
<div className="yo-table-actions--inner">
|
<div className="yo-table-actions--inner" ref="inner">
|
||||||
{renderActions.call(this)}
|
{renderActions.call(this)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,16 @@ import {
|
|||||||
Switch,
|
Switch,
|
||||||
Tag,
|
Tag,
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
import { AntIcon, Auth, Container, Image, ModalForm, QueryList, QueryTreeLayout } from 'components'
|
import {
|
||||||
|
AntIcon,
|
||||||
|
Auth,
|
||||||
|
Container,
|
||||||
|
Image,
|
||||||
|
ModalForm,
|
||||||
|
QueryList,
|
||||||
|
QueryTableActions,
|
||||||
|
QueryTreeLayout,
|
||||||
|
} from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
@@ -203,24 +212,26 @@ export default class index extends Component {
|
|||||||
<List.Item
|
<List.Item
|
||||||
key={id}
|
key={id}
|
||||||
actions={[
|
actions={[
|
||||||
<Auth auth="houseMember:edit">
|
<QueryTableActions>
|
||||||
<a onClick={() => this.onOpen(this.editForm, id)}>编辑</a>
|
<Auth auth="houseMember:edit">
|
||||||
</Auth>,
|
<a onClick={() => this.onOpen(this.editForm, id)}>编辑</a>
|
||||||
<Auth auth="houseMember:delete">
|
</Auth>
|
||||||
<Popconfirm
|
<Auth auth="houseMember:delete">
|
||||||
placement="topRight"
|
<Popconfirm
|
||||||
title="是否确认删除"
|
placement="topRight"
|
||||||
onConfirm={() => this.onDelete(id)}
|
title="是否确认删除"
|
||||||
>
|
onConfirm={() => this.onDelete(id)}
|
||||||
<a>删除</a>
|
>
|
||||||
</Popconfirm>
|
<a>删除</a>
|
||||||
</Auth>,
|
</Popconfirm>
|
||||||
<Auth aut="houseMember:resetPwd">
|
</Auth>
|
||||||
<a onClick={() => this.onResetPassword(id)}>重置密码</a>
|
<Auth auth="houseMember:resetPwd">
|
||||||
</Auth>,
|
<a onClick={() => this.onResetPassword(id)}>重置密码</a>
|
||||||
<Auth auth="houseMember:grantData">
|
</Auth>
|
||||||
<a onClick={() => this.onOpen(this.dataForm, id)}>授权额外数据</a>
|
<Auth auth="houseMember:grantData">
|
||||||
</Auth>,
|
<a onClick={() => this.onOpen(this.dataForm, id)}>授权额外数据</a>
|
||||||
|
</Auth>
|
||||||
|
</QueryTableActions>,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class User extends Component {
|
|||||||
)}
|
)}
|
||||||
{user.roles &&
|
{user.roles &&
|
||||||
user.roles.map(role => (
|
user.roles.map(role => (
|
||||||
<Tag color="purple" className="mb-xs">
|
<Tag key={role.id} color="purple" className="mb-xs">
|
||||||
{role.name}
|
{role.name}
|
||||||
</Tag>
|
</Tag>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user