king
2022-11-04 3c50bfdd8d605b3dd449adcb54cdf7f7c25d6c16
src/tabviews/custom/components/code/sand-box/index.jsx
@@ -10,11 +10,9 @@
class SandBoxComponent extends Component {
  static propTpyes = {
    BID: PropTypes.any,              // 父级Id
    data: PropTypes.array,           // 统一查询数据
    config: PropTypes.object,        // 组件配置信息
    mainSearch: PropTypes.any,       // 外层搜索条件
    menuType: PropTypes.any,         // 菜单类型
  }
  state = {
@@ -27,13 +25,25 @@
  }
  UNSAFE_componentWillMount () {
    const { data, initdata, BID } = this.props
    const { data, initdata } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _data = {}
    let _sync = false
    let BID = ''
    let BData = ''
    if (_config.setting.supModule) {
      BData = window.GLOB.CacheData.get(_config.setting.supModule)
    } else {
      BData = window.GLOB.CacheData.get(_config.$pageId)
    }
    if (BData) {
      BID = BData.$BID || ''
    }
    
    if (_config.setting && _config.wrap.datatype !== 'static') {
    if (_config.wrap.datatype !== 'static') {
      _sync = _config.setting.sync === 'true'
      if (_sync && data) {
@@ -67,7 +77,9 @@
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
        this.loadData()
        setTimeout(() => {
          this.loadData()
        }, _config.setting.delay || 0)
      }
      this.renderView()
    })
@@ -106,7 +118,7 @@
      this.setState({sync: false, data: _data}, () => {
        this.renderView()
      })
    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
    } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      this.setState({}, () => {
        this.loadData()
      })
@@ -122,7 +134,7 @@
  }
  async loadData () {
    const { mainSearch, menuType } = this.props
    const { mainSearch } = this.props
    const { config, arr_field, BID } = this.state
    if (config.wrap.datatype === 'static') {
@@ -151,7 +163,7 @@
    })
    let _orderBy = config.setting.order || ''
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType)
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID)
    let result = await Api.genericInterface(param)
    if (result.status) {
@@ -195,7 +207,7 @@
        try {
          // eslint-disable-next-line no-eval
          eval(js)
        } catch {
        } catch (e) {
          console.warn('JS 执行失败!')
        }
      }
@@ -206,7 +218,7 @@
    const { config, loading, html } = this.state
    return (
      <div className="custom-sand-box" style={{...config.style}}>
      <div className="custom-sand-box" id={'anchor' + config.uuid} style={{...config.style}}>
        {loading ?
          <div className="loading-mask">
            <div className="ant-spin-blur"></div>