king
2024-08-12 21167ece56edd628e6f6546d1d642947cc3a048f
src/tabviews/custom/components/table/normal-table/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Collapse } from 'antd'
import { Collapse, notification } from 'antd'
import moment from 'moment'
import Api from '@/api'
@@ -432,8 +432,18 @@
      if (col.supField) {
        names = []
        if (BData && BData[col.supField]) {
          names = BData[col.supField].split(',')
        let val = ''
        if (BData) {
          let field = col.supField.toLowerCase()
          Object.keys(BData).forEach(key => {
            if (key.toLowerCase() === field) {
              val = BData[key] + ''
            }
          })
        }
        if (val) {
          names = val.split(',')
          if (names.length > fields.length) {
            names.length = fields.length
@@ -519,6 +529,10 @@
      reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 列表重置
      if (setting.$hasSyncModule) {
        MKEmitter.emit('syncBalconyData', config.uuid, [], false)
      }
      if (config.$hasTopModule) {
        window.GLOB.CacheData.set(config.uuid + 'tb', { $$empty: true, $$uuid: '' })
        MKEmitter.emit('mkPublicData', config.uuid + 'tb', { $$empty: true, $$uuid: '' })
      }
      this.loaded = true
@@ -643,6 +657,11 @@
        loading: false
      })
      if (config.$hasTopModule) {
        window.GLOB.CacheData.set(config.uuid + 'tb', data[0] || { $$empty: true, $$uuid: '' })
        MKEmitter.emit('mkPublicData', config.uuid + 'tb', data[0] || { $$empty: true, $$uuid: '' })
      }
      if (config.timer && config.clearField && result.data && result.data[0]) {
        let vals = (config.clearValue || '').split(',')
        if (vals.includes(result.data[0][config.clearField])) {
@@ -705,6 +724,12 @@
        _data.$$uuid = _data[setting.primaryKey] || ''
        _data.$$BID = BID || ''
        _data.$$BData = BData || ''
        if (setting.controlField) {
          if (setting.controlVal.includes(_data[setting.controlField] + '')) {
            _data.$disabled = true
          }
        }
  
        if (config.absFields) {
          config.absFields.forEach(f => {
@@ -793,6 +818,20 @@
   * 含有初始不加载的页面,修改设置
   */
  refreshbysearch = (searches) => {
    const { setting, BID } = this.state
    if (setting.supModule && !BID && setting.supKey !== 'false') {
      notification.warning({
        top: 92,
        message: window.GLOB.dict['sup_key_req'] || '需要上级主键值!',
        duration: 5
      })
      this.setState({
        search: searches
      })
      return
    }
    this.setState({
      pageIndex: 1,
      search: searches
@@ -928,7 +967,7 @@
    if (config.uuid !== menuId) return
    if (config.supNodes) {
      if (position === 'mainline' || position === 'popclose') {
      if (['mainline', 'maingrid', 'popclose'].includes(position)) {
        let supNode = this.supModules[this.supModules.length - 1]
        config.supNodes.forEach((item, i) => {
          setTimeout(() => {
@@ -941,7 +980,7 @@
        })
      } else {
        if (position === 'line' || position === 'line_grid') {
          if (lines && lines.length === 1) {
          if (lines && lines.length === 1 && !config.forbidLine) {
            this.loadLinedata(lines[0].$$uuid, position)
          } else {
            this.reloadtable(btn, id)
@@ -952,13 +991,13 @@
      }
    } else {
      if (position === 'line' || position === 'line_grid') {
        if (lines && lines.length === 1) {
        if (lines && lines.length === 1 && !config.forbidLine) {
          this.loadLinedata(lines[0].$$uuid, position)
        } else {
          this.reloadtable(btn, id)
        }
      } else if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 刷新源组件时,附带刷新上级行与当前组件
        MKEmitter.emit('reloadData', config.setting.supModule, BID)
      } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
        MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
      } else {
        this.reloadtable(btn, id)
      }
@@ -994,9 +1033,7 @@
    if (config.$searchId !== searchId) return
    
    this.setState({pageIndex: 1}, () => {
      this.reloadtable()
    })
    this.reloadtable()
  }
  render() {