From b3547d1c531e479021219fda5df153a11b9b52a3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 31 八月 2020 17:28:09 +0800 Subject: [PATCH] 2020-08-31 --- src/templates/zshare/transferform/index.jsx | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/templates/zshare/transferform/index.jsx b/src/templates/zshare/transferform/index.jsx index 4e492b5..f788ee9 100644 --- a/src/templates/zshare/transferform/index.jsx +++ b/src/templates/zshare/transferform/index.jsx @@ -6,8 +6,7 @@ class TransferForm extends Component { static propTypes = { columns: PropTypes.array, - selected: PropTypes.array, - dict: PropTypes.object, // 瀛楀吀椤� + selected: PropTypes.array } state = { @@ -46,7 +45,7 @@ key: item.uuid, title: item.label, field: item.field, - description: '' + description: item.label + '(' + item.field + ')' } }), targetKeys: selecteds @@ -83,12 +82,23 @@ } getItem = (item) => { - let content = item.title + '(' + item.field + ')' - return <span title={content}> - {content} - <Icon type="arrow-up" onClick={(e) => {this.changeorder(e, item, 'up')}} /> - <Icon type="arrow-down" onClick={(e) => {this.changeorder(e, item, 'down')}} /> - </span> + const { targetKeys } = this.state + + if (targetKeys.includes(item.key)) { + return <span title={item.description}> + {item.description} + <Icon type="arrow-up" onClick={(e) => {this.changeorder(e, item, 'up')}} /> + <Icon type="arrow-down" onClick={(e) => {this.changeorder(e, item, 'down')}} /> + </span> + } else { + return item.description + } + } + + filterdata = (inputValue, option) => { + if (!inputValue) return true + + return option.description.toLowerCase().indexOf(inputValue.toLowerCase()) > -1 } render() { @@ -98,9 +108,9 @@ <div className="common-table-columns-transfer"> <Transfer dataSource={this.state.data} - titles={[this.props.dict['header.form.column.source'], this.props.dict['header.form.column.target']]} + showSearch={this.state.data.length > 10} + filterOption={this.filterdata} targetKeys={targetKeys} - locale={{itemUnit: this.props.dict['header.form.column.itemUnit'], itemsUnit: this.props.dict['header.form.column.itemsUnit']}} selectedKeys={selectedKeys} onChange={this.handleChange} onSelectChange={this.handleSelectChange} -- Gitblit v1.8.0