From 29c5821ce140e89a8b35e53f41672dd86da56982 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 18 二月 2020 18:43:38 +0800
Subject: [PATCH] 2020-02-18

---
 src/templates/comtableconfig/index.jsx |  132 +++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 56 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index ae94117..b5fbadb 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -25,6 +25,7 @@
 import EditCard from '@/templates/tableshare/editcard'
 import VerifyCard from '@/templates/tableshare/verifycard'
 import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin'
+import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout'
 import MenuForm from '@/templates/tableshare/menuform'
 import TabDragElement from '@/templates/tableshare/tabdragelement'
 import SourceElement from '@/templates/tableshare/dragelement/source'
@@ -386,43 +387,40 @@
   handleTab = (card) => {
     const { config } = this.state
 
-    let index = 0 // 绛涢�変笅涓�缁�
+    let menus = [{value: 'mainTable', text: '涓昏〃'}]
+    let equalTabs = []
+    let supMenu = card.supMenu || ''
+    let equalTab = card.equalTab || []
+    let isuptab = true
+    let equalTabIds = []
+
     config.tabgroups.forEach((groupId, i) => {
       if (groupId === card.groupId) {
-        index = i
+        isuptab = false
+        config[card.groupId].forEach(tab => { // 鍙叧鑱旂殑鍚岀骇鏍囩
+          if (tab.uuid === card.uuid) return
+
+          equalTabIds.push(tab.uuid)
+          equalTabs.push(tab)
+        })
+      } else if (isuptab) {
+        config[groupId].forEach(tab => {
+          menus.push({
+            value: tab.uuid,
+            text: tab.label
+          })
+        })
       }
     })
 
-    let menus = []
-    let subtabs = card.subtabs || []
-    let nextTabId = config.tabgroups[index + 1]
-
-    if (nextTabId) {
-      let _tabMap = new Map()
-      let _usedTabMap = new Map()
-
-      config[nextTabId].forEach(tab => {        // 涓嬬骇鎵�鏈夌殑鏍囩
-        menus.push(tab)
-        _tabMap.set(tab.uuid, true)
-      })
-
-      config[card.groupId].forEach(tab => {     // 鍚岀骇鏍囩宸查�夌殑涓嬬骇鏍囩
-        if (tab.uuid === card.uuid) return
-
-        tab.subtabs.forEach(subtab => {
-          _usedTabMap.set(subtab, true)
-        })
-      })
-
-      config.setting.subtabs.forEach(subtab => { // 涓昏〃宸查�夌殑涓嬬骇鏍囩
-        _usedTabMap.set(subtab, true)
-      })
-
-      subtabs = subtabs.filter(tabId => _tabMap.has(tabId) && !_usedTabMap.has(tabId))
-      menus = menus.filter(tab => !_usedTabMap.has(tab.uuid))
-    } else {
-      subtabs = []
+    if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) {
+      supMenu = ''
     }
+
+    if (equalTab.length > 0) {
+      equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId))
+    }
+
 
     this.setState({
       modaltype: 'tabs',
@@ -478,12 +476,20 @@
           }]
         },
         {
-          type: 'mutilselect',
-          key: 'subtabs',
-          label: this.state.dict['header.form.subTab'],
-          initVal: subtabs,
+          type: 'select',
+          key: 'supMenu',
+          label: this.state.dict['header.form.supTab'],
+          initVal: supMenu,
           required: false,
           options: menus
+        },
+        {
+          type: 'mutilselect',
+          key: 'equalTab',
+          label: this.state.dict['header.form.equalTab'],
+          initVal: equalTab,
+          required: false,
+          options: equalTabs
         }
       ]
     })
@@ -792,6 +798,14 @@
             })
             resolve(false)
           }
+        } else if (btn.OpenType === 'excelOut') {
+          let _param = {
+            innerFunc: btn.innerFunc
+          }
+
+          newLText = Utils.formatOptions(Utils.getTableFunc(_param, menu, config ))
+          DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc))
+          resolve(true)
         } else {
           let _param = {
             funcName: btn.innerFunc,
@@ -1301,10 +1315,27 @@
     const { card } = this.state
     let config = JSON.parse(JSON.stringify(this.state.config))
     
-    if (card.OpenType !== 'excelIn') {
+    if (card.OpenType === 'excelIn') {
+      this.verifyRef.handleConfirm().then(res => {
+        
+        config.action = config.action.map(item => {
+          if (item.uuid === card.uuid) {
+            item.verify = res
+          }
+    
+          return item
+        })
+    
+        this.setState({
+          profileVisible: false,
+          config: config,
+          card: '',
+        })
+      })
+    } else {
       let _verify = this.verifyRef.state.verify
 
-      if (_verify.default === 'false' && _verify.scripts.length === 0) {
+      if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) {
         notification.warning({
           top: 92,
           message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒',
@@ -1325,23 +1356,6 @@
         profileVisible: false,
         config: config,
         card: '',
-      })
-    } else if (card.OpenType === 'excelIn') {
-      this.verifyRef.handleConfirm().then(res => {
-        
-        config.action = config.action.map(item => {
-          if (item.uuid === card.uuid) {
-            item.verify = res
-          }
-    
-          return item
-        })
-    
-        this.setState({
-          profileVisible: false,
-          config: config,
-          card: '',
-        })
       })
     }
   }
@@ -2662,7 +2676,7 @@
           onCancel={() => { this.setState({ profileVisible: false }) }}
           destroyOnClose
         >
-          {this.state.card && this.state.card.OpenType !== 'excelIn' ?
+          {this.state.card && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ?
             <VerifyCard
               card={this.state.card}
               dict={this.state.dict}
@@ -2672,6 +2686,13 @@
           }
           {this.state.card && this.state.card.OpenType === 'excelIn' ?
             <VerifyCardExcelIn
+              card={this.state.card}
+              dict={this.state.dict}
+              wrappedComponentRef={(inst) => this.verifyRef = inst}
+            /> : null
+          }
+          {this.state.card && this.state.card.OpenType === 'excelOut' ?
+            <VerifyCardExcelOut
               card={this.state.card}
               dict={this.state.dict}
               wrappedComponentRef={(inst) => this.verifyRef = inst}
@@ -2699,7 +2720,6 @@
           <SettingForm
             dict={this.state.dict}
             menu={this.props.menu}
-            config={this.state.config}
             data={this.state.config.setting}
             columns={this.state.config.columns}
             usefulFields={this.props.permFuncField}

--
Gitblit v1.8.0