From 84e806945ef8982508a79e0b62a7bcb0881b108c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 30 十二月 2019 10:09:26 +0800
Subject: [PATCH] 2019-12-30

---
 src/templates/comtableconfig/settingform/index.jsx |   68 +++++++++++++++++++++++++++-------
 1 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx
index 8833c31..5da31f1 100644
--- a/src/templates/comtableconfig/settingform/index.jsx
+++ b/src/templates/comtableconfig/settingform/index.jsx
@@ -10,13 +10,43 @@
     dict: PropTypes.object, // 瀛楀吀椤�
     menu: PropTypes.object,
     data: PropTypes.object,
+    config: PropTypes.object,
     columns: PropTypes.array,
     usefulFields: PropTypes.array
   }
 
   state = {
     interType: this.props.data.interType || 'inner',
-    columns: this.props.columns.filter(item => item.field && item.type !== 'colspan')
+    columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'),
+    currentTabs: null,
+    selectTabs: []
+  }
+
+  UNSAFE_componentWillMount() {
+    const { config, data } = this.props
+    let _tabs = []
+    let _select = []
+    let _tabMap = new Map()
+
+    config.tabgroups.forEach(groupname => {
+      config[groupname].forEach(tab => {
+        if (tab.origin) return
+
+        _tabs.push(tab)
+        _tabMap.set(tab.uuid, true)
+      })
+    })
+
+    data.subtabs && data.subtabs.forEach(tabId => {
+      if (_tabMap.has(tabId)) {
+        _select.push(tabId)
+      }
+    })
+
+    this.setState({
+      currentTabs: _tabs,
+      selectTabs: _select
+    })
   }
 
   handleConfirm = () => {
@@ -52,7 +82,7 @@
   render() {
     const { data, dict, menu, usefulFields } = this.props
     const { getFieldDecorator } = this.props.form
-    const { interType, columns } = this.state
+    const { interType, columns, selectTabs } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -229,18 +259,6 @@
             </Form.Item>
           </Col>
           <Col span={12}>
-            <Form.Item label="鏍囩">
-              {getFieldDecorator('tabshow', {
-                initialValue: data.tabshow || 'horizontal'
-              })(
-                <Select>
-                  <Select.Option value="horizontal">妯悜鏄剧ず</Select.Option>
-                  <Select.Option value="vertical">绾靛悜鏄剧ず</Select.Option>
-                </Select>
-              )}
-            </Form.Item>
-          </Col>
-          <Col span={12}>
             <Form.Item label="鍒濆鍖�">
               {getFieldDecorator('onload', {
                 initialValue: data.onload || 'true'
@@ -252,6 +270,28 @@
               )}
             </Form.Item>
           </Col>
+          <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="涓昏〃鍙�夊彇鍏宠仈鏍囩锛屾爣绛惧叧鑱斿悗锛屼富琛ㄦ暟鎹垏鎹㈡椂锛屼笅绾ф爣绛句細璺熼殢涓昏〃涓婚敭鍊煎彉鍖栥��">
+                <Icon type="question-circle" />
+                {'涓嬬骇鏍囩'}
+              </Tooltip>
+            }>
+              {getFieldDecorator('subtabs', {
+                initialValue: selectTabs
+              })(
+                <Select
+                  mode="multiple"
+                  style={{ width: '100%' }}
+                  placeholder="Please select"
+                >
+                  {this.state.currentTabs.map((option, index) =>
+                    <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option>
+                  )}
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
         </Row>
       </Form>
     )

--
Gitblit v1.8.0