From 6b680ace26dc95031a1b7a3e33f8785c112f787d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 20 四月 2020 18:32:01 +0800
Subject: [PATCH] 2020-04-20

---
 src/templates/comtableconfig/index.jsx |  172 +++++++++------------------------------------------------
 1 files changed, 27 insertions(+), 145 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index aa5d11e..ac8f3cc 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -20,7 +20,6 @@
 import TabForm from '@/templates/zshare/tabform'
 import SearchForm from '@/templates/zshare/searchform'
 import ColumnForm from '@/templates/zshare/columnform'
-import PasteForm from '@/templates/zshare/pasteform'
 import DragElement from '@/templates/zshare/dragelement'
 import ColspanForm from '@/templates/zshare/colspanform'
 import GridBtnForm from '@/templates/zshare/gridbtnform'
@@ -31,7 +30,7 @@
 import VerifyCardPrint from '@/templates/zshare/verifycardprint'
 import MenuForm from '@/templates/zshare/menuform'
 import TabDragElement from '@/templates/zshare/tabdragelement'
-import TransferForm from '@/components/transferform'
+import EditComponent from '@/templates/zshare/editcomponent'
 import SourceElement from '@/templates/zshare/dragelement/source'
 import CreateFunc from '@/templates/zshare/createfunc'
 import CreateInterface from '@/templates/zshare/createinterface'
@@ -77,8 +76,6 @@
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
     profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
     optionLibs: null,        // 鑷畾涔変笅鎷夐�夐」搴�
-    thawBtnVisible: false,   // 瑙e喕鎸夐挳寮圭獥
-    thawbtnlist: null,       // 瑙e喕鎸夐挳鍒楄〃
     thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
     activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
     sqlVerifing: false       // sql楠岃瘉
@@ -675,6 +672,21 @@
           tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁',
           initVal: card.foreignKey || '',
           required: false
+        },
+        {
+          type: 'radio',
+          key: 'searchPass',
+          label: '涓昏〃鎼滅储',
+          initVal: card.searchPass || 'false',
+          tooltip: '浣跨敤涓昏〃鎼滅储鏉′欢鏃讹紝涓昏〃鐨勬悳绱㈡潯浠朵細浼犲叆瀛愯〃涓��',
+          required: false,
+          options: [{
+            value: 'true',
+            text: '浣跨敤'
+          }, {
+            value: 'false',
+            text: '涓嶄娇鐢�'
+          }]
         }
       ]
     })
@@ -2762,86 +2774,6 @@
     })
   }
 
-  /**
-   * @description 瑙e喕鎸夐挳
-   */
-  handleThaw = () => {
-    const { menu } = this.props
-
-    this.setState({
-      thawBtnVisible: true
-    })
-
-    Api.getSystemConfig({
-      func: 'sPC_Get_FrozenMenu',
-      ParentID: menu.MenuID,
-      TYPE: 40
-    }).then(res => {
-      if (res.status) {
-        let _list = []
-
-        res.data.forEach(menu => {
-          let _conf = ''
-
-          if (menu.ParentParam) {
-            try {
-              _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam)))
-            } catch (e) {
-              console.warn('Parse Failure')
-              _conf = ''
-            }
-          }
-
-          if (_conf) {
-            _list.push({
-              key: menu.MenuID,
-              title: menu.MenuName,
-              btnParam: _conf
-            })
-          }
-        })
-
-        this.setState({
-          thawbtnlist: _list
-        })
-      } else {
-        notification.warning({
-          top: 92,
-          message: res.message,
-          duration: 5
-        })
-      }
-    })
-  }
-
-  /**
-   * @description 瑙e喕鎸夐挳鎻愪氦
-   */
-  thawBtnSubmit = () => {
-    const { thawButtons, config, thawbtnlist } = this.state
-    // 涓夌骇鑿滃崟瑙i櫎鍐荤粨
-    if (this.refs.trawmenu.state.targetKeys.length === 0) {
-      notification.warning({
-        top: 92,
-        message: this.state.dict['form.required.select'] + this.state.dict['header.form.thawbutton'],
-        duration: 5
-      })
-    } else {
-
-      thawbtnlist.forEach(item => {
-        if (this.refs.trawmenu.state.targetKeys.includes(item.key)) {
-          config.action.push(item.btnParam)
-        }
-      })
-
-      this.setState({
-        thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys],
-        config: config,
-        thawBtnVisible: false
-      })
-    }
-  }
-
   handleGroup = (index, type) => {
     let config = JSON.parse(JSON.stringify(this.state.config))
     
@@ -2897,38 +2829,21 @@
     this.props.handleView()
   }
 
-  pasteSubmit = () => {
-    const { config } = this.state
-
-    this.pasteFormRef.handleConfirm().then(res => {
+  updateConfig = (res) => {
+    if (res.type === 'thaw') {
+      this.setState({
+        thawButtons: res.thawButtons,
+        config: res.config
+      })
+    } else if (res.type === 'paste') {
       if (res.copyType === 'action') {
-        this.setState({
-          modaltype: ''
-        }, () => {
-          this.handleAction(res, 'copy')
-        })
+        this.handleAction(res.content, 'copy')
       } else if (res.copyType === 'columns') {
-        if (config.columns && config.columns.length > 0) {
-          notification.warning({
-            top: 92,
-            message: '鏄剧ず鍒楀凡瀛樺湪锛�',
-            duration: 5
-          })
-          return
-        }
-        
         this.setState({
-          modaltype: '',
-          config: {...config, columns: res.columns}
-        })
-      } else {
-        notification.warning({
-          top: 92,
-          message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�',
-          duration: 5
+          config: res.config
         })
       }
-    })
+    }
   }
 
   render () {
@@ -3026,9 +2941,6 @@
                       {this.state.dict['header.menu.action.configurable']}
                     </p> : null
                   }
-                  <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}>
-                    <Icon type="unlock" />
-                  </div>
                 </div>
                 {configAction.map((item, index) => {
                   return (
@@ -3090,6 +3002,7 @@
               </div>
             } bordered={false} extra={
               <div>
+                <EditComponent dict={this.state.dict} type="maintable" config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/>
                 <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
                 <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button>
                 <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>
@@ -3114,9 +3027,6 @@
                 <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�">
                   <Icon type="question-circle" />
                 </Tooltip>
-                <div className="copybutton" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({modaltype: 'paste'})}}>
-                  <Icon type="snippets" />
-                </div>
                 <DragElement
                   type="action"
                   list={config.action}
@@ -3410,34 +3320,6 @@
           destroyOnClose
         >
           {this.state.dict['header.menu.config.placeholder']}
-        </Modal>
-        {/* 瑙e喕鎸夐挳妯℃�佹 */}
-        <Modal
-          title={this.state.dict['header.form.thawbutton']}
-          okText={this.state.dict['header.confirm']}
-          cancelText={this.state.dict['header.cancel']}
-          visible={this.state.thawBtnVisible}
-          onOk={this.thawBtnSubmit}
-          onCancel={() => {this.setState({thawBtnVisible: false, thawbtnlist: null})}}
-          destroyOnClose
-        >
-          {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />}
-          {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>}
-        </Modal>
-        {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */}
-        <Modal
-          title={this.state.dict['header.form.paste']}
-          visible={modaltype === 'paste'}
-          width={600}
-          maskClosable={false}
-          onOk={this.pasteSubmit}
-          onCancel={() => {this.setState({modaltype: ''})}}
-          destroyOnClose
-        >
-          <PasteForm
-            dict={this.state.dict}
-            wrappedComponentRef={(inst) => this.pasteFormRef = inst}
-          />
         </Modal>
         {this.state.loading && <Spin size="large" />}
       </div>

--
Gitblit v1.8.0