From 2a347c8d91d6962f4302f0553c55a3b9f743baa5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 九月 2020 21:15:58 +0800
Subject: [PATCH] 2020-09-09

---
 src/templates/sharecomponent/treesettingcomponent/index.jsx |   92 ++++------------------------------------------
 1 files changed, 8 insertions(+), 84 deletions(-)

diff --git a/src/templates/sharecomponent/treesettingcomponent/index.jsx b/src/templates/sharecomponent/treesettingcomponent/index.jsx
index d1d4f11..70a2779 100644
--- a/src/templates/sharecomponent/treesettingcomponent/index.jsx
+++ b/src/templates/sharecomponent/treesettingcomponent/index.jsx
@@ -1,17 +1,10 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { fromJS } from 'immutable'
-import { Icon, Modal, Button, notification } from 'antd'
+import { Icon, Modal } from 'antd'
 
-import Utils from '@/utils/utils.js'
-import DevUtils from '@/utils/devutils.js'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
-import { getTreeSettingForm } from '@/templates/zshare/formconfig'
-
 import SettingForm from './settingform'
-import CreateFunc from '@/templates/zshare/createfunc'
-import CreateInterface from '@/templates/zshare/createinterface'
 
 import './index.scss'
 
@@ -26,7 +19,6 @@
   state = {
     dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     menu: null,          // 鑿滃崟淇℃伅
-    formlist: null,      // 琛ㄥ崟淇℃伅
     visible: false,      // 妯℃�佹鎺у埗
     loading: false       // 璁剧疆淇℃伅楠岃瘉淇濆瓨涓�
   }
@@ -35,16 +27,12 @@
    * @description 鍏ㄥ眬璁剧疆瑙﹀彂
    */
   changeSetting = () => {
-    const { MenuID, config, permFuncField } = this.props
+    const { MenuID, config } = this.props
     let menu = {MenuID: MenuID, MenuName: config.MenuName, MenuNo: config.MenuNo}
-
-    let _config = fromJS(config).toJS()
 
     this.setState({
       visible: true,
-      formlist: getTreeSettingForm(config.setting, permFuncField, MenuID),
-      menu: menu,
-      config: _config
+      menu: menu
     })
   }
 
@@ -63,72 +51,11 @@
         loading: false
       })
 
-      delete res.customScript // 娓呴櫎鏁寸悊鍚庣殑鑷畾涔夎剼鏈�
-
       this.props.updatesetting({...config, setting: res})
     }, () => {
       this.setState({
         loading: false
       })
-    })
-  }
-
-  /**
-   * @description 鍒涘缓琛ㄦ牸瀛樺偍杩囩▼
-   */
-  tableCreatFunc = () => {
-    const { config } = this.props
-    const { menu } = this.state
-
-    this.settingRef.handleConfirm().then(setting => {
-
-      if (!(setting.interType === 'inner') || !setting.innerFunc) {
-        notification.warning({
-          top: 92,
-          message: '鎺ュ彛绫诲瀷涓�-鍐呴儴锛屼笖瀛樺湪鍐呴儴鍑芥暟鏃讹紝鎵嶅彲浠ュ垱寤哄瓨鍌ㄨ繃绋嬶紒',
-          duration: 5
-        })
-        return
-      }
-
-      let _config = {...config, setting: setting}
-      let newLText = Utils.formatOptions(DevUtils.getTableFunc(setting, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql
-      let DelText = Utils.formatOptions(DevUtils.dropfunc(setting.innerFunc))          // 鍒犻櫎瀛樺偍杩囩▼sql
-
-      this.refs.funcCreatComponent.exec(setting.innerFunc, newLText, DelText).then(result => {
-        if (result === 'success') {
-          this.props.updatesetting(_config)
-        }
-      })
-    })
-  }
-
-  /**
-   * @description 鍒涘缓琛ㄦ牸鎺ュ彛锛堣鍑猴級
-   */
-  tableCreatInterface = () => {
-    const { config } = this.props
-    const { menu } = this.state
-
-    this.settingRef.handleConfirm().then(setting => {
-      if (setting.interType !== 'inner' || setting.innerFunc) {
-        notification.warning({
-          top: 92,
-          message: '鎺ュ彛绫诲瀷涓�-鍐呴儴锛屼笖涓嶅瓨鍦ㄥ唴閮ㄥ嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�',
-          duration: 5
-        })
-        return
-      }
-
-      let _config = {...config, setting: setting}
-      let _menu = {
-        type: 'main',
-        MenuID: menu.MenuID,
-        menuName: menu.MenuName,
-        menuNo: menu.MenuNo
-      }
-
-      this.refs.tableCreatInterface.triggerOutInterface(_menu, _config)
     })
   }
 
@@ -142,7 +69,8 @@
   }
 
   render() {
-    const { dict, visible, config } = this.state
+    const { config } = this.props
+    const { dict, visible, loading } = this.state
 
     return (
       <div className="model-tree-menu-setting">
@@ -155,12 +83,8 @@
           width={900}
           maskClosable={false}
           onCancel={() => { this.setState({ visible: false })}}
-          footer={[
-            <CreateInterface key="interface" dict={dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>,
-            <CreateFunc key="create" dict={dict} ref="funcCreatComponent" trigger={this.tableCreatFunc}/>,
-            <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['model.cancel']}</Button>,
-            <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button>
-          ]}
+          confirmLoading={loading}
+          onOk={this.settingSave}
           destroyOnClose
         >
           <SettingForm
@@ -168,7 +92,7 @@
             config={config}
             menu={this.state.menu}
             inputSubmit={this.settingSave}
-            formlist={this.state.formlist}
+            permFuncField={this.props.permFuncField}
             wrappedComponentRef={(inst) => this.settingRef = inst}
           />
         </Modal>

--
Gitblit v1.8.0