mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-24 13:14:16 +08:00
feat: col filter
This commit is contained in:
parent
1c4c93152e
commit
d24b3aebc6
@ -73,7 +73,8 @@ export default class InterfaceColMenu extends Component {
|
|||||||
expandedKeys: [],
|
expandedKeys: [],
|
||||||
colModalType: '',
|
colModalType: '',
|
||||||
colModalVisible: false,
|
colModalVisible: false,
|
||||||
editColId: 0
|
editColId: 0,
|
||||||
|
filterValue: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -187,9 +188,14 @@ export default class InterfaceColMenu extends Component {
|
|||||||
this.form = form;
|
this.form = form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterCol = (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
this.setState({filterValue: value})
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { currColId, currCaseId, isShowCol } = this.props;
|
const { currColId, currCaseId, isShowCol } = this.props;
|
||||||
const { colModalType, colModalVisible } = this.state;
|
const { colModalType, colModalVisible, filterValue } = this.state;
|
||||||
|
|
||||||
const menu = (col) => {
|
const menu = (col) => {
|
||||||
return (
|
return (
|
||||||
@ -209,7 +215,7 @@ export default class InterfaceColMenu extends Component {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="interface-filter">
|
<div className="interface-filter">
|
||||||
<Input placeholder="Filter by name" style={{ width: "70%" }} />
|
<Input placeholder="Filter by name" style={{ width: "70%" }} onChange={this.filterCol} />
|
||||||
<Tooltip placement="bottom" title="添加集合">
|
<Tooltip placement="bottom" title="添加集合">
|
||||||
<Tag color="#108ee9" style={{ marginLeft: "15px" }} onClick={() => this.showColModal('add')} ><Icon type="plus" /></Tag>
|
<Tag color="#108ee9" style={{ marginLeft: "15px" }} onClick={() => this.showColModal('add')} ><Icon type="plus" /></Tag>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -223,7 +229,7 @@ export default class InterfaceColMenu extends Component {
|
|||||||
onExpand={this.onExpand}
|
onExpand={this.onExpand}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
this.props.interfaceColList.map((col) => (
|
this.props.interfaceColList.filter(col => col.name.indexOf(filterValue) !== -1).map((col) => (
|
||||||
<TreeNode
|
<TreeNode
|
||||||
key={'col_' + col._id}
|
key={'col_' + col._id}
|
||||||
title={
|
title={
|
||||||
|
Loading…
Reference in New Issue
Block a user