king
2023-04-27 59db6fab9c1ed1fa5559d423d439e14ea33b1598
src/tabviews/custom/components/module/account/index.jsx
@@ -25,6 +25,7 @@
  componentDidMount () {
    this.loadData()
    MKEmitter.addListener('reloadData', this.reloadData)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -37,6 +38,20 @@
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('reloadData', this.reloadData)
  }
  reloadData = (menuId) => {
    const { config } = this.props
    const { activeItem } = this.state
    if (config.uuid !== menuId) return
    if (activeItem) {
      MKEmitter.emit('resetSelectLine', config.uuid, activeItem.id, activeItem)
    } else {
      this.loadData()
    }
  }
@@ -171,7 +186,7 @@
    return (
      <div className="menu-account-wrap" style={config.style}>
        {config.wrap.MenuID ? <Select value={activeItem ? activeItem.id : ''} placeholder="请选择账套" onChange={this.changeBook} dropdownRender={menu => (
        {config.wrap.MenuID ? <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} value={activeItem ? activeItem.id : ''} placeholder="请选择账套" onChange={this.changeBook} dropdownRender={menu => (
          <div>
            {menu}
            <Divider style={{ margin: '4px 0' }} />
@@ -181,11 +196,11 @@
          </div>
        )}>
          {books.map(item => (
            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
            <Option disabled={!item.months} title={item.account_name} key={item.id}>{item.account_name}</Option>
          ))}
        </Select> : <Select value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="请选择账套" onChange={this.changeBook}>
        </Select> : <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="请选择账套" onChange={this.changeBook}>
          {books.map(item => (
            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
            <Option disabled={!item.months} title={item.account_name} key={item.id}>{item.account_name}</Option>
          ))}
        </Select>}
        {activeItem ? <span className="date">{activeItem.date}</span> : null}