king
2024-10-30 c96108bd84050feb01b47db3f5cae96670fda435
src/tabviews/custom/components/share/tabtransfer/index.jsx
@@ -50,9 +50,16 @@
  UNSAFE_componentWillMount () {
    let _config = fromJS(this.props.config).toJS()
    let BID = ''
    let BData = window.GLOB.CacheData.get(_config.$pageId)
    if (BData) {
      BID = BData.$BID || ''
    }
    let params = []
    if (_config.type !== 'group') {
      _config.components = this.formatSetting(_config.components, params)
      _config.components = this.formatSetting(_config.components, params, BID)
    } else {
      let delay = 110
      _config.components.forEach(item => {
@@ -68,17 +75,17 @@
      config: _config
    }, () => {
      if (params.length > 0) {
        this.loadmaindata(params)
        this.loadmaindata(params, BID)
      }
    })
  }
  formatSetting = (components, params) => {
  formatSetting = (components, params, BID) => {
    let delay = 110
    return components.map(item => {
      if (item.type === 'tabs') return item
      if (item.type === 'group') {
        item.components = this.formatSetting(item.components, params)
        item.components = this.formatSetting(item.components, params, BID)
        return item
      }
@@ -102,7 +109,18 @@
          item.setting.sync = 'false'
          item.setting.onload = 'false'
        } else {
          params.push(getStructDefaultParam(item, searchlist, params.length === 0))
          let backend = false
          if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + item.uuid)) {
            backend = true
          } else if (window.backend && params[0] && params[0].exps) {
            backend = true
          }
          if (backend && !window.GLOB.CacheData.has('sql_' + item.uuid)) {
            item.setting.sync = 'false'
          } else {
            params.push(getStructDefaultParam(item, searchlist, params.length === 0, BID))
          }
        }
      }
      
@@ -116,19 +134,17 @@
  /**
   * @description 主表数据加载
   */ 
  loadmaindata = (params) => {
  loadmaindata = (params, BID) => {
    const { config } = this.state
    let BID = ''
    let BData = window.GLOB.CacheData.get(config.$pageId)
    if (BData) {
      BID = BData.$BID || ''
    }
    let param = getStructuredParams(params, config, BID)
    if (config.$cache && config.$time) {
      Api.getLCacheConfig(params[0].uuid, config.$time).then(res => {
      let uuid = params[0].uuid || ''
      if (params[0].id) {
        uuid = window.GLOB.CacheData.get('first_' + params[0].id) || ''
      }
      Api.getLCacheConfig(uuid, config.$time, BID).then(res => {
        if (!res.valid) {
          this.getMainData(param, params, config.uuid)
        }
@@ -156,11 +172,11 @@
        }
        params.forEach((item) => {
          let _data = result[item.name] || ''
          let _data = result[item.dataName] || ''
          if (_data && !Array.isArray(_data)) {
            _data = [_data]
          }
          window.GLOB.SyncData.set(item.name, _data)
          window.GLOB.SyncData.set(item.dataName, _data)
        })
        MKEmitter.emit('transferSyncData', tabId)
@@ -168,6 +184,10 @@
        MKEmitter.emit('transferSyncData', tabId)
        if (!result.message) return
        if (/将截断字符串或二进制数据/ig.test(result.message)) {
          result.message = result.message + '请检查字段集'
        }
        if (result.ErrCode === 'N') {
          Modal.error({
            title: result.message,
@@ -290,9 +310,7 @@
        )
      } else if (item.type === 'group' && item.subtype === 'normalgroup') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <NormalGroup config={item}/>
          </Col>
          <NormalGroup config={item} style={style} key={item.uuid}/>
        )
      } else if (item.type === 'form' && item.subtype === 'simpleform') {
        return (
@@ -384,7 +402,7 @@
    }
    return (
      <Row className="component-wrap" id={'anchor' + config.uuid} gutter={8}>{this.getComponents(config.components)}</Row>
      <Row className="component-wrap" id={'anchor' + config.uuid}>{this.getComponents(config.components)}</Row>
    )
  }
}