From 407c0f1765c7d085218a91ad8842784977383d05 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 23 十月 2020 00:18:13 +0800
Subject: [PATCH] 2020-10-23

---
 src/menu/modalconfig/index.jsx |  604 ++++++------------------------------------------------
 1 files changed, 66 insertions(+), 538 deletions(-)

diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index 3f5e59e..9998550 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -5,14 +5,13 @@
 import { DndProvider } from 'react-dnd'
 import HTML5Backend from 'react-dnd-html5-backend'
 import moment from 'moment'
-import { Button, Card, Modal, Collapse, notification, Select, List, Icon, Empty, Popover } from 'antd'
+import { Button, Card, Modal, Collapse, notification, Icon, Empty, Popover } from 'antd'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
 import { getModalForm } from '@/templates/zshare/formconfig'
-import { queryTableSql } from '@/utils/option.js'
 
 import ModalForm from '@/templates/zshare/modalform'
 import DragElement from '@/templates/modalconfig/dragelement'
@@ -20,28 +19,19 @@
 import SettingForm from '@/templates/modalconfig/settingform'
 import GroupForm from '@/templates/modalconfig/groupform'
 import EditCard from '@/templates/modalconfig/editcard'
-import MenuForm from '@/templates/modalconfig/menuform'
 import EditComponent from '@/templates/zshare/editcomponent'
-import { BaseConfig, SearchItems } from '@/templates/modalconfig/source'
+import { SearchItems } from '@/templates/modalconfig/source'
 import './index.scss'
 
 const { Panel } = Collapse
-const { Option } = Select
 const { confirm } = Modal
 const CommonDict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
 class ComModalConfig extends Component {
   static propTpyes = {
-    menu: PropTypes.any,
-    editTab: PropTypes.any,
-    editSubTab: PropTypes.any,
-    tabConfig: PropTypes.any,
-    subTabConfig: PropTypes.any,
-    btnTab: PropTypes.any,
-    btnTabConfig: PropTypes.any,
-    editAction: PropTypes.object,
-    subConfig: PropTypes.any,
-    handleView: PropTypes.func
+    btn: PropTypes.object,
+    handleSave: PropTypes.func,
+    handleBack: PropTypes.func
   }
 
   state = {
@@ -49,14 +39,11 @@
     dict: CommonDict,      // 瀛楀吀
     config: null,          // 椤甸潰閰嶇疆锛屽寘鎷ā鏉跨被鍨嬨�佹ā鎬佹璁剧疆銆佹坊鍔犺〃鍚嶃�佽〃鍗曞垪琛�
     visible: false,        // 琛ㄥ崟缂栬緫妯℃�佹锛屾樉绀烘帶鍒�
-    modalType: null,       // 琛ㄥ崟缂栬緫绫诲瀷锛岀紪杈戞垨澶嶅埗
     tableVisible: false,   // 鏁版嵁琛ㄥ瓧娈靛垪琛ㄦā鎬佹锛屾樉绀烘帶鍒�
     tableColumns: [],      // 琛ㄦ牸瀛楁鍚嶅垪琛�
     fields: null,          // 琛ㄥ崟锛屽彲閫夊瓧娈碉紙鍘婚噸鍚庯級
-    modalformlist: null,   // 鍩烘湰淇℃伅琛ㄥ崟瀛楁
     formlist: null,        // 琛ㄥ崟缂栬緫妯℃�佹锛屽彲缂栬緫瀛楁
     card: null,            // 缂栬緫鍏冪礌
-    menuloading: false,    // 鑿滃崟淇濆瓨涓�
     closeloading: false,   // 鑿滃崟淇濆瓨涓�
     settingVisible: false, // 鍏ㄥ眬閰嶇疆妯℃�佹
     closeVisible: false,   // 鍏抽棴妯℃�佹
@@ -72,73 +59,15 @@
 
   /**
    * @description 鏁版嵁棰勫鐞�
-   * 1銆佹寜閽厤缃瓨鍦ㄦ椂浣跨敤鎸夐挳閰嶇疆锛屼笉瀛樺湪鏃朵娇鐢ㄩ粯璁ら厤缃紙绀轰緥锛�
-   * 2銆佹ā鎬佹鏍囬涓嶅瓨鍦ㄦ椂锛屼娇鐢ㄦ寜閽爣棰�
-   * 3銆佽缃凡閫夎〃
-   * 4銆佽缃寜閽熀鏈俊鎭�
    */
   UNSAFE_componentWillMount () {
-    const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props
+    const { btn } = this.props
 
-    let _config = ''
-    let _tab = subTabConfig ? subTabConfig : tabConfig
-
-    let _menu = { // 涓婄骇鑿滃崟鏄笁绾ц彍鍗曟垨鏍囩椤�
-      type: _tab ? _tab.Template : menu.type,
-      tables: _tab ? _tab.tables : menu.LongParam.tables,
-      MenuID: _tab ? _tab.uuid : menu.MenuID,
-      MenuNo: _tab ? _tab.tabNo : menu.MenuNo,
-      MenuName: _tab ? _tab.tabName : menu.MenuName
-    }
-
-    if (subConfig) {
-      _config = subConfig
-    } else {
-      _config = JSON.parse(JSON.stringify(BaseConfig))
-    }
-
-    if (!_config.setting.title) {
-      _config.setting.title = editAction.label
-    }
-
-    // 涓昏彍鍗曞凡鏈夐�夋嫨鐨勮〃鍚嶏紝妯℃�佹娌℃湁琛ㄥ悕鏃讹紝澶嶅埗涓昏彍鍗曡〃鍚�
-    _config.tables = _config.tables.length === 0 ? _menu.tables : _config.tables
-
-    let _source = JSON.parse(JSON.stringify(SearchItems))
-    if (!!this.props.editTab) {
-      _source.push({
-        type: 'form',
-        label: this.state.dict['header.form.linkMain'],
-        subType: 'linkMain',
-        url: ''
-      })
-    }
+    let _config = btn.modal
 
     this.setState({
-      openEdition: editAction.open_edition || '',
-      menu: _menu,
-      source: _source,
       config: _config,
-      selectedTables: _config.tables || [],
-      originConfig: JSON.parse(JSON.stringify(_config)),
-      modalformlist: [
-        {
-          type: 'text',
-          key: 'supMenu',
-          label: this.state.dict['model.super'] + this.state.dict['model.menu'],
-          initVal: _menu.MenuName,
-          required: true,
-          readonly: true
-        },
-        {
-          type: 'text',
-          key: 'btnName',
-          label: '鎸夐挳鍚嶇О',
-          initVal: editAction.label,
-          required: true,
-          readonly: true
-        }
-      ]
+      originConfig: fromJS(_config).toJS()
     })
   }
 
@@ -148,90 +77,7 @@
    * 2銆佹牴鎹凡閫夎〃鍚嶏紝鑾峰彇琛ㄦ牸瀛楁鍒楄〃
    */
   componentDidMount () {
-    let param = {
-      func: 'sPC_Get_SelectedList',
-      LText: queryTableSql,
-      obj_name: 'data',
-      arr_field: 'TbName,Remark'
-    }
-
-    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.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉
-
-    Api.getSystemConfig(param).then(res => {
-      if (res.status) {
-        this.setState({
-          tables: res.data
-        })
-      } else {
-        notification.warning({
-          top: 92,
-          message: res.message,
-          duration: 10
-        })
-      }
-    })
-
-    let deffers = this.state.selectedTables.map(item => {
-      return new Promise(resolve => {
-        Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => {
-          res.TBName = item.TbName
-          resolve(res)
-        })
-      })
-    })
-
-    // 鑾峰彇瀛楁鍚庢暟鎹鐞嗭紝鏍规嵁绫诲瀷鍒嗕负text銆乶umber銆乨atetime銆乨ate
-    Promise.all(deffers).then(response => {
-      let _columns = []
-      response.forEach(res => {
-        if (res.status) {
-          let tabmsg = {
-            tableName: res.TBName,
-            columns: res.FDName.map(item => {
-              let _type = item.FieldType.toLowerCase()
-              let _decimal = 0
-              if (/^nvarchar/.test(_type)) {
-                _type = 'text'
-              } else if (/^int/.test(_type)) {
-                _type = 'number'
-              } else if (/^decimal/.test(_type)) {
-                _decimal = _type.split(',')[1]
-                _decimal = parseInt(_decimal)
-                _type = 'number'
-              } else if (/^datetime/.test(_type)) {
-                _type = 'datetime'
-              } else if (/^date/.test(_type)) {
-                _type = 'date'
-              } else {
-                _type = 'text'
-              }
-  
-              return {
-                field: item.FieldName,
-                label: item.FieldDec,
-                type: _type,
-                decimal: _decimal
-              }
-            })
-          }
-          _columns.push(tabmsg)
-        } else {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 10
-          })
-        }
-      })
-
-      this.setState({
-        tableColumns: _columns
-      })
-    })
+    
   }
 
   /**
@@ -243,28 +89,6 @@
     }
   }
 
-  // 椤甸潰杩斿洖
-  handleViewBack = () => {
-    const {menu, editTab, editSubTab, tabConfig, subTabConfig, btnTab, btnTabConfig} = this.props
-
-    let _view = (subTabConfig && subTabConfig.Template) || (tabConfig && tabConfig.Template) || menu.LongParam.Template
-    
-    let param = {
-      editMenu: menu,
-      editTab: editTab,
-      tabConfig: tabConfig,
-      editSubTab: editSubTab,
-      subTabConfig: subTabConfig,
-      btnTab: btnTab,
-      btnTabConfig: btnTabConfig,
-      editAction: null,
-      subConfig: subTabConfig || tabConfig || null,
-      tabview: _view
-    }
-
-    this.props.handleView(param)
-  }
-
   /**
    * @description 琛ㄥ崟鍙樺寲
    * 1銆佽〃鍗曟嫋鎷芥坊鍔犳椂锛屾鏌ユ槸鍚﹀瓨鍦ㄧず渚嬭〃鍗曪紝濡傚瓨鍦ㄥ垯鍘婚櫎绀轰緥
@@ -272,7 +96,7 @@
    * 3銆佹柊澧炶〃鍗曟椂锛岀洿鎺ユ墦寮�缂栬緫妗�
    */
   handleList = (list, group, elementId, newcard) => {
-    let _config = JSON.parse(JSON.stringify(this.state.config))
+    let _config = fromJS(this.state.config).toJS()
 
     if (!group && !elementId) {
       // 娌℃湁鍒嗙粍鏃讹紙鎷栨嫿娣诲姞锛�
@@ -352,31 +176,9 @@
    * 2銆佷繚瀛樼紪杈戦」-card
    * 3銆佽缃紪杈戝弬鏁伴」-formlist
    */
-  handleForm = (_card, type) => {
-    const {menu, tabConfig, subTabConfig} = this.props
-    let card = JSON.parse(JSON.stringify(_card))
-
-    if (type === 'copy') {
-      card.originUuid = card.uuid
-      card.uuid = Utils.getuuid()
-      card.focus = true
-
-      // 澶嶅埗鍒板壀鍒囨澘
-      let oInput = document.createElement('input')
-      let val = JSON.parse(JSON.stringify(card))
-      val.copyType = 'form'
-      val.uuid = Utils.getuuid()
-
-      delete val.originUuid
-
-      oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val)))
-      document.body.appendChild(oInput)
-      oInput.select()
-      document.execCommand('Copy')
-      oInput.className = 'oInput'
-      oInput.style.display = 'none'
-      document.body.removeChild(oInput)
-    }
+  handleForm = (_card) => {
+    const { componentConfig } = this.props
+    let card = fromJS(_card).toJS()
 
     const { config } = this.state
     let _inputfields = []
@@ -419,40 +221,17 @@
       }
     })
 
-    if (subTabConfig) {
-      subTabConfig.columns.forEach(col => {
-        if (col.field && !uniq.has(col.field)) {
-          uniq.set(col.field, true)
+    componentConfig.columns.forEach(col => {
+      if (col.field && !uniq.has(col.field)) {
+        uniq.set(col.field, true)
 
-          _linkableFields.push({
-            value: col.field,
-            text: col.label + ' (鏄剧ず鍒�)'
-          })
-        }
-      })
-    } else if (tabConfig) {
-      tabConfig.columns.forEach(col => {
-        if (col.field && !uniq.has(col.field)) {
-          uniq.set(col.field, true)
-
-          _linkableFields.push({
-            value: col.field,
-            text: col.label + ' (鏄剧ず鍒�)'
-          })
-        }
-      })
-    } else if (menu.LongParam) {
-      menu.LongParam.columns.forEach(col => {
-        if (col.field && !uniq.has(col.field)) {
-          uniq.set(col.field, true)
-
-          _linkableFields.push({
-            value: col.field,
-            text: col.label + ' (鏄剧ず鍒�)'
-          })
-        }
-      })
-    }
+        _linkableFields.push({
+          value: col.field,
+          text: col.label + ' (鏄剧ず鍒�)'
+        })
+      }
+    })
+    
 
     if (card.linkSubField && card.linkSubField.length > 0) {
       let fields = _inputfields.map(item => item.field)
@@ -472,7 +251,6 @@
 
     this.setState({
       visible: true,
-      modalType: type,
       card: card,
       formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, !!this.props.editTab, roleList)
     })
@@ -485,70 +263,14 @@
    * 3銆侀�氳繃loading鍒锋柊
    */
   handleSubmit = () => {
-    const { card, modalType } = this.state
-
     this.formRef.handleConfirm().then(res => {
-      let _config = JSON.parse(JSON.stringify(this.state.config))
+      let _config = fromJS(this.state.config).toJS()
       let fieldrepet = false // 瀛楁閲嶅
       let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅
 
-      if (modalType === 'copy' && card.originUuid) {
-        if (_config.groups.length > 0) {
-          _config.groups = _config.groups.map(group => {
-            let _index = null
-            group.sublist.forEach((item, index) => {
-              if (item.uuid === card.originUuid) {
-                _index = index
-              }
-
-              if (item.uuid !== res.uuid && item.field === res.field) {
-                fieldrepet = true
-              } else if (item.uuid !== res.uuid && item.label === res.label) {
-                labelrepet = true
-              }
-            })
-
-            if (_index !== null) {
-              group.sublist.splice(_index + 1, 0, res)
-            }
-
-            return group
-          })
-        } else {
-          let _index = null
-          _config.fields.forEach((item, index) => {
-            if (item.uuid === card.originUuid) {
-              _index = index
-            }
-
-            if (item.uuid !== res.uuid && item.field === res.field) {
-              fieldrepet = true
-            } else if (item.uuid !== res.uuid && item.label === res.label) {
-              labelrepet = true
-            }
-          })
-
-          _config.fields.splice(_index + 1, 0, res)
-        }
-      } else {
-        if (_config.groups.length > 0) {
-          _config.groups.forEach(group => {
-            group.sublist = group.sublist.map(item => {
-              if (item.uuid !== res.uuid && item.field === res.field) {
-                fieldrepet = true
-              } else if (item.uuid !== res.uuid && item.label === res.label) {
-                labelrepet = true
-              }
-
-              if (item.uuid === res.uuid) {
-                return res
-              } else {
-                return item
-              }
-            })
-          })
-        } else {
-          _config.fields = _config.fields.map(item => {
+      if (_config.groups.length > 0) {
+        _config.groups.forEach(group => {
+          group.sublist = group.sublist.map(item => {
             if (item.uuid !== res.uuid && item.field === res.field) {
               fieldrepet = true
             } else if (item.uuid !== res.uuid && item.label === res.label) {
@@ -561,7 +283,21 @@
               return item
             }
           })
-        }
+        })
+      } else {
+        _config.fields = _config.fields.map(item => {
+          if (item.uuid !== res.uuid && item.field === res.field) {
+            fieldrepet = true
+          } else if (item.uuid !== res.uuid && item.label === res.label) {
+            labelrepet = true
+          }
+
+          if (item.uuid === res.uuid) {
+            return res
+          } else {
+            return item
+          }
+        })
       }
 
       if (fieldrepet) {
@@ -607,7 +343,6 @@
             this.setState({
               sqlVerifing: false,
               config: _config,
-              modalType: null,
               card: null,
               visible: false
             })
@@ -622,7 +357,6 @@
       } else {
         this.setState({
           config: _config,
-          modalType: null,
           card: null,
           visible: false
         })
@@ -639,7 +373,7 @@
     confirm({
       content: `纭畾鍒犻櫎<<${card.label}>>鍚楋紵`,
       onOk() {
-        let _config = JSON.parse(JSON.stringify(_this.state.config))
+        let _config = fromJS(_this.state.config).toJS()
 
         if (_config.groups.length > 0) {
           _config.groups.forEach(group => {
@@ -658,108 +392,20 @@
   }
 
   submitConfig = () => {
-    const { editAction } = this.props
-    const { config, menu, openEdition } = this.state
+    const { config } = this.state
 
-    if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) {
-      notification.warning({
-        top: 92,
-        message: '璇锋坊鍔犺〃鍗�',
-        duration: 10
-      })
-      return
-    }
-
-    let _LongParam = ''
-    let _config = {...config, tables: this.state.selectedTables}
-
-    try {
-      _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
-    } catch (e) {
-      notification.warning({
-        top: 92,
-        message: '缂栬瘧閿欒',
-        duration: 10
-      })
-      return
-    }
-
-    let param = {
-      func: 'sPC_ButtonParam_AddUpt',
-      ParentID: menu.MenuID,
-      MenuID: editAction.uuid,
-      MenuNo: menu.MenuNo,
-      Template: 'Modal',
-      MenuName: editAction.label,
-      PageParam: JSON.stringify({Template: 'Modal'}),
-      LongParam: _LongParam
-    }
-
-    if (openEdition) {
-      param.open_edition = openEdition
-    }
-
-    if (this.state.closeVisible) {
-      this.setState({
-        closeloading: true
-      })
-    } else {
-      this.setState({
-        menuloading: true
-      })
-    }
-
-    Api.getSystemConfig(param).then(response => {
-      if (response.status) {
-        this.setState({
-          openEdition: response.open_edition || '',
-          menuloading: false,
-          closeloading: false,
-          closeVisible: false,
-          originConfig: _config,
-          config: _config
-        })
-        notification.success({
-          top: 92,
-          message: '淇濆瓨鎴愬姛',
-          duration: 2
-        })
-      } else {
-        this.setState({
-          closeloading: false,
-          menuloading: false
-        })
-        notification.warning({
-          top: 92,
-          message: response.message,
-          duration: 10
-        })
-      }
-    })
+    this.props.handleSave(config)
   }
 
   cancelConfig = () => {
     const { config, originConfig } = this.state
-    let _this = this
 
-    let isOrigin = config.fields.filter(item => item.origin).length > 0
-    if (isOrigin) {
-      confirm({
-        content: '灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�',
-        onOk() {
-          _this.handleViewBack()
-        },
-        onCancel() {}
+    if (!is(fromJS(config), fromJS(originConfig))) {
+      this.setState({
+        closeVisible: true
       })
     } else {
-
-      if (!is(fromJS(config), fromJS(originConfig))) {
-        this.setState({
-          closeVisible: true
-        })
-      } else {
-        this.handleViewBack()
-      }
+      this.props.handleBack()
     }
   }
 
@@ -770,8 +416,10 @@
    * 3銆佹鏌ヨ〃鍗曚腑鐨勫凡閫夊瓧娈碉紝骞舵爣璁板凡閫�
    */
   queryField = () => {
-    const {selectedTables, tableColumns, config} = this.state
-    if (selectedTables.length === 0) {
+    const { menu } = this.props
+    const { config } = this.state
+
+    if (menu.tables.length === 0) {
       notification.warning({
         top: 92,
         message: '璇烽�夋嫨琛ㄥ悕锛�',
@@ -781,7 +429,7 @@
     }
 
     let columns = new Map()
-    tableColumns.forEach(table => {
+    menu.tableFields.forEach(table => {
       table.columns.forEach(column => {
         columns.set(column.field, column)
       })
@@ -823,7 +471,7 @@
       })
     }
 
-    let _config = JSON.parse(JSON.stringify(this.state.config))
+    let _config = fromJS(this.state.config).toJS()
 
     let cards = this.refs.searchcard.state.selectCards
     let columns = new Map()
@@ -865,11 +513,6 @@
           resourceType: '0',
           setAll: 'false',
           options: [],
-          dataSource: '',
-          linkField: '',
-          valueField: '',
-          valueText: '',
-          orderBy: '',
           orderType: 'asc',
           decimal: 0,
           min: '',
@@ -912,11 +555,6 @@
             resourceType: '0',
             setAll: 'false',
             options: [],
-            dataSource: '',
-            linkField: '',
-            valueField: '',
-            valueText: '',
-            orderBy: '',
             orderType: 'asc',
             readonly: 'false',
             required: 'true'
@@ -936,79 +574,6 @@
       top: 92,
       message: '娣诲姞鎴愬姛',
       duration: 2
-    })
-  }
-
-  /**
-   * @description 娣诲姞琛ㄥ悕
-   * 1銆佽幏鍙栬〃淇℃伅
-   * 2銆佹楠屾槸鍚﹀凡缁忔坊鍔狅紝宸叉坊鍔犳椂璺宠繃
-   * 3銆侀�氳繃琛ㄥ悕鑾峰彇瀛楁闆嗭紝骞惰缃暟鎹被鍨�
-   */
-  onTableChange = (value) => {
-    const {tables, selectedTables, tableColumns} = this.state
-
-    let _table = tables.filter(item => item.TbName === value)[0]
-    let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0]
-
-    if (isSelected) return
-
-    this.setState({
-      selectedTables: [...selectedTables, _table]
-    })
-    Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => {
-      if (res.status) {
-        let tabmsg = {
-          tableName: _table.name,
-          columns: res.FDName.map(item => {
-            let _type = item.FieldType.toLowerCase()
-            let _decimal = 0
-            if (/^nvarchar/.test(_type)) {
-              _type = 'text'
-            } else if (/^int/.test(_type)) {
-              _type = 'number'
-            } else if (/^decimal/.test(_type)) {
-              _decimal = _type.split(',')[1]
-              _decimal = parseInt(_decimal)
-              _type = 'number'
-            } else if (/^datetime/.test(_type)) {
-              _type = 'datetime'
-            } else if (/^date/.test(_type)) {
-              _type = 'date'
-            } else {
-              _type = 'text'
-            }
-
-            return {
-              field: item.FieldName,
-              label: item.FieldDec,
-              type: _type,
-              decimal: _decimal
-            }
-          })
-        }
-        this.setState({
-          tableColumns: [...tableColumns, tabmsg]
-        })
-      } else {
-        notification.warning({
-          top: 92,
-          message: res.message,
-          duration: 10
-        })
-      }
-    })
-  }
-
-  /**
-   * @description 鍒犻櫎琛ㄥ悕锛屽垹闄ゅ搴斿瓧娈甸泦
-   */
-  deleteTable = (table) => {
-    const {selectedTables, tableColumns} = this.state
-
-    this.setState({
-      selectedTables: selectedTables.filter(item => item.TbName !== table.TbName),
-      tableColumns: tableColumns.filter(item => item.tableName !== table.TbName)
     })
   }
 
@@ -1061,7 +626,7 @@
     confirm({
       content: `纭畾鍒犻櫎鍒嗙粍<<${group.label}>>鍚楋紵`,
       onOk() {
-        let _config = JSON.parse(JSON.stringify(_this.state.config))
+        let _config = fromJS(_this.state.config).toJS()
         _config.groups = _config.groups.filter(item => !(item.uuid === group.uuid))
         let _length = _config.groups.length
         
@@ -1081,8 +646,8 @@
   }
 
   handleGroupSave = () => {
-    let _group = JSON.parse(JSON.stringify(this.state.curgroup))
-    let config = JSON.parse(JSON.stringify(this.state.config))
+    let _group = fromJS(this.state.curgroup).toJS()
+    let config = fromJS(this.state.config).toJS()
 
     this.groupRef.handleConfirm().then(res => {
       _group = {..._group, ...res.target}
@@ -1169,54 +734,16 @@
   }
 
   render () {
-    const { config, source } = this.state
+    const { config } = this.state
 
     return (
       <div className="modal-form-board">
         <DndProvider backend={HTML5Backend}>
           <div className="tools">
             <Collapse accordion defaultActiveKey="1" bordered={false}>
-              <Panel header={this.state.dict['header.menu.basedata']} key="0" id="modal-basedata">
-                <MenuForm
-                  dict={this.state.dict}
-                  formlist={this.state.modalformlist}
-                />
-                <div className="ant-col ant-form-item-label">
-                  <label title={this.state.dict['header.menu.table.add']}>
-                    {this.state.dict['header.menu.table.add']}
-                  </label>
-                </div>
-                <Select
-                  showSearch
-                  showArrow={false}
-                  className="tables"
-                  style={{ width: '100%' }}
-                  optionFilterProp="children"
-                  value={this.state.dict['header.menu.table.placeholder']}
-                  onChange={this.onTableChange}
-                  getPopupContainer={() => document.getElementById('modal-basedata')}
-                  filterOption={(input, option) => {
-                    return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
-                  }}
-                > 
-                  {this.state.tables.map((table, index) => (
-                    <Option key={index} title={table.TbName} value={table.TbName}>{table.Remark}</Option>
-                  ))}
-                </Select>
-                {this.state.selectedTables.length > 0 && <List
-                  size="small"
-                  bordered
-                  dataSource={this.state.selectedTables}
-                  renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}>
-                    {item.Remark + ' (' + item.TbName + ')'}
-                    <Icon type="close" onClick={() => this.deleteTable(item)}/>
-                    <div className="bottom-mask"></div>
-                  </List.Item>}
-                />}
-              </Panel>
               <Panel header={this.state.dict['header.menu.form']} key="1">
                 <div className="search-element">
-                  {source.map((item, index) => {
+                  {SearchItems.map((item, index) => {
                     return (<SourceElement key={index} content={item}/>)
                   })}
                 </div>
@@ -1229,8 +756,8 @@
             <Card title={this.state.dict['header.menu.form.configurable']} bordered={false} extra={
               <div>
                 <EditComponent dict={this.state.dict} type="form" config={this.state.config} refresh={this.updateConfig}/>
-                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button>
-                <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button>
+                <Button type="primary" onClick={this.submitConfig}>{this.state.dict['model.confirm']}</Button>
+                <Button onClick={this.cancelConfig}>{this.state.dict['model.cancel']}</Button>
               </div>
             } style={{ width: '100%' }}>
               <Icon type="setting" onClick={this.changeSetting} />
@@ -1299,7 +826,7 @@
           </div>
         </DndProvider>
         <Modal
-          title={this.state.modalType !== 'copy' ? this.state.dict['model.edit'] : this.state.dict['header.modal.form.copy']}
+          title={this.state.dict['model.edit']}
           visible={this.state.visible}
           width={700}
           onCancel={this.editModalCancel}
@@ -1359,7 +886,7 @@
           onCancel={() => { this.setState({closeVisible: false}) }}
           footer={[
             <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['model.save']}</Button>,
-            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['model.notsave']}</Button>,
+            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.props.handleBack}>{this.state.dict['model.notsave']}</Button>,
             <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['model.cancel']}</Button>
           ]}
           destroyOnClose
@@ -1390,7 +917,8 @@
 
 const mapStateToProps = (state) => {
   return {
-    sysRoles: state.sysRoles
+    sysRoles: state.sysRoles,
+    menu: state.customMenu
   }
 }
 

--
Gitblit v1.8.0