From d941738da5fae4e27488b09933e76cdce2c50fe9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 13 七月 2023 22:44:25 +0800
Subject: [PATCH] 2023-07-13

---
 src/tabviews/zshare/mutilform/index.jsx            |    1 
 src/views/basedesign/index.jsx                     |   61 +-
 src/templates/treepageconfig/updatetable/index.jsx |   47 +
 src/views/basedesign/updateFormTab/index.jsx       | 1358 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/utils/utils-custom.js                          |    6 
 src/templates/comtableconfig/updatetable/index.jsx |   49 +
 src/menu/pastecontroller/index.jsx                 |    8 
 src/views/basedesign/updateFormTab/index.scss      |   18 
 src/templates/treepageconfig/index.jsx             |    2 
 9 files changed, 1,502 insertions(+), 48 deletions(-)

diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx
index 70094e6..652a0f0 100644
--- a/src/menu/pastecontroller/index.jsx
+++ b/src/menu/pastecontroller/index.jsx
@@ -21,7 +21,7 @@
   resetconfig = (item, appType) => {
     if (item.type === 'tabs') {
       item.uuid = MenuUtils.getuuid()
-      item.setting.name = item.setting.name + MenuUtils.getSignName()
+      item.setting.name = (item.setting.name || '') + MenuUtils.getSignName()
       item.name = item.setting.name
 
       item.subtabs.forEach(tab => {
@@ -38,7 +38,7 @@
       })
     } else if (item.type === 'group') {
       item.uuid = MenuUtils.getuuid()
-      item.setting.name = item.setting.name + MenuUtils.getSignName()
+      item.setting.name = (item.setting.name || '') + MenuUtils.getSignName()
       item.name = item.setting.name
 
       item.components = item.components.map(cell => {
@@ -67,6 +67,10 @@
     }
 
     this.pasteFormRef.handleConfirm().then(res => {
+      if (res.copyType === 'basetable') {
+        res.copyType = 'normaltable'
+        res.subtype = 'normaltable'
+      }
       if (!options.includes(res.copyType)) {
         notification.warning({
           top: 92,
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index ca88ed4..e04d23a 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -89,6 +89,7 @@
         } else {
           supvals.push('')
         }
+        supvals = Array.from(new Set(supvals))
         controlFields[item.supField] = controlFields[item.supField] || []
         controlFields[item.supField].push({field: item.field, values: supvals})
       }
diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx
index df7ef53..eb1cc76 100644
--- a/src/templates/comtableconfig/updatetable/index.jsx
+++ b/src/templates/comtableconfig/updatetable/index.jsx
@@ -110,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(),
@@ -119,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,
@@ -187,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], 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
             })
           }
@@ -790,7 +812,7 @@
       action: [],
       subtype: 'basetable',
       setting: { useMSearch: newCon.useMSearch },
-      wrap: {},
+      wrap: {name: newCon.name},
       style: {},
       headerStyle: {},
       columns: [],
@@ -819,7 +841,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
 
@@ -890,7 +916,7 @@
         if (_colspan.includes(col.field)) {
           _col.Hide = 'true'
         }
-
+        _col.uuid = Utils.getuuid()
         _card.cols.push(_col)
       }
 
@@ -901,14 +927,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'
@@ -928,7 +961,7 @@
           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',
diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx
index d71b891..2847f1f 100644
--- a/src/templates/treepageconfig/index.jsx
+++ b/src/templates/treepageconfig/index.jsx
@@ -73,7 +73,7 @@
     _config.MenuID = menu.MenuID || ''
 
     // 閰嶇疆榛樿鍊硷紝鍏煎
-    _config.Template = 'TreePage'
+    // _config.Template = 'TreePage'
     _config.easyCode = _config.easyCode || ''
     
     if (_config.type === 'user') {
diff --git a/src/templates/treepageconfig/updatetable/index.jsx b/src/templates/treepageconfig/updatetable/index.jsx
index 20a6753..5dc8c61 100644
--- a/src/templates/treepageconfig/updatetable/index.jsx
+++ b/src/templates/treepageconfig/updatetable/index.jsx
@@ -149,7 +149,11 @@
     let _tbs = []
     if (config.tabgroups && config.tabgroups.length > 0) {
       config.tabgroups.forEach((m, i) => {
-        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(),
@@ -179,7 +183,7 @@
               }
             }
 
-            let tab = { uuid: Utils.getuuid(), controlVal: level, label: n.label, icon: n.icon, permission: 'false', components: [
+            let tab = { uuid: Utils.getuuid(), controlVal: level, label: n.label, icon: n.icon, permission: 'true', components: [
               {
                 uuid: Utils.getuuid(),
                 linkTab: n.linkTab,
@@ -247,11 +251,28 @@
           }
         })
 
+        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], 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
             })
           }
@@ -833,7 +854,7 @@
       action: [],
       subtype: 'normaltable',
       setting: { useMSearch: 'false', sync: 'false', onload: 'true' },
-      wrap: {},
+      wrap: {name: newCon.name},
       style: {},
       headerStyle: {},
       columns: [],
@@ -862,7 +883,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
 
@@ -933,7 +958,7 @@
         if (_colspan.includes(col.field)) {
           _col.Hide = 'true'
         }
-
+        _col.uuid = Utils.getuuid()
         _card.cols.push(_col)
       }
 
@@ -944,14 +969,20 @@
           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'
@@ -971,7 +1002,7 @@
           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',
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index be4f888..9f42868 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -702,13 +702,13 @@
     // 閲嶇疆缁勪欢鍚嶇О
     let sign = this.getSignName()
     if (item.plot) { // 鍥捐〃
-      item.plot.name = item.plot.name + sign
+      item.plot.name = (item.plot.name || '') + sign
       item.name = item.plot.name
     } else if (item.wrap) { // 閫氱敤
-      item.wrap.name = item.wrap.name + sign
+      item.wrap.name = (item.wrap.name || '') + sign
       item.name = item.wrap.name
     } else if (item.setting) { // 鍒嗙粍銆佹爣绛鹃〉绛�
-      item.setting.name = item.setting.name + sign
+      item.setting.name = (item.setting.name || '') + sign
       item.name = item.setting.name
     }
 
diff --git a/src/views/basedesign/index.jsx b/src/views/basedesign/index.jsx
index 0adc4d0..5a25185 100644
--- a/src/views/basedesign/index.jsx
+++ b/src/views/basedesign/index.jsx
@@ -16,6 +16,7 @@
 const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig'))
 const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig'))
 const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig'))
+const UpdateFormTab = asyncLoadComponent(() => import('./updateFormTab'))
 
 document.body.className = ''
 sessionStorage.setItem('isEditState', 'true')
@@ -186,49 +187,57 @@
   }
 
   render () {
-    const { loading } = this.state
+    const { loading, editMenu, subConfig, btnTab } = this.state
 
     return (
       <div className="mk-base-design-wrap">
         <ConfigProvider locale={_locale}>
           <Header/>
-          {this.state.tabview === 'TreePage' ?
-            <TreePageConfig
-              menu={this.state.editMenu}
-              reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
-              handleView={this.handleView}
-            /> : null
-          }
           {this.state.tabview === 'CommonTable' ?
             <ComTableConfig
-              menu={this.state.editMenu}
+              menu={editMenu}
               reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
-              handleView={this.handleView}
-            /> : null
-          }
-          {this.state.tabview === 'Modal' ?
-            <ModalConfig
-              menu={this.state.editMenu}
-              editTab={this.state.editTab}
-              tabConfig={this.state.tabConfig}
-              editSubTab={this.state.editSubTab}
-              subTabConfig={this.state.subTabConfig}
-              btnTab={this.state.btnTab}
-              btnTabConfig={this.state.btnTabConfig}
-              editAction={this.state.editAction}
-              subConfig={this.state.subConfig}
               handleView={this.handleView}
             /> : null
           }
           {this.state.tabview === 'SubTable' ?
             <SubTable
-              menu={this.state.editMenu}
+              menu={editMenu}
               editTab={this.state.editTab}
               editSubTab={this.state.editSubTab}
               tabConfig={this.state.tabConfig}
-              btnTab={this.state.btnTab}
+              btnTab={btnTab}
               btnTabConfig={this.state.btnTabConfig}
-              config={this.state.subConfig}
+              config={subConfig}
+              handleView={this.handleView}
+            /> : null
+          }
+          {this.state.tabview === 'Modal' ?
+            <ModalConfig
+              menu={editMenu}
+              editTab={this.state.editTab}
+              tabConfig={this.state.tabConfig}
+              editSubTab={this.state.editSubTab}
+              subTabConfig={this.state.subTabConfig}
+              btnTab={btnTab}
+              btnTabConfig={this.state.btnTabConfig}
+              editAction={this.state.editAction}
+              subConfig={subConfig}
+              handleView={this.handleView}
+            /> : null
+          }
+          {this.state.tabview === 'TreePage' ?
+            <TreePageConfig
+              menu={editMenu}
+              reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
+              handleView={this.handleView}
+            /> : null
+          }
+          {this.state.tabview === 'FormTab' ?
+            <UpdateFormTab
+              menu={editMenu}
+              btnTab={btnTab}
+              config={subConfig}
               handleView={this.handleView}
             /> : null
           }
diff --git a/src/views/basedesign/updateFormTab/index.jsx b/src/views/basedesign/updateFormTab/index.jsx
new file mode 100644
index 0000000..c7ad6d8
--- /dev/null
+++ b/src/views/basedesign/updateFormTab/index.jsx
@@ -0,0 +1,1358 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { is, fromJS } from 'immutable'
+import { Modal, Button, notification } from 'antd'
+import moment from 'moment'
+import md5 from 'md5'
+
+import { colorTransform } from '@/utils/option.js'
+import { getTables } from '@/utils/utils-custom.js'
+import Api from '@/api'
+import Utils from '@/utils/utils.js'
+import './index.scss'
+
+const { confirm } = Modal
+
+class UpdateTable extends Component {
+  static propTpyes = {
+    config: PropTypes.object
+  }
+
+  state = {}
+  delButtons = []
+  baseMsg = {}
+
+  shouldComponentUpdate (nextProps, nextState) {
+    return !is(fromJS(this.state), fromJS(nextState))
+  }
+
+  trigger = () => {
+    const { config, menu, btnTab } = this.props
+    const _this = this
+
+    if (!config || !menu || !menu.LongParam) {
+      notification.warning({
+        top: 92,
+        message: '鏈幏鍙栧埌鑿滃崟閰嶇疆锛�',
+        duration: 5
+      })
+      return
+    }
+
+    let _config = fromJS(config).toJS()
+
+    if (menu.LongParam.setting) {
+      _config.setting.primaryKey = menu.LongParam.setting.primaryKey
+    }
+
+    if (!_config.tabgroups) {
+      _config.tabgroups = [{ uuid: 'tabs', sublist: [] }]
+    } else if (typeof(_config.tabgroups[0]) === 'string') {
+      let _tabgroups = []
+      _config.tabgroups.forEach(groupId => {
+        let _group = {
+          uuid: groupId,
+          sublist: fromJS(_config[groupId]).toJS()
+        }
+
+        delete _config[groupId]
+
+        _tabgroups.push(_group)
+      })
+
+      _config.tabgroups = _tabgroups
+    }
+
+    _config.action = _config.action.map(item => {
+      if (item.intertype === 'inner' && !item.innerFunc) {
+        item.intertype = 'system'
+      }
+      return item
+    })
+
+    _config.btnId = btnTab.uuid
+    _config.btnName = btnTab.label
+    
+    confirm({
+      title: '纭畾鍗囩骇褰撳墠鑿滃崟鍚楋紵',
+      content: '',
+      onOk() {
+        return new Promise(resolve => {
+          _this.execUpdate(resolve, _config)
+        })
+      },
+      onCancel() {}
+    })
+  }
+
+  execUpdate = (_resolve, config) => {
+    const { menu } = this.props
+    
+    this.delButtons = []
+    this.baseMsg = {
+      fstMenuId: config.fstMenuId,
+      parentId: config.ParentId,
+      MenuName: config.MenuName,
+      MenuNo: config.MenuNo,
+    }
+
+    let MenuID = md5(menu.MenuID + config.btnId)
+
+    let _config = {
+      version: 1.0,
+      uuid: MenuID,
+      MenuID: MenuID,
+      fstMenuId: menu.fstMenuId,
+      parentId: menu.ParentId,
+      Template: 'CustomPage',
+      easyCode: '',
+      enabled: false,
+      MenuName: menu.MenuName + '-' + config.btnName,
+      MenuNo: menu.MenuNo + '_' + MenuID.substr(-4),
+      OpenType: 'newtab',
+      tables: config.tables || [],
+      urlFields: [],
+      hidden: 'true',
+      Remark: '',
+      components: [],
+      viewType: 'menu',
+      style: { backgroundColor: '#ffffff', paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px'},
+    }
+
+    let formActions = []
+    let popActions = []
+    let errors = []
+
+    let mainF = {
+      uuid: Utils.getuuid(),
+      type: 'form',
+      format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
+      pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
+      switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
+      width: 24,
+      name: '涓昏〃鍗�',
+      subtype: 'simpleform',
+      setting: { interType: 'system' },
+      wrap: { name: '涓昏〃鍗�', width: 24, datatype: 'static', enable: 'true', closeEnable: 'true' },
+      style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
+      headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
+      columns: [],
+      scripts: [],
+      subcards: []
+    }
+
+    let card = {
+      uuid: Utils.getuuid(),
+      setting: {title: '', align: 'left_right', enable: 'true'},
+      style: {},
+      fields: [],
+      subButton: {label: '纭畾', type: 'submit', reload: 'false', sql: '', Ot: 'notRequired', enable: 'true', style: {backgroundColor: 'rgba(255, 255, 255, 1)', color: 'rgba(24, 144, 255, 1)', paddingLeft: '20px', paddingRight: '20px', paddingTop: '5px', paddingBottom: '5px', borderColor: 'rgba(24, 144, 255, 1)', borderWidth: '1px'}},
+      closeButton: {label: '鍏抽棴', type: 'close', enable: 'true', style: { color: 'rgba(245, 34, 45, 1)', paddingTop: '5px', paddingRight: '20px', marginLeft: '20px', backgroundColor: '#ffffff', borderColor: 'rgba(245, 34, 45, 1)', paddingLeft: '20px', borderWidth: '1px', paddingBottom: '5px'}},
+    }
+
+    let btn = config.action[0]
+
+    card.subButton.intertype = btn.intertype
+    card.subButton.innerFunc = btn.innerFunc || ''
+    card.subButton.execSuccess = btn.execSuccess || 'never'
+    card.subButton.execError = btn.execError || 'never'
+
+    if (btn.intertype === 'outer') {
+      card.subButton.procMode = btn.innerFunc ? 'inner' : 'none'
+      card.subButton.sysInterface = btn.sysInterface || 'false'
+      card.subButton.interface = btn.interface || ''
+      card.subButton.outerFunc = btn.outerFunc || ''
+      card.subButton.callbackFunc = btn.callbackFunc || ''
+      card.subButton.callbackType = btn.callbackFunc ? 'func' : 'none'
+    } else if (btn.intertype === 'system') {
+      card.subButton.sqlType = btn.sqlType || ''
+      card.subButton.sql = btn.sql || ''
+      card.subButton.verify = btn.verify || null
+    }
+
+    if (config.setting.datatype === 'query') {
+      mainF.wrap.datatype = 'dynamic'
+      mainF.setting = {
+        interType: config.setting.interType || 'system',
+        innerFunc: config.setting.innerFunc || '',
+        outerFunc: config.setting.outerFunc || '',
+        interface: config.setting.interface || '',
+        dataresource: config.setting.dataresource || '',
+        sysInterface: config.setting.sysInterface || 'false',
+        order: '',
+        primaryKey: config.setting.primaryKey || 'ID',
+        tableName: menu.LongParam.setting.tableName || '',
+        supModule: ['empty'],
+        sync: 'false',
+        onload: 'true'
+      }
+
+      if (mainF.setting.interType === 'inner' && !mainF.setting.innerFunc) {
+        mainF.setting.interType = 'system'
+      }
+
+      card.subButton.Ot = 'requiredSgl'
+    }
+
+    config.groups.forEach(group => {
+      if (!group.isDefault) {
+        card.fields.push({
+          uuid: Utils.getuuid(),
+          label: group.label,
+          span: 24,
+          type: 'split'
+        })
+      }
+
+      group.sublist.forEach(item => {
+        item.labelwidth = 33.3
+        item.span = 12
+        
+        if (item.type === 'textarea' && config.setting.cols === '2') {
+          item.labelwidth = 16.2
+          item.span = 24
+        }
+
+        card.fields.push(item)
+      })
+    })
+
+    let _ids = []
+
+    card.fields.forEach(item => {
+      if (item.field) {
+        _ids.push(item.field.toLowerCase())
+        if (item.type === 'number') {
+          mainF.columns.push({
+            datatype: `decimal(18,${item.decimal === 0 ? 0 : (item.decimal || 2)})`,
+            field: item.field,
+            decimal: item.decimal || 0,
+            label: item.label,
+            type: 'number',
+            uuid: Utils.getuuid()
+          })
+        } else {
+          mainF.columns.push({
+            datatype: `Nvarchar(${item.fieldlength || 50})`,
+            field: item.field,
+            fieldlength: 50,
+            label: item.label,
+            type: 'text',
+            uuid: Utils.getuuid()
+          })
+        }
+      }
+    })
+
+    mainF.subcards.push(card)
+
+    let oldtabs = {
+      mainTable: mainF.uuid
+    }
+
+    if (mainF.wrap.datatype === 'dynamic') {
+      let primaryKey = mainF.setting.primaryKey.toLowerCase()
+      if (!_ids.includes(primaryKey)) {
+        mainF.columns.push({
+          datatype: `Nvarchar(50)`,
+          field: mainF.setting.primaryKey,
+          fieldlength: 50,
+          label: mainF.setting.primaryKey,
+          type: 'text',
+          uuid: Utils.getuuid()
+        })
+      }
+    } else {
+      oldtabs.mainTable = 'empty'
+    }
+
+    _config.components.push(mainF)
+
+    let _tbs = []
+    if (config.tabgroups && config.tabgroups.length > 0) {
+      config.tabgroups.forEach((m, i) => {
+        if (!m.sublist) return
+
+        m.sublist = m.sublist.filter(c => !!c.linkTab)
+        
+        if (m.sublist.length === 0) return
+
+        let tabs = {
+          uuid: Utils.getuuid(),
+          type: 'tabs',
+          subtype: 'tabs',
+          name: '鏍囩缁�' + (i + 1),
+          width: 24,
+          setting: {name: '鏍囩缁�' + (i + 1), width: 24, position: 'top'},
+          style: {},
+          subtabs: m.sublist.map(n => {
+            let tab = { uuid: Utils.getuuid(), label: n.label, icon: n.icon, permission: 'false', components: [
+              {
+                uuid: Utils.getuuid(),
+                linkTab: n.linkTab,
+                name: n.label,
+                useMSearch: 'false',
+                supModule: n.supMenu || '',
+                equalTab: n.equalTab && n.equalTab.length > 0 ? n.equalTab[0] : ''
+              }
+            ]}
+            this.delButtons.push(n.linkTab)
+            oldtabs[n.uuid] = tab.components[0].uuid
+
+            _tbs.push(tab.components[0])
+
+            return tab
+          })
+        }
+        
+        _config.components.push(tabs)
+      })
+    }
+
+    if (_tbs.length > 0) {
+      let defers = _tbs.map((item, i) => {
+        return new Promise((resolve) => {
+          setTimeout(() => {
+            Api.getSystemConfig({
+              func: 'sPC_Get_LongParam',
+              MenuID: item.linkTab
+            }).then(res => {
+              if (res.status) {
+                let _LongParam = ''
+                if (res.LongParam) {
+                  try {
+                    _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+                  } catch (e) {
+                    console.warn('Parse Failure')
+                    _LongParam = ''
+                  }
+                }
+                if (_LongParam) {
+                  _LongParam.uuid = item.linkTab
+                  resolve(_LongParam)
+                } else {
+                  resolve({uuid: item.linkTab, $empty: true})
+                }
+              } else {
+                notification.warning({
+                  top: 92,
+                  message: res.message,
+                  duration: 5
+                })
+                resolve({uuid: item.linkTab, $empty: true})
+              }
+            })
+          }, i * 50)
+        })
+      })
+      Promise.all(defers).then(res => {
+        let menus = {}
+        res.forEach(item => {
+          if (item && !item.$empty) {
+            menus[item.uuid] = item
+          }
+        })
+
+        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], 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
+            })
+          }
+          return item
+        })
+
+        this.setPopView(_resolve, _config, formActions, popActions, errors)
+      })
+    } else {
+      this.setPopView(_resolve, _config, formActions, popActions, errors)
+    }
+  }
+
+  setPopView = (_resolve, _config, formActions, popActions, errors) => {
+    if (popActions.length > 0) {
+      let defers = popActions.map((item, i) => {
+        return new Promise((resolve) => {
+          setTimeout(() => {
+            Api.getSystemConfig({
+              func: 'sPC_Get_LongParam',
+              MenuID: item.linkTab
+            }).then(res => {
+              if (res.status) {
+                let _LongParam = ''
+                if (res.LongParam) {
+                  try {
+                    _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+                  } catch (e) {
+                    console.warn('Parse Failure')
+                    _LongParam = ''
+                  }
+                }
+  
+                if (_LongParam) {
+                  _LongParam.uuid = item.uuid
+                  resolve(_LongParam)
+                } else {
+                  resolve({uuid: item.uuid, $empty: true})
+                }
+              } else {
+                notification.warning({
+                  top: 92,
+                  message: res.message,
+                  duration: 5
+                })
+                resolve({uuid: item.uuid, $empty: true})
+              }
+            })
+          }, i * 50)
+        })
+      })
+      Promise.all(defers).then(res => {
+        let menus = {}
+        res.forEach(item => {
+          if (item && !item.$empty) {
+            menus[item.uuid] = item
+          }
+        })
+
+        _config.components.forEach(item => {
+          if (item.type === 'tabs') {
+            item.subtabs.forEach(tab => {
+              tab.components[0].action.forEach(btn => {
+                if (btn.OpenType === 'popview') {
+                  if (menus[btn.uuid]) {
+                    let mainTb = {name: '涓昏〃', uuid: Utils.getuuid(), useMSearch: 'false'}
+
+                    btn.config = {
+                      uuid: btn.uuid,
+                      MenuID: btn.uuid,
+                      ParentId: tab.components[0].uuid,
+                      MenuName: btn.label,
+                      tables: _config.tables || [],
+                      Template: 'CustomPage',
+                      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 !== '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'}
+  
+                      btn.config = {
+                        uuid: btn.uuid,
+                        MenuID: btn.uuid,
+                        ParentId: tab.components[0].uuid,
+                        MenuName: btn.label,
+                        tables: _config.tables || [],
+                        Template: 'CustomPage',
+                        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 + '銆嬮厤缃俊鎭涪澶�')
+                    }
+                  }
+                })
+              })
+            })
+          } else if (item.type !== 'form') {
+            item.action.forEach(btn => {
+              if (btn.OpenType === 'popview') {
+                if (menus[btn.uuid]) {
+                  let mainTb = {name: '涓昏〃', uuid: Utils.getuuid(), useMSearch: 'false'}
+
+                  btn.config = {
+                    uuid: btn.uuid,
+                    MenuID: btn.uuid,
+                    ParentId: item.uuid,
+                    MenuName: btn.label,
+                    tables: _config.tables || [],
+                    Template: 'CustomPage',
+                    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 !== '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'}
+  
+                    btn.config = {
+                      uuid: btn.uuid,
+                      MenuID: btn.uuid,
+                      ParentId: item.uuid,
+                      MenuName: btn.label,
+                      tables: _config.tables || [],
+                      Template: 'CustomPage',
+                      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 + '銆嬮厤缃俊鎭涪澶�')
+                  }
+                }
+              })
+            })
+          }
+        })
+
+        this.setPopForm(_resolve, _config, formActions, errors)
+      })
+    } else {
+      this.setPopForm(_resolve, _config, formActions, errors)
+    }
+  }
+
+  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({
+              func: 'sPC_Get_LongParam',
+              MenuID: item.origin
+            }).then(res => {
+              if (res.status) {
+                let _LongParam = ''
+                if (res.LongParam) {
+                  try {
+                    _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+                  } catch (e) {
+                    console.warn('Parse Failure')
+                    _LongParam = ''
+                  }
+                }
+  
+                if (_LongParam) {
+                  _LongParam.uuid = item.uuid
+                  resolve(_LongParam)
+                } else {
+                  resolve({uuid: item.uuid, $empty: true})
+                }
+              } else {
+                notification.warning({
+                  top: 92,
+                  message: res.message,
+                  duration: 5
+                })
+                resolve({uuid: item.uuid, $empty: true})
+              }
+            })
+          }, i * 50)
+        })
+      })
+      Promise.all(defers).then(res => {
+        let menus = {}
+        res.forEach(item => {
+          if (item && !item.$empty) {
+            menus[item.uuid] = item
+          }
+        })
+
+        _config.components.forEach(item => {
+          if (item.type === 'tabs') {
+            item.subtabs.forEach(tab => {
+              tab.components[0].action.forEach(btn => {
+                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')) {
+                  if (menus[btn.uuid]) {
+                    btn.modal = {
+                      setting: menus[btn.uuid].setting,
+                      tables: [],
+                      groups: [],
+                      fields: menus[btn.uuid].fields || []
+                    }
+                  } else {
+                    errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+                  }
+                }
+              })
+              tab.components[0].cols.forEach(col => {
+                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')) {
+                    if (menus[btn.uuid]) {
+                      btn.modal = {
+                        setting: menus[btn.uuid].setting,
+                        tables: [],
+                        groups: [],
+                        fields: menus[btn.uuid].fields || []
+                      }
+                    } else {
+                      errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+                    }
+                  }
+                })
+              })
+            })
+          } else if (item.type !== 'form') {
+            item.action.forEach(btn => {
+              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')) {
+                if (menus[btn.uuid]) {
+                  btn.modal = {
+                    setting: menus[btn.uuid].setting,
+                    tables: [],
+                    groups: [],
+                    fields: menus[btn.uuid].fields || []
+                  }
+                } else {
+                  errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+                }
+              }
+            })
+
+            item.cols.forEach(col => {
+              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')) {
+                  if (menus[btn.uuid]) {
+                    btn.modal = {
+                      setting: menus[btn.uuid].setting,
+                      tables: [],
+                      groups: [],
+                      fields: menus[btn.uuid].fields || []
+                    }
+                  } else {
+                    errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+                  }
+                }
+              })
+            })
+          }
+        })
+
+        this.saveConfig(_resolve, _config, errors)
+      })
+    } else {
+      this.saveConfig(_resolve, _config, errors)
+    }
+  }
+
+  setTbForm = (item, menus, errors, name) => {
+    item.action.forEach(btn => {
+      if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
+        if (menus[btn.uuid]) {
+          btn.modal = {
+            setting: menus[btn.uuid].setting,
+            tables: [],
+            groups: [],
+            fields: menus[btn.uuid].fields || []
+          }
+        } else {
+          errors.push(name + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+        }
+      }
+    })
+    item.cols.forEach(col => {
+      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 = {
+              setting: menus[btn.uuid].setting,
+              tables: [],
+              groups: [],
+              fields: menus[btn.uuid].fields || []
+            }
+          } else {
+            errors.push(name + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�')
+          }
+        }
+      })
+    })
+  }
+
+  saveConfig = (_resolve, _config, errors) => {
+    let err = errors.join('锛�')
+
+    if (err) {
+      notification.warning({
+        top: 92,
+        message: err,
+        duration: 5
+      })
+    }
+
+    this.saveNewMenu(_resolve, _config)
+  }
+
+  saveNewMenu = (_resolve, _config) => {
+    _config.components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          tab.components[0].action.forEach(btn => {
+            if (btn.OpenType === 'popview' && btn.config) {
+              btn.config.$tables = getTables(btn.config.components[0])
+            }
+          })
+          tab.components[0].cols.forEach(col => {
+            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])
+              }
+            })
+          })
+
+          tab.components[0].$tables = getTables(tab.components[0])
+        })
+      } else {
+        item.$tables = getTables(item)
+      }
+    })
+
+    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 => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          if (tab.components[0].$tables) {
+            tbs.push(...tab.components[0].$tables)
+          }
+
+          this.checkBtns(tab.components[0])
+        })
+      } else {
+        if (item.$tables) {
+          tbs.push(...item.$tables)
+        }
+      }
+    })
+
+    let arr = []
+    tbs = tbs.filter(tb => {
+      let _tb = tb.toLowerCase()
+
+      if (arr.includes(_tb)) return false
+      arr.push(_tb)
+
+      return true
+    })
+    tbs.sort()
+    if (tbs.length && sessionStorage.getItem('mk_tb_names')) {
+      let names = sessionStorage.getItem('mk_tb_names')
+      tbs = tbs.filter(tb => names.indexOf(',' + tb.toLowerCase() + ',') > -1)
+    }
+    tbs = tbs.map(tb => `'${tb}'`).join(';')
+
+    let key = md5(config.uuid + tbs.toLowerCase())
+
+    let urlparam = {
+      FstId: config.fstMenuId,
+      ParentId: config.parentId,
+      MenuID: config.uuid,
+      MenuName: config.MenuName,
+      MenuNo: config.MenuNo,
+      EasyCode: config.easyCode,
+      type: 'admin',
+      OpenType: config.OpenType,
+      PageParam: {Template: 'CustomPage', OpenType: 'newtab', hidden: config.hidden},
+      MenuType: 'custom'
+    }
+    let url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
+    config.tbkey = key
+
+    let param = {
+      func: 'sPC_TrdMenu_AddUpt',
+      FstID: config.fstMenuId || '',
+      SndID: config.parentId,
+      ParentID: config.parentId,
+      MenuID: config.uuid,
+      MenuNo: config.MenuNo || '',
+      EasyCode: config.easyCode || '',
+      Template: 'CustomPage',
+      MenuName: config.MenuName || '',
+      PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType, hidden: config.hidden}),
+      open_edition: '',
+      debug_md5: key,
+      debug_url: url,
+      debug_list: window.btoa(tbs),
+      LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
+    }
+
+    param.LText = Utils.formatOptions(param.LText)
+    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+    Api.getSystemConfig(param).then(res => {
+      _resolve()
+      if (res.status) {
+        // if (this.delButtons.length > 0) {
+        //   Api.getSystemConfig({
+        //     func: 'sPC_MainMenu_Del',
+        //     up_type: 'Y',
+        //     MenuID: this.delButtons.join(',')
+        //   })
+        // }
+
+        delete urlparam.type
+
+        let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
+
+        window.open(window.location.href.split('#')[0] + `#/menudesign/${_param}`)
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      }
+    })
+  }
+
+  getTable = (config, newCon, errors, formActions, popActions, oldtabs) => { 
+    let _card = {
+      uuid: newCon.uuid,
+      type: 'table',
+      name: newCon.name,
+      format: 'array',
+      pageable: true,
+      switchable: true,
+      search: [],
+      action: [],
+      subtype: 'normaltable',
+      setting: { useMSearch: 'false', sync: 'false', onload: 'true' },
+      wrap: {name: newCon.name},
+      style: {},
+      headerStyle: {},
+      columns: [],
+      cols: [],
+      scripts: []
+    }
+
+    if (!config) {
+      errors.push(newCon.name + '閰嶇疆淇℃伅涓㈠け')
+      return _card
+    }
+
+    if (oldtabs && newCon.supModule && oldtabs[newCon.supModule]) {
+      _card.setting.supModule = [oldtabs[newCon.supModule]]
+    } else {
+      _card.setting.supModule = ['empty']
+    }
+
+    _card.search = config.search.map(item => {
+      item.uuid = Utils.getuuid()
+      return item
+    })
+
+    let _cols = {}
+    let _colspan = []
+    let lineMarks = []
+    config.columns.forEach(col => {
+      if (col.type === 'colspan') {
+        if (col.subfield) {
+          _colspan.push(...col.subfield.split(', '))
+        } else if (col.sublist && col.sublist.length > 0) {
+          _colspan.push(...col.sublist)
+        }
+      }
+      if (!col.field) return
+
+      let _col = fromJS(col).toJS()
+
+      if (_col.marks) {
+        _col.marks = []
+        col.marks.forEach(m => {
+          if (m.signType === 'card') return
+
+          let field = []
+          field.push(m.field)
+          field.push(m.contrastType)
+
+          if (m.contrastField) {
+            field.push(m.contrastField)
+          }
+          let color = '#1890ff'
+          if (m.color && m.color[1]) {
+            color = colorTransform[m.color[1]]
+          }
+          let signType = ['font']
+          if (m.signType === 'background') {
+            signType = ['background']
+          } else if (m.signType === 'icon') {
+            if (m.position === 'back') {
+              signType = ['iconback']
+            } else {
+              signType = ['iconfront']
+            }
+            signType.push(m.iconType)
+            signType.push(m.icon)
+          }
+
+          if (m.signType === 'line') {
+            lineMarks.push({
+              $index: lineMarks.length + 1,
+              uuid: Utils.getuuid(),
+              field: field,
+              color: color,
+              contrastValue: m.contrastValue || '',
+              match: m.match,
+              signType: ['background']
+            })
+          } else {
+            _col.marks.push({
+              $index: _col.marks.length + 1,
+              uuid: Utils.getuuid(),
+              field: field,
+              color: color,
+              contrastValue: m.contrastValue || '',
+              match: m.match,
+              signType: signType
+            })
+          }
+        })
+      }
+
+      _cols[col.field] = _col
+    })
+
+    config.columns.forEach(col => {
+      if (col.type === 'index') {
+        col.uuid = Utils.getuuid()
+        _card.cols.push(fromJS(col).toJS())
+      } else if (col.field && _cols[col.field]) {
+        let _col = fromJS(_cols[col.field]).toJS()
+
+        if (_colspan.includes(col.field)) {
+          _col.Hide = 'true'
+        }
+
+        _col.uuid = Utils.getuuid()
+
+        _card.cols.push(_col)
+      }
+
+      if (col.type === 'colspan') {
+        let ucol = {
+          Align: col.Align,
+          Hide: col.Hide,
+          label: col.label,
+          marks: [],
+          isSub: false,
+          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 = []
+
+          _subs.forEach(sub => {
+            if (_cols[sub]) {
+              let _col = fromJS(_cols[sub]).toJS()
+              _col.Hide = 'false'
+              _col.isSub = true
+              _col.uuid = Utils.getuuid()
+
+              ucol.subcols.push(_col)
+            }
+          })
+
+          if (ucol.subcols.length > 0) {
+            _card.cols.push(ucol)
+          }
+        } else {
+          ucol.Width = 120
+          ucol.type = 'custom'
+          ucol.elements = []
+          ucol.style = {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'}
+
+          _subs.forEach(sub => {
+            if (_cols[sub]) {
+              let _col = {
+                copyable: 'false',
+                datatype: 'dynamic',
+                eleType: _cols[sub].type !== 'number' ? 'text' : 'number',
+                field: sub,
+                height: '',
+                innerHeight: 'auto',
+                marks: _cols[sub].marks || null,
+                noValue: 'show',
+                prefix: _cols[sub].prefix || '',
+                postfix: _cols[sub].postfix || '',
+                style: {},
+                width: 24,
+                uuid: Utils.getuuid()
+              }
+
+              ucol.elements.push(_col)
+            }
+          })
+
+          if (ucol.elements.length > 0) {
+            _card.cols.push(ucol)
+          }
+        }
+      }
+    })
+
+    _card.lineMarks = lineMarks
+    _card.columns = []
+    _card.absFields = []
+    _card.cols.forEach(col => {
+      if (!col.field) return
+      if (['text', 'picture', 'video', 'textarea'].includes(col.type)) {
+        _card.columns.push({
+          datatype: `Nvarchar(${col.fieldlength || 50})`,
+          field: col.field,
+          fieldlength: col.fieldlength || 50,
+          label: col.label,
+          type: 'text',
+          uuid: Utils.getuuid()
+        })
+      } else if (col.type === 'link') {
+        _card.columns.push({
+          datatype: `Nvarchar(${col.fieldlength || 50})`,
+          field: col.field,
+          fieldlength: col.fieldlength || 50,
+          label: col.label,
+          type: 'text',
+          uuid: Utils.getuuid()
+        })
+        if (col.nameField) {
+          _card.columns.push({
+            datatype: `Nvarchar(${col.fieldlength || 50})`,
+            field: col.nameField,
+            fieldlength: col.fieldlength || 50,
+            label: col.label + '(鍚嶇О)',
+            type: 'text',
+            uuid: Utils.getuuid() + 'name'
+          })
+        }
+      } else if (col.type === 'number') {
+        _card.columns.push({
+          datatype: `Decimal(18,${col.decimal || 0})`,
+          field: col.field,
+          decimal: col.decimal || 0,
+          label: col.label,
+          type: 'number',
+          uuid: Utils.getuuid()
+        })
+
+        if (col.format === 'abs') {
+          _card.absFields.push(col.field)
+        }
+      }
+    })
+
+    if (_card.absFields.length) {
+      _card.absFields = Array.from(new Set(_card.absFields))
+    } else {
+      _card.absFields = null
+    }
+
+    let colbtns = []
+    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()
+
+      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)
+
+      _btn.show = 'button'
+
+      if (_btn.execSuccess === 'equaltab') {
+        _btn.execSuccess = 'grid'
+        _btn.syncComponent = []
+
+        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') {
+        _btn.popClose = 'grid'
+        _btn.syncComponent = []
+
+        if (newCon.equalTab && oldtabs && oldtabs[newCon.equalTab]) {
+          _btn.syncComponent.push(oldtabs[newCon.equalTab])
+        }
+      } else if (_btn.popClose === 'maingrid') {
+        _btn.popClose = 'mainline'
+      }
+
+      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') {
+        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') {
+          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'
+      }
+
+      if (btn.position === 'grid') {
+        _btn.eleType = 'button'
+        _btn.width = 24
+        _btn.style = {color: color, backgroundColor: 'transparent', borderColor: 'transparent'}
+        colbtns.push(_btn)
+      } else {
+        if (btn.class === 'default') {
+          _btn.style = {color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#fff', borderColor: '#d9d9d9', marginRight: '15px'}
+        } else if (btn.class.indexOf('border') > -1) {
+          _btn.style = {color: color, backgroundColor: '#fff', borderColor: color, marginRight: '15px'}
+        } else {
+          _btn.style = {color: btn.class === 'gray' ? 'rgba(0, 0, 0, 0.65)' : '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'}
+        }
+        _card.action.push(_btn)
+      }
+    })
+
+    if (colbtns.length > 0) {
+      _card.cols.push({
+        Align: 'left',
+        label: '鎿嶄綔',
+        marks: [],
+        isSub: false,
+        uuid: Utils.getuuid(),
+        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', ['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') {
+        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 {
+        _card.setting[n[0]] = config.setting[n[0]] || n[1]
+      }
+    })
+    wraps.forEach(w => {
+      if (typeof(w) === 'string') {
+        _card.wrap[w] = config.setting[w] || ''
+      } else {
+        _card.wrap[w[0]] = config.setting[w[0]] || w[1]
+      }
+    })
+
+    _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
+  }
+
+  handleViewBack = () => {
+    const { menu } = this.props
+
+    let param = {
+      editMenu: menu,
+      editTab: null,
+      tabConfig: null,
+      editSubTab: null,
+      subTabConfig: null,
+      btnTab: null,
+      btnTabConfig: null,
+      editAction: null,
+      subConfig: null,
+      tabview: menu.LongParam.Template
+    }
+
+    this.props.handleView(param)
+  }
+ 
+  render() {
+    return (
+      <div className="formtab-update">
+        <div className="tip">琛ㄥ崟鏍囩椤典笉鍦ㄦ敮鎸佹煡鐪嬪強缂栬緫锛岃鐐瑰嚮鍗囩骇鎸夐挳鍒涘缓鏂拌彍鍗曘�傛敞锛氬垱寤烘垚鍔熷悗璇峰湪鍘熻彍鍗曚腑淇敼鍏宠仈鎸夐挳缁戝畾鏂拌彍鍗曘��</div>
+        <div className="buttons">
+          <Button className="mk-border-purple" onClick={this.trigger}>鍗囩骇</Button>
+          <Button onClick={this.handleViewBack}>杩斿洖</Button>
+        </div>
+      </div>
+    )
+  }
+}
+
+export default UpdateTable
\ No newline at end of file
diff --git a/src/views/basedesign/updateFormTab/index.scss b/src/views/basedesign/updateFormTab/index.scss
new file mode 100644
index 0000000..af33966
--- /dev/null
+++ b/src/views/basedesign/updateFormTab/index.scss
@@ -0,0 +1,18 @@
+.formtab-update {
+  position: absolute;
+  top: 40%;
+  left: 50%;
+  transform: translate(-50%, 0px);
+
+  .tip {
+    width: 400px;
+    line-height: 25px;
+    margin-bottom: 20px;
+  }
+  .buttons {
+    text-align: center;
+    .mk-border-purple {
+      margin-right: 15px;
+    }
+  }
+}
\ No newline at end of file

--
Gitblit v1.8.0