king
2024-10-18 b1fc0a89ce16dd14a6dff98c228a308e85a53828
src/tabviews/custom/components/iframe/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Input, Modal, notification, Empty, Spin } from 'antd'
import { Input, Empty, Spin } from 'antd'
import Api from '@/api'
import UtilsDM from '@/utils/utils-datamanage.js'
@@ -43,6 +43,12 @@
    }
    
    if (_config.wrap.datatype === 'dynamic') {
      _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true'
      if (_config.setting.supModule && !BID) {
        _config.setting.onload = 'false'
      }
      if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) {
        _data = window.GLOB.SyncData.get(_config.dataName) || []
        _data = _data[0] || {$$empty: true}
@@ -67,14 +73,7 @@
      linkUrl: linkUrl,
      data: _data,
      BID: BID || '',
      config: _config,
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true' && _config.setting.onload === 'true') {
        setTimeout(() => {
          this.loadData()
        }, _config.setting.delay || 0)
      }
      config: _config
    })
  }
@@ -98,6 +97,8 @@
        node && node.select && node.select()
      }, 200)
    }
    this.initExec()
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -116,6 +117,16 @@
    MKEmitter.removeListener('searchRefresh', this.searchRefresh)
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('transferSyncData', this.transferSyncData)
  }
  initExec = () => {
    const { config } = this.state
    if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') {
      setTimeout(() => {
        this.loadData()
      }, config.setting.delay || 0)
    }
  }
  transferSyncData = (syncId) => {
@@ -166,7 +177,7 @@
  }
  async loadData () {
    const { config, arr_field, BID } = this.state
    const { config, BID } = this.state
    
    if (config.wrap.datatype === 'static') {
      this.setState({
@@ -190,7 +201,7 @@
    }
    let _orderBy = config.setting.order || ''
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID)
    let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID)
    let result = await Api.genericInterface(param)
    if (result.status) {
@@ -205,32 +216,9 @@
        data: _data
      })
      if (result.message) {
        if (result.ErrCode === 'Y') {
          Modal.success({
            title: result.message
          })
        } else if (result.ErrCode === 'S') {
          notification.success({
            top: 92,
            message: result.message,
            duration: 2
          })
        }
      }
      UtilsDM.querySuccess(result)
    } else {
      if (!result.message) return
      if (result.ErrCode === 'N') {
        Modal.error({
          title: result.message,
        })
      } else if (result.ErrCode !== '-2') {
        notification.error({
          top: 92,
          message: result.message,
          duration: 10
        })
      }
      UtilsDM.queryFail(result)
    }
  }