king
2021-08-31 72419e2f826031a158173f46d723a672064e37cd
src/tabviews/custom/components/form/tab-form/index.jsx
@@ -103,19 +103,10 @@
      return group
    })
    let _group = config.subcards[0]
    if (_data && config.wrap.statusControl && _data[config.wrap.statusControl]) {
      let _status = _data[config.wrap.statusControl]
      let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
      _group = _groups || _group
    }
    this.setState({
      sync: _sync,
      data: _data,
      group: _group,
      group: config.subcards[0],
      BID: BID || '',
      config: config,
      arr_field: config.columns.map(col => col.field).join(','),
@@ -162,13 +153,10 @@
          _data = _data[0] || {}
        }
      }
      if (config.wrap.statusControl && _data[config.wrap.statusControl]) {
        let _status = _data[config.wrap.statusControl]
        let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
        _group = _groups || _group
      }
      this.setState({sync: false, data: _data, group: _group})
      this.setState({sync: false, data: _data, group: null}, () => {
        this.setState({group: _group})
      })
    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      this.setState({}, () => {
        this.loadData()
@@ -181,7 +169,7 @@
    if (config.uuid !== menuId) return
    this.loadData(null, 'refresh')
    this.loadData()
  }
  /**
@@ -204,7 +192,7 @@
    }
    if (config.wrap.datatype !== 'static' && config.setting) {
      this.loadData(btn)
      this.loadData()
    }
    this.execSuccess(btn, id)
@@ -249,7 +237,7 @@
    }
  }
  async loadData (btn, type) {
  async loadData () {
    const { mainSearch, menuType } = this.props
    const { config, arr_field, BID, group } = this.state
@@ -257,7 +245,6 @@
      this.setState({
        data: {}
      })
      btn && this.execSuccess(btn)
      return
    }
@@ -265,7 +252,6 @@
    let requireFields = searches.filter(item => item.required && item.value === '')
    if (requireFields.length > 0) {
      btn && this.execSuccess(btn)
      return
    }
@@ -280,32 +266,15 @@
    if (result.status) {
      let _data = result.data && result.data[0] ? result.data[0] : {}
      if (btn) {
        this.setState({
          data: _data || {},
          loading: false
        })
        this.execSuccess(btn)
      } else {
        let _group = group
      let _group = group
        if (type === 'refresh') {
          _group = config.subcards[0]
        }
        if (config.wrap.statusControl && _data[config.wrap.statusControl]) {
          let _status = _data[config.wrap.statusControl]
          let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
          _group = _groups || _group
        }
        this.setState({
          group: null,
          data: _data || {},
          loading: false
        }, () => {
          this.setState({group: _group})
        })
      }
      this.setState({
        group: null,
        data: _data || {},
        loading: false
      }, () => {
        this.setState({group: _group})
      })
    } else {
      this.setState({
        loading: false,
@@ -315,7 +284,6 @@
        message: result.message,
        duration: 10
      })
      btn && this.execSuccess(btn)
    }
  }
@@ -360,7 +328,7 @@
          dict={dict}
          data={data}
          action={group}
          inputSubmit={this.handleOk}
          inputSubmit={() => this.mkFormSubmit(group.uuid)}
          wrappedComponentRef={(inst) => this.formRef = inst}
        /> : null}
        {group && data ? <div className={'mk-form-action ' + (group.$button || '')}>