king
2021-09-01 31ec63f0419895876cbaba99637a884a32d33d0d
src/tabviews/custom/components/carousel/prop-card/index.jsx
@@ -27,7 +27,8 @@
    config: null,              // 图表配置信息
    loading: false,            // 数据加载状态
    sync: false,               // 是否统一请求数据
    data: {}                   // 数据
    data: {},                  // 数据
    BData: null
  }
  UNSAFE_componentWillMount () {
@@ -133,12 +134,10 @@
      }
      this.setState({sync: false, data: _data})
    } else if (nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      if (config.wrap.datatype !== 'static' && config.setting.syncRefresh === 'true') {
        this.setState({}, () => {
          this.loadData()
        })
      }
    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      this.setState({}, () => {
        this.loadData()
      })
    }
  }
@@ -167,12 +166,12 @@
    }
  }
  resetParentParam = (MenuID, id) => {
  resetParentParam = (MenuID, id, data) => {
    const { config } = this.state
    if (config.wrap.datatype === 'static' || !config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID) {
      this.setState({ BID: id }, () => {
      this.setState({ BID: id, BData: data }, () => {
        this.loadData()
      })
    }
@@ -188,30 +187,25 @@
  async loadData () {
    const { mainSearch, menuType } = this.props
    const { config, arr_field, BID } = this.state
    const { config, arr_field, BID, BData } = this.state
    if (config.wrap.datatype === 'static') {
      this.setState({
        data: {$$BID: BID || ''},
        loading: false
        data: {$$BID: BID || '', $$BData: BData}
      })
      return
    } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询
      this.setState({
        data: {$$BID: BID || ''},
        loading: false
        data: {$$BID: BID || '', $$BData: BData}
      })
      return
    }
    let searches = []
    if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
      let keys = searches.map(item => item.key)
      mainSearch.forEach(item => {
        if (!keys.includes(item.key)) {
          searches.push(item)
        }
      })
    let searches = config.setting.useMSearch && mainSearch ? mainSearch : []
    let requireFields = searches.filter(item => item.required && item.value === '')
    if (requireFields.length > 0) {
      return
    }
    this.setState({
@@ -225,6 +219,7 @@
    if (result.status) {
      let _data = result.data && result.data[0] ? result.data[0] : {}
      _data.$$BID = BID || ''
      _data.$$BData = BData || ''
      this.setState({
        data: _data,
@@ -267,10 +262,10 @@
      }
      if (item.setting.joint === 'true') {
        newtab.param.BID = item.setting.primaryId
        newtab.param.$BID = item.setting.primaryId
      }
      if (['linkage_navigation', 'linkage'].includes(window.GLOB.navBar)) {
      if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
        this.props.modifyTabview([newtab])
      } else {
        let tabs = this.props.tabviews.filter((tab, i) => {
@@ -278,7 +273,7 @@
          return tab.MenuID !== newtab.MenuID
        })
        if (this.props.tabviews.length !== tabs.length) {
        if (this.props.tabviews.length > tabs.length) {
          this.props.modifyTabview(fromJS(tabs).toJS())
        }
@@ -300,7 +295,7 @@
          _param.User_Name = sessionStorage.getItem('User_Name')
          _param.param = { BID: item.setting.primaryId }
          src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
        } catch {
        } catch (e) {
          console.warn('菜单参数解析错误!')
        }
      } else if (item.setting.joint === 'true') {