king
2020-08-31 b3547d1c531e479021219fda5df153a11b9b52a3
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}