king
2022-06-08 c6f8e27d35cd31bb6393a1e7f747b6b2593dbd7a
src/tabviews/custom/index.jsx
@@ -523,23 +523,6 @@
        }
      }
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件
        if (item.supNodes && item.supNodes[0]) {
          item.setting.supModule = item.supNodes[0].componentId
        } else {
          item.wrap.supType = 'single'
          item.supNodes = null
          item.setting.supModule = ''
        }
      } else if (item.setting && item.setting.supModule) {
        let pid = item.setting.supModule.pop()
        if (pid && pid !== 'empty') {
          item.setting.supModule = pid
        } else {
          item.setting.supModule = ''
        }
      }
      // 搜索条件初始化
      if (item.search && item.search.length > 0) {
        item.search = Utils.initSearchVal(item.search)
@@ -601,6 +584,19 @@
        item.statFields = statFields
      }
      let mutil = false
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件
        mutil = true
        item.setting.supModule = item.supNodes[0].componentId
      } else if (item.setting && item.setting.supModule) {
        let pid = item.setting.supModule.pop()
        if (pid && pid !== 'empty') {
          item.setting.supModule = pid
        } else {
          item.setting.supModule = ''
        }
      }
      // 权限过滤
      let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 弹窗标签按钮Id
      if (item.action && item.action.length > 0) {
@@ -616,7 +612,7 @@
          cell.$view = 'CustomPage'
          cell.$toolbtn = true
          if (cell.syncComponentId === item.uuid) {
          if (!mutil && cell.syncComponentId === item.setting.supModule) {
            cell.syncComponentId = ''
          }
@@ -657,7 +653,7 @@
              cell.$tabId = tabId
              cell.$view = 'CustomPage'
              if (cell.syncComponentId === item.uuid) {
              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
              }
@@ -699,7 +695,7 @@
              cell.$tabId = tabId
              cell.$view = 'CustomPage'
              if (cell.syncComponentId === item.uuid) {
              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
              }
@@ -733,6 +729,8 @@
        if (item.wrap.linkType === 'sync') {
          item.wrap.syncModuleId = item.wrap.syncModule.pop()
          balMap.set(item.wrap.syncModuleId, true)
        } else if (item.wrap.linkType === 'sup') {
          item.wrap.supModule = item.wrap.supModule.pop()
        }
        item.elements = item.elements.filter(cell => {
          if (cell.eleType === 'button') {
@@ -746,7 +744,7 @@
            cell.$tabId = tabId
            cell.$view = 'CustomPage'
            if (cell.syncComponentId === item.uuid) {
            if (cell.syncComponentId === item.wrap.supModule) {
              cell.syncComponentId = ''
            }
@@ -787,7 +785,7 @@
              cell.$tabId = tabId
              cell.$view = 'CustomPage'
              if (cell.syncComponentId === item.uuid) {
              if (cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
              }
@@ -831,7 +829,7 @@
            cell.$tabId = tabId
            cell.$view = 'CustomPage'
            if (cell.syncComponentId === item.uuid) {
            if (cell.syncComponentId === item.setting.supModule) {
              cell.syncComponentId = ''
            }
@@ -853,14 +851,46 @@
          item.submit.logLabel = item.$menuname + '-提交'
          item.submit.$menuId = item.uuid
        }
      }
      } else if (item.type === 'form') {
        item.subcards = item.subcards.map(group => {
          group.subButton.uuid = group.uuid
          group.subButton.$menuId = group.uuid
          // group.subButton.$forbid = true // 不声明数据源变量
          group.subButton.OpenType = 'formSubmit'
          group.subButton.execError = 'never'
      // if (item.wrap && item.wrap.doubleClick) {
      //   let index = item.action.findIndex((btn) => btn.uuid === item.wrap.doubleClick)
      //   if (index === -1) {
      //     item.wrap.doubleClick = ''
      //   }
      // }
          if (!group.subButton.Ot) {
            group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
          }
          group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : ''
          if (group.subButton.syncComponentId === item.setting.supModule) {
            group.subButton.syncComponentId = ''
          }
          group.fields = group.fields.map(cell => {
            // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单
            if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
              let _option = Utils.getSelectQueryOptions(cell)
              cell.data_sql = Utils.formatOptions(_option.sql)
              cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
              cell.arr_field = _option.field
            }
            // 字段权限黑名单
            if (!cell.blacklist || !roleId || cell.blacklist.length === 0) return cell
            if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
              cell.hidden = 'true'
            }
            return cell
          })
          return group
        })
      }
      
      return true
    })