king
2024-08-25 326aa6b3effaccc71cfe0775d47b0f29eb3695a6
src/templates/comtableconfig/updatetable/index.jsx
@@ -21,6 +21,7 @@
  state = {}
  delButtons = []
  baseMsg = {}
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
@@ -28,7 +29,7 @@
  trigger = () => {
    const { config } = this.props
    const _this = this
    const that = this
    if (!config.enabled) {
      notification.warning({
@@ -44,7 +45,7 @@
      content: '',
      onOk() {
        return new Promise(resolve => {
          _this.execUpdate(resolve)
          that.execUpdate(resolve)
        })
      },
      onCancel() {}
@@ -52,8 +53,14 @@
  }
  execUpdate = (_resolve) => {
    const { config } = this.props
    const config = fromJS(this.props.config).toJS()
    this.delButtons = []
    this.baseMsg = {
      fstMenuId: config.fstMenuId,
      parentId: config.ParentId,
      MenuName: config.MenuName,
      MenuNo: config.MenuNo,
    }
    let _config = {
      version: 1.0,
@@ -77,24 +84,22 @@
      style: { backgroundColor: '#ffffff', paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px'},
    }
    let uuids = {}
    let formActions = []
    let popActions = []
    let errors = []
    let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false'}
    let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false', isMain: true}
    let oldtabs = {
      mainTable: mainTb.uuid
    }
    let tbl = this.getTable(config, mainTb, uuids, errors, formActions, popActions, oldtabs)
    let tbl = this.getTable(config, mainTb, errors, formActions, popActions, oldtabs)
    if (config.autoMatic && config.autoMatic.enable === 'true' && uuids[config.autoMatic.action]) {
      _config.autoMatic = {...config.autoMatic}
      _config.autoMatic.action = uuids[config.autoMatic.action]
      if (tbl.action.filter(item => item.uuid === _config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) {
    if (config.autoMatic && config.autoMatic.enable === 'true') {
      if (tbl.action.filter(item => item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) {
        _config.autoMatic = {enable: 'false'}
      } else {
        _config.autoMatic = {...config.autoMatic}
      }
    } else {
      _config.autoMatic = {enable: 'false'}
@@ -105,7 +110,11 @@
    let _tbs = []
    if (config.tabgroups && config.tabgroups.length > 0) {
      config.tabgroups.forEach(m => {
        if (!m.sublist || m.sublist.length === 0) return
        if (!m.sublist) return
        m.sublist = m.sublist.filter(c => !!c.linkTab)
        if (m.sublist.length === 0) return
        let tabs = {
          uuid: Utils.getuuid(),
@@ -114,7 +123,7 @@
          setting: {},
          style: {},
          subtabs: m.sublist.map(n => {
            let tab = { uuid: Utils.getuuid(), label: n.label, icon: n.icon, permission: 'false', components: [
            let tab = { uuid: Utils.getuuid(), label: n.label, icon: n.icon, permission: 'true', components: [
              {
                uuid: Utils.getuuid(),
                linkTab: n.linkTab,
@@ -141,7 +150,7 @@
      let defers = _tbs.map((item, i) => {
        return new Promise((resolve) => {
          setTimeout(() => {
            Api.getSystemConfig({
            Api.getCloudConfig({
              func: 'sPC_Get_LongParam',
              MenuID: item.linkTab
            }).then(res => {
@@ -182,11 +191,29 @@
          }
        })
        let supIds = []
        _config.components = _config.components.map(item => {
          if (item.type === 'tabs') {
            item.subtabs = item.subtabs.map(tab => {
              tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], uuids, errors, formActions, popActions, oldtabs)
              tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, popActions, oldtabs)
              supIds.push([item.uuid, tab.uuid, tab.components[0].uuid])
              return tab
            })
          }
          return item
        })
        _config.components = _config.components.map(item => {
          if (item.type === 'tabs') {
            item.subtabs = item.subtabs.map(tab => {
              if (tab.components[0].setting.supModule && tab.components[0].setting.supModule.length === 1) {
                supIds.forEach(ids => {
                  if (ids[2] === tab.components[0].setting.supModule[0]) {
                    tab.components[0].setting.supModule = ids
                  }
                })
              }
              return tab
            })
          }
@@ -205,7 +232,7 @@
      let defers = popActions.map((item, i) => {
        return new Promise((resolve) => {
          setTimeout(() => {
            Api.getSystemConfig({
            Api.getCloudConfig({
              func: 'sPC_Get_LongParam',
              MenuID: item.linkTab
            }).then(res => {
@@ -258,22 +285,24 @@
                      uuid: btn.uuid,
                      MenuID: btn.uuid,
                      ParentId: tab.components[0].uuid,
                      enabled: false,
                      MenuName: btn.label,
                      tables: _config.tables || [],
                      Template: 'BaseTable',
                      components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
                      components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                      viewType: 'popview',
                      style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                    }
                    btn.config.enabled = this.setEnabled(btn.config)
                  } else {
                    errors.push(tab.label + '中按钮《' + btn.label + '》配置信息丢失')
                  }
                }
              })
              tab.components[0].cols.forEach(col => {
                if (col.type !== 'action') return
                if (col.type !== 'custom') return
                col.elements.forEach(btn => {
                  if (btn.eleType !== 'button') return
                  if (btn.OpenType === 'popview') {
                    if (menus[btn.uuid]) {
                      let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false'}
@@ -282,14 +311,15 @@
                        uuid: btn.uuid,
                        MenuID: btn.uuid,
                        ParentId: tab.components[0].uuid,
                        enabled: false,
                        MenuName: btn.label,
                        tables: _config.tables || [],
                        Template: 'BaseTable',
                        components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
                        components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                        viewType: 'popview',
                        style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                      }
                      btn.config.enabled = this.setEnabled(btn.config)
                    } else {
                      errors.push(tab.label + '中按钮《' + btn.label + '》配置信息丢失')
                    }
@@ -307,22 +337,24 @@
                    uuid: btn.uuid,
                    MenuID: btn.uuid,
                    ParentId: item.uuid,
                    enabled: false,
                    MenuName: btn.label,
                    tables: _config.tables || [],
                    Template: 'BaseTable',
                    components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
                    components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                    viewType: 'popview',
                    style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                  }
                  btn.config.enabled = this.setEnabled(btn.config)
                } else {
                  errors.push('主表中按钮《' + btn.label + '》配置信息丢失')
                }
              }
            })
            item.cols.forEach(col => {
              if (col.type !== 'action') return
              if (col.type !== 'custom') return
              col.elements.forEach(btn => {
                if (btn.eleType !== 'button') return
                if (btn.OpenType === 'popview') {
                  if (menus[btn.uuid]) {
                    let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false'}
@@ -331,14 +363,15 @@
                      uuid: btn.uuid,
                      MenuID: btn.uuid,
                      ParentId: item.uuid,
                      enabled: false,
                      MenuName: btn.label,
                      tables: _config.tables || [],
                      Template: 'BaseTable',
                      components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
                      components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                      viewType: 'popview',
                      style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                    }
                    btn.config.enabled = this.setEnabled(btn.config)
                  } else {
                    errors.push('主表中按钮《' + btn.label + '》配置信息丢失')
                  }
@@ -355,12 +388,31 @@
    }
  }
  setEnabled = (config) => {
    let enabled = true
    config.components.forEach(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          if (tab.components[0].errors.length > 0) {
            enabled = false
          }
        })
      } else {
        if (item.errors.length > 0) {
          enabled = false
        }
      }
    })
    return enabled
  }
  setPopForm = (_resolve, _config, formActions, errors) => {
    if (formActions.length > 0) {
      let defers = formActions.map((item, i) => {
        return new Promise((resolve) => {
          setTimeout(() => {
            Api.getSystemConfig({
            Api.getCloudConfig({
              func: 'sPC_Get_LongParam',
              MenuID: item.origin
            }).then(res => {
@@ -377,6 +429,40 @@
  
                if (_LongParam) {
                  _LongParam.uuid = item.uuid
                  if (_LongParam.fields && _LongParam.fields.length === 0 && _LongParam.groups && _LongParam.groups.length > 0) {
                    _LongParam.groups.forEach(group => {
                      if (group.sublist && group.sublist.length > 0) {
                        _LongParam.fields.push({
                          uuid: Utils.getuuid(),
                          label: group.label,
                          field: '',
                          type: 'split'
                        })
                        _LongParam.fields.push(...group.sublist)
                      }
                    })
                  }
                  let span = _LongParam.setting && _LongParam.setting.cols ? (24 / _LongParam.setting.cols) : 12
                  if (![24, 12, 8].includes(span)) {
                    span = 12
                  }
                  if (_LongParam.fields) {
                    _LongParam.fields = _LongParam.fields.map(n => {
                      if (!n.span && n.type !== 'split') {
                        if (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(n.type)) {
                          n.span = 24
                        } else {
                          n.span = span
                        }
                      }
                      return n
                    })
                  }
                  resolve(_LongParam)
                } else {
                  resolve({uuid: item.uuid, $empty: true})
@@ -421,8 +507,9 @@
                }
              })
              tab.components[0].cols.forEach(col => {
                if (col.type !== 'action') return
                if (col.type !== 'custom') return
                col.elements.forEach(btn => {
                  if (btn.eleType !== 'button') return
                  if (btn.OpenType === 'popview' && btn.config && btn.config.components[0]) {
                    this.setTbForm(btn.config.components[0], menus, errors, tab.components[0].name + '-' + btn.label)
                  } else if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
@@ -458,8 +545,9 @@
              }
            })
            item.cols.forEach(col => {
              if (col.type !== 'action') return
              if (col.type !== 'custom') return
              col.elements.forEach(btn => {
                if (btn.eleType !== 'button') return
                if (btn.OpenType === 'popview' && btn.config && btn.config.components[0]) {
                  this.setTbForm(btn.config.components[0], menus, errors, item.name + '-' + btn.label)
                } else if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
@@ -502,8 +590,9 @@
      }
    })
    item.cols.forEach(col => {
      if (col.type !== 'action') return
      if (col.type !== 'custom') return
      col.elements.forEach(btn => {
        if (btn.eleType !== 'button') return
        if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
          if (menus[btn.uuid]) {
            btn.modal = {
@@ -522,7 +611,7 @@
  saveConfig = (_resolve, _config, errors) => {
    let err = errors.join(';')
    let _this = this
    let that = this
    if (err) {
      _resolve()
@@ -531,7 +620,7 @@
        content: '',
        onOk() {
          return new Promise(resolve => {
            _this.saveNewMenu(resolve, _config)
            that.saveNewMenu(resolve, _config)
          })
        },
        onCancel() {}
@@ -551,8 +640,9 @@
            }
          })
          tab.components[0].cols.forEach(col => {
            if (col.type !== 'action') return
            if (col.type !== 'custom') return
            col.elements.forEach(btn => {
              if (btn.eleType !== 'button') return
              if (btn.OpenType === 'popview' && btn.config) {
                btn.config.$tables = getTables(btn.config.components[0])
              }
@@ -568,8 +658,9 @@
          }
        })
        item.cols.forEach(col => {
          if (col.type !== 'action') return
          if (col.type !== 'custom') return
          col.elements.forEach(btn => {
            if (btn.eleType !== 'button') return
            if (btn.OpenType === 'popview' && btn.config) {
              btn.config.$tables = getTables(btn.config.components[0])
            }
@@ -580,53 +671,60 @@
      }
    })
    this.submitConfig(_resolve, _config)
  }
  checkBtns = (card) => {
    card.action.forEach(cell => {
      if (cell.hidden === 'true') return
      if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
        if (!cell.modal || cell.modal.fields.length === 0) {
          card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`})
        }
      } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
        card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`})
      } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
        card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`})
      }
    })
    card.cols.forEach(col => {
      if (col.type !== 'custom') return
      col.elements.forEach(cell => {
        if (cell.hidden === 'true' || cell.eleType !== 'button') return
        if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
          if (!cell.modal || cell.modal.fields.length === 0) {
            card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`})
          }
        } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
          card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`})
        } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
          card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`})
        }
      })
    })
  }
  submitConfig = (_resolve, config) => {
    let tbs = []
    _config.components.forEach(item => {
    config.components.forEach(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          if (tab.components[0].$tables) {
            tbs.push(...tab.components[0].$tables)
          }
          tab.components[0].errors = []
          let columns = tab.components[0].columns.map(c => c.field)
          if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) {
            tab.components[0].errors.push({ level: 0, detail: '未设置数据源!'})
          } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) {
            tab.components[0].errors.push({ level: 0, detail: '数据源中无可用脚本!'})
          } else if (!tab.components[0].setting.primaryKey) {
            tab.components[0].errors.push({ level: 0, detail: '未设置主键!'})
          } else if (!columns.includes(tab.components[0].setting.primaryKey)) {
            tab.components[0].errors.push({ level: 0, detail: '主键已失效!'})
          } else if (!tab.components[0].setting.supModule) {
            tab.components[0].errors.push({ level: 0, detail: '未设置上级组件!'})
          }
          this.checkBtns(tab.components[0])
        })
      } else {
        if (item.$tables) {
          tbs.push(...item.$tables)
        }
        item.errors = []
        let columns = item.columns.map(c => c.field)
        if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) {
          item.errors.push({ level: 0, detail: '未设置数据源!'})
        } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.filter(script => script.status !== 'false').length === 0) {
          item.errors.push({ level: 0, detail: '数据源中无可用脚本!'})
        } else if (!item.setting.primaryKey) {
          item.errors.push({ level: 0, detail: '未设置主键!'})
        } else if (!columns.includes(item.setting.primaryKey)) {
          item.errors.push({ level: 0, detail: '主键已失效!'})
        } else if (!item.setting.supModule) {
          item.errors.push({ level: 0, detail: '未设置上级组件!'})
        }
        this.checkBtns(item)
      }
    })
    this.submitConfig(_resolve, _config, tbs)
  }
  submitConfig = (_resolve, config, tbs) => {
    let arr = []
    tbs = tbs.filter(tb => {
      let _tb = tb.toLowerCase()
@@ -675,24 +773,30 @@
      debug_md5: key,
      debug_url: url,
      debug_list: window.btoa(tbs),
      LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
      LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))),
      LText: ''
    }
    param.LText = Utils.formatOptions(param.LText)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
    param.secretkey = Utils.encrypt('', param.timestamp)
    let save = false
    new Promise(resolve => {
      Api.getSystemConfig(param).then(res => {
      Api.getCloudConfig(param).then(res => {
        resolve(res)
      })
    }).then(res => { // 删除原菜单
      if (!res || !res.status) return res
      save = true
      localStorage.setItem('menuUpdate', new Date().getTime() + ',' + config.uuid)
      if (this.delButtons.length === 0) return res
      return Api.getSystemConfig({
      return Api.getCloudConfig({
        func: 'sPC_MainMenu_Del',
        up_type: 'Y',
        MenuID: this.delButtons.join(',')
      })
    }).then(res => {
@@ -701,34 +805,36 @@
      _resolve()
      if (res.status) {
        localStorage.setItem('menuUpdate', new Date().getTime())
        notification.success({
          top: 92,
          message: '升级成功',
          duration: 2
        })
        delete urlparam.type
        delete urlparam.MenuType
        let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
        setTimeout(() => {
          window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
          window.location.reload()
        }, 2000)
        window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
        window.location.reload()
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        Modal.warning({
          title: res.message,
          okText: '知道了',
          onOk: () => {
            if (save) {
              delete urlparam.type
              delete urlparam.MenuType
              let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
              window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
              window.location.reload()
            } else {
              window.location.reload()
            }
          }
        })
      }
    })
  }
  getTable = (config, newCon, uuids, errors, formActions, popActions, oldtabs) => {
  getTable = (config, newCon, errors, formActions, popActions, oldtabs) => {
    let _card = {
      uuid: newCon.uuid,
      type: 'table',
@@ -740,7 +846,7 @@
      action: [],
      subtype: 'basetable',
      setting: { useMSearch: newCon.useMSearch },
      wrap: {},
      wrap: {name: newCon.name},
      style: {},
      headerStyle: {},
      columns: [],
@@ -753,7 +859,7 @@
      return _card
    }
    if (newCon.supModule && oldtabs[newCon.supModule]) {
    if (oldtabs && newCon.supModule && oldtabs[newCon.supModule]) {
      _card.setting.supModule = [oldtabs[newCon.supModule]]
    } else {
      _card.setting.supModule = ['empty']
@@ -769,7 +875,11 @@
    let lineMarks = []
    config.columns.forEach(col => {
      if (col.type === 'colspan') {
        _colspan.push(...col.subfield.split(', '))
        if (col.subfield) {
          _colspan.push(...col.subfield.split(', '))
        } else if (col.sublist && col.sublist.length > 0) {
          _colspan.push(...col.sublist)
        }
      }
      if (!col.field) return
@@ -807,6 +917,7 @@
          if (m.signType === 'line') {
            lineMarks.push({
              $index: lineMarks.length + 1,
              uuid: Utils.getuuid(),
              field: field,
              color: color,
              contrastValue: m.contrastValue || '',
@@ -816,6 +927,7 @@
          } else {
            _col.marks.push({
              $index: _col.marks.length + 1,
              uuid: Utils.getuuid(),
              field: field,
              color: color,
              contrastValue: m.contrastValue || '',
@@ -838,7 +950,7 @@
        if (_colspan.includes(col.field)) {
          _col.Hide = 'true'
        }
        _col.uuid = Utils.getuuid()
        _card.cols.push(_col)
      }
@@ -849,14 +961,21 @@
          label: col.label,
          marks: [],
          isSub: false,
          uuid: col.uuid,
          uuid: Utils.getuuid(),
          blacklist: []
        }
        let _subs = []
        if (col.subfield) {
          _subs = col.subfield.split(', ')
        } else if (col.sublist) {
          _subs = col.sublist
        }
        if (col.unfold === 'true') {
          ucol.type = 'colspan'
          ucol.subcols = []
          col.subfield.split(', ').forEach(sub => {
          _subs.forEach(sub => {
            if (_cols[sub]) {
              let _col = fromJS(_cols[sub]).toJS()
              _col.Hide = 'false'
@@ -876,17 +995,19 @@
          ucol.elements = []
          ucol.style = {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'}
          col.subfield.split(', ').forEach(sub => {
          _subs.forEach(sub => {
            if (_cols[sub]) {
              let _col = {
                copyable: 'false',
                datatype: 'dynamic',
                eleType: _cols[sub].type !== 'number' ? 'text' : 'number',
                field: sub,
                height: 1,
                innerHeight: 21,
                height: '',
                innerHeight: 'auto',
                marks: _cols[sub].marks || null,
                noValue: 'show',
                prefix: _cols[sub].prefix || '',
                postfix: _cols[sub].postfix || '',
                style: {},
                width: 24,
                uuid: Utils.getuuid()
@@ -959,15 +1080,28 @@
    }
    let colbtns = []
    let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666', default: 'rgba(0, 0, 0, 0.65)' }
    let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#E7E7EF', default: 'rgba(0, 0, 0, 0.65)' }
    let uuids = {}
    config.action.forEach(btn => {
      let _c = btn.class ? btn.class.replace('border-', '') : ''
      let color = colors[_c] || '#1890ff'
      let _btn = fromJS(btn).toJS()
      _btn.uuid = Utils.getuuid()
      // _btn.uuid = Utils.getuuid()
      delete _btn.position
      delete _btn.linkTab
      if (_btn.intertype === 'inner' && !_btn.innerFunc) {
        _btn.intertype = 'system'
      }
      if ((_btn.intertype === 'outer' || _btn.intertype === 'custom') && !_btn.procMode) { // 兼容外部函数直传类型
        _btn.procMode = !_btn.innerFunc ? 'none' : 'inner'
      }
      if (_btn.funcType === 'print' && _btn.execMode) {
        _btn.OpenType = 'funcbutton'
      } else if (_btn.OpenType === 'blank') {
        _btn.OpenType = 'tab'
      }
      this.delButtons.push(btn.uuid)
@@ -980,14 +1114,10 @@
        if (newCon.equalTab && oldtabs && oldtabs[newCon.equalTab]) {
          _btn.syncComponent.push(oldtabs[newCon.equalTab])
        }
      } else if (_btn.execSuccess === 'maingrid') {
        _btn.execSuccess = 'mainline'
      }
      if (_btn.execError === 'equaltab') {
        _btn.execError = 'grid'
      } else if (_btn.execError === 'maingrid') {
        _btn.execError = 'mainline'
      }
      if (_btn.popClose === 'equaltab') {
@@ -997,26 +1127,27 @@
        if (newCon.equalTab && oldtabs && oldtabs[newCon.equalTab]) {
          _btn.syncComponent.push(oldtabs[newCon.equalTab])
        }
      } else if (_btn.popClose === 'maingrid') {
        _btn.popClose = 'mainline'
      }
      uuids[btn.uuid] = _btn.uuid
      if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
      if (_btn.OpenType === 'pop' || (_btn.OpenType === 'funcbutton' && _btn.funcType === 'print' && _btn.execMode === 'pop')) {
        formActions.push({origin: btn.uuid, uuid: _btn.uuid, name: newCon.name, label: btn.label})
      } else if (btn.OpenType === 'popview') {
      } else if (_btn.OpenType === 'popview') {
        if (!popActions) return
        popActions.push({origin: btn.uuid, linkTab: btn.linkTab || '', uuid: _btn.uuid, name: newCon.name, label: btn.label})
      } else if (btn.OpenType === 'tab') {
        if (btn.tabTemplate === 'FormTab' || !btn.linkmenu || btn.linkmenu.length !== 3) {
      } else if (_btn.OpenType === 'tab') {
        if (btn.tabTemplate === 'FormTab') {
          errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持')
          return
        } else if (!btn.linkmenu || btn.linkmenu.length !== 3) {
          errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持')
          return
        }
      }
      uuids[btn.uuid] = true
      if (_btn.tabType === 'CommonTable' || _btn.tabType === 'SubTable') {
        _btn.tabType = 'BaseTable'
@@ -1033,7 +1164,7 @@
        } else if (btn.class.indexOf('border') > -1) {
          _btn.style = {color: color, backgroundColor: '#fff', borderColor: color, marginRight: '15px'}
        } else {
          _btn.style = {color: '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'}
          _btn.style = {color: btn.class === 'gray' ? 'rgba(0, 0, 0, 0.65)' : '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'}
        }
        _card.action.push(_btn)
      }
@@ -1046,21 +1177,27 @@
        marks: [],
        isSub: false,
        uuid: Utils.getuuid(),
        type: 'action',
        type: 'custom',
        Width: 120,
        elements: colbtns,
        style: {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'}
      })
    }
    let sets = ['tableName', 'interType', 'sysInterface', 'innerFunc', 'interface', 'proInterface', 'outerFunc', 'dataresource', ['queryType', 'query'], 'primaryKey', 'order', 'execute', ['laypage', 'true'], ['pageSize', 10], ['onload', 'true']]
    let sets = ['tableName', 'interType', 'sysInterface', 'innerFunc', 'interface', 'proInterface', 'outerFunc', 'dataresource', ['queryType', 'query'], 'primaryKey', 'order', ['laypage', 'true'], ['pageSize', 10], ['onload', 'true']]
    let wraps = ['tableType', ['bordered', 'true'], 'actionfixed', ['size', 'middle'], ['selected', 'false'], ['tableMode', 'compatible'], ['mask', 'show'], ['borderColor', '#e8e8e8'], 'height', 'controlField', 'controlVal']
    _card.scripts = config.setting.scripts || []
    sets.forEach(n => {
      if (n === 'interType' && !['system', 'inner', 'outer'].includes(config.setting.interType)) {
        _card.setting.interType = 'system'
      if (n === 'interType') {
        if (!['system', 'inner', 'outer'].includes(config.setting.interType)) {
          _card.setting.interType = 'system'
        } else if (config.setting.interType === 'inner' && !config.setting.innerFunc) {
          _card.setting.interType = 'system'
        } else {
          _card.setting.interType = config.setting.interType
        }
      } else if (typeof(n) === 'string') {
        _card.setting[n] = config.setting[n] || ''
      } else {
@@ -1075,12 +1212,27 @@
      }
    })
    if (config.setting.doubleClick && uuids[config.setting.doubleClick]) {
      _card.wrap.doubleClick = uuids[config.setting.doubleClick]
    } else {
    _card.wrap.doubleClick = config.setting.doubleClick || ''
    if (_card.wrap.doubleClick && !uuids[_card.wrap.doubleClick]) {
      _card.wrap.doubleClick = ''
    }
    _card.setting.execute = config.setting.default || 'true'
    _card.errors = []
    let columns = _card.columns.map(c => c.field)
    if (_card.setting.interType === 'system' && _card.setting.execute !== 'false' && !_card.setting.dataresource) {
      _card.errors.push({ level: 0, detail: '未设置数据源!'})
    } else if (_card.setting.interType === 'system' && _card.setting.execute === 'false' && _card.scripts.filter(script => script.status !== 'false').length === 0) {
      _card.errors.push({ level: 0, detail: '数据源中无可用脚本!'})
    } else if (!_card.setting.primaryKey) {
      _card.errors.push({ level: 0, detail: '未设置主键!'})
    } else if (!columns.includes(_card.setting.primaryKey)) {
      _card.errors.push({ level: 0, detail: '主键已失效!'})
    } else if (!_card.setting.supModule) {
      _card.errors.push({ level: 0, detail: '未设置上级组件!'})
    }
    return _card
  }