king
2021-03-05 e36eb1999794bd71e76482b92a0b0b20f49d0032
src/templates/sharecomponent/fieldscomponent/index.jsx
@@ -14,20 +14,19 @@
  static propTpyes = {
    type: PropTypes.string,          // 搜索条件添加、显示列添加
    config: PropTypes.object,        // 容器Id
    tableFields: PropTypes.string,   // 已选表字段集
    updatefield: PropTypes.func
  }
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    fields: [],          // 字段集
    tableVisible: false,    // 模态框控制
  }
  queryField = () => {
    const { type, config, tableFields } = this.props
    const { type, config } = this.props
    // 判断是否已选择表名
    if (!tableFields || tableFields.length === 0) {
    if (!window.GLOB.tableFields || window.GLOB.tableFields.length === 0) {
      notification.warning({
        top: 92,
        message: '请选择表名!',
@@ -38,7 +37,7 @@
    // 表字段集转为map数据
    let columns = new Map()
    tableFields.forEach(table => {
    window.GLOB.tableFields.forEach(table => {
      table.columns.forEach(column => {
        columns.set(column.field.toLowerCase(), column)
      })
@@ -242,23 +241,24 @@
    } else if (type === 'form') {
      if (config.groups.length > 1) {
        config.groups.forEach(group => {
          let _items = []
          group.sublist.forEach(item => {
            if (columnsMap.has(item.field.toLowerCase())) {
              let cell = columnsMap.get(item.field.toLowerCase())
      
              if (cell.selected && cell.type === item.type) { // 数据选择状态及类型未修改时,直接添加
                items.push(item)
                _items.push(item)
              } else if (cell.selected) {                     // 数据类型修改时,重置类型及初始值
                item.type = cell.type
                item.initval = ''
                items.push(item)
                _items.push(item)
              }
              columnsMap.delete(item.field.toLowerCase())
            } else if (!item.origin) {                        // 过滤示例项
              items.push(item)
              _items.push(item)
            }
          })
          group.sublist = items
          group.sublist = _items
        })
        
        let _columns = [...columnsMap.values()]