From 46f59e30133c25f1f01074b1c92445f9e85b8c98 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2019 15:58:37 +0800
Subject: [PATCH] 2019-12-31

---
 src/templates/tableshare/columnform/index.jsx         |   17 ++
 src/tabviews/subtabtable/index.scss                   |   10 -
 src/templates/comtableconfig/index.jsx                |  123 ++++++++++++--
 src/tabviews/tableshare/actionList/index.jsx          |    7 
 src/templates/modalconfig/modalform/index.jsx         |   14 +
 src/templates/modalconfig/index.jsx                   |   10 +
 src/templates/tableshare/dragelement/card.jsx         |   19 +
 src/templates/comtableconfig/tabdragelement/index.jsx |   12 
 src/templates/modalconfig/dragelement/index.jsx       |    3 
 src/templates/tableshare/searchform/index.jsx         |   60 +++++-
 src/locales/zh-CN/comtable.js                         |    1 
 src/tabviews/commontable/index.jsx                    |    2 
 src/locales/en-US/comtable.js                         |    1 
 src/utils/utils.js                                    |   46 ++---
 src/templates/subtableconfig/actionform/index.jsx     |   13 +
 src/templates/comtableconfig/actionform/index.jsx     |   13 +
 src/assets/css/action.scss                            |   13 +
 src/templates/tableshare/dragelement/index.jsx        |   27 ++-
 src/templates/subtableconfig/index.jsx                |   47 +++++
 src/templates/subtableconfig/index.scss               |    3 
 src/templates/tableshare/colspanform/index.jsx        |   13 +
 src/templates/comtableconfig/index.scss               |    8 +
 src/tabviews/tableshare/actionList/index.scss         |    5 
 src/templates/tableshare/searchform/index.scss        |    5 
 src/utils/option.js                                   |    6 
 25 files changed, 371 insertions(+), 107 deletions(-)

diff --git a/src/assets/css/action.scss b/src/assets/css/action.scss
index 0409073..51ae314 100644
--- a/src/assets/css/action.scss
+++ b/src/assets/css/action.scss
@@ -106,6 +106,19 @@
     background-color: #fff;
     border-color: #c49f47;
   }
+  
+  // 姗欒壊
+  .mk-orange, .mk-orange:hover, .mk-orange:active, .mk-orange:focus {
+    color: #fff;
+    background-color: orange;
+    border-color: orange;
+  }
+
+  .mk-border-orange, .mk-border-orange:hover, .mk-border-orange:active, .mk-border-orange:focus {
+    color: orange;
+    background-color: #fff;
+    border-color: orange;
+  }
 
   // 鐏拌壊
   .mk-gray, .mk-gray:hover, .mk-gray:active, .mk-gray:focus {
diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js
index 1b29f8e..a714d92 100644
--- a/src/locales/en-US/comtable.js
+++ b/src/locales/en-US/comtable.js
@@ -87,6 +87,7 @@
   'header.form.number': '鏁板瓧',
   'header.form.colspan': '鍚堝苟鍒�',
   'header.form.select': 'Select',
+  'header.form.multiselect': '澶氶��',
   'header.form.link': '鍏宠仈鑿滃崟',
   'header.form.dateday': 'Date(Day)',
   'header.form.datetime': 'Date(Second)',
diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js
index 6aa7ff6..7038bd6 100644
--- a/src/locales/zh-CN/comtable.js
+++ b/src/locales/zh-CN/comtable.js
@@ -87,6 +87,7 @@
   'header.form.number': '鏁板瓧',
   'header.form.colspan': '鍚堝苟鍒�',
   'header.form.select': '閫夋嫨',
+  'header.form.multiselect': '澶氶��',
   'header.form.link': '鍏宠仈鑿滃崟',
   'header.form.dateday': '鏃ユ湡锛堝ぉ锛�',
   'header.form.datetime': '鏃ユ湡锛堢锛�',
diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index e1ae84a..4c6607a 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -370,7 +370,7 @@
 
     let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows`
     let DateCount = `select count(1) as total from ${_dataresource} ${_search}`
-
+    console.log(LText)
     param.LText = Utils.formatOptions(LText)
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
     param.secretkey = Utils.encrypt(param.LText, param.timestamp)
diff --git a/src/tabviews/subtabtable/index.scss b/src/tabviews/subtabtable/index.scss
index 9175d5d..ed702d6 100644
--- a/src/tabviews/subtabtable/index.scss
+++ b/src/tabviews/subtabtable/index.scss
@@ -7,16 +7,6 @@
   }
   > .button-list {
     padding: 10px 0px 5px;
-    button {
-      margin-right: 15px;
-      margin-bottom: 10px;
-    }
-    .ant-spin {
-      position: fixed;
-      z-index: 1010;
-      left: 50vw;
-      top: calc(50vh - 70px);
-    }
   }
   .box404 {
     padding-top: 30px;
diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx
index 44e0356..83124f9 100644
--- a/src/tabviews/tableshare/actionList/index.jsx
+++ b/src/tabviews/tableshare/actionList/index.jsx
@@ -117,6 +117,9 @@
     }
   }
 
+  /**
+   * @description 鎸夐挳鎻愪氦鎵ц
+   */
   execSubmit = (btn, data, _resolve, formdata) => {
     const { setting } = this.props
     if (btn.intertype === 'inner') {
@@ -828,7 +831,7 @@
     if (this.props.setting.actionfixed && this.props.type === 'main') { // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮�
       return (
         <Affix offsetTop={48}>
-          <div className="button-list" id={this.props.MenuID + 'mainaction'}>
+          <div className="button-list toolbar-button" id={this.props.MenuID + 'mainaction'}>
             {this.props.actions.map((item, index) => {
               if (loadingUuid === item.uuid) {
                 return (
@@ -858,7 +861,7 @@
       )
     } else {
       return (
-        <div className="button-list">
+        <div className="button-list toolbar-button">
           {this.props.actions.map((item, index) => {
             if (loadingUuid === item.uuid) {
               return (
diff --git a/src/tabviews/tableshare/actionList/index.scss b/src/tabviews/tableshare/actionList/index.scss
index d95e1df..1d576f0 100644
--- a/src/tabviews/tableshare/actionList/index.scss
+++ b/src/tabviews/tableshare/actionList/index.scss
@@ -1,14 +1,15 @@
-.commontable .button-list {
+.button-list.toolbar-button {
   padding: 10px 20px 5px;
   background: #ffffff;
   button {
+    min-width: 65px;
     margin-right: 15px;
     margin-bottom: 10px;
   }
   .ant-spin {
     position: fixed;
     z-index: 1010;
-    left: 50vw;
+    left: calc(50vw - 22px);
     top: calc(50vh - 70px);
   }
 }
diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx
index 48dc10b..95dc5ea 100644
--- a/src/templates/comtableconfig/actionform/index.jsx
+++ b/src/templates/comtableconfig/actionform/index.jsx
@@ -159,6 +159,19 @@
     })
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   // 鎵撳紑鏂瑰紡鎴栨樉绀轰綅缃彉鍖�
   openTypeChange = (key, value) => {
     if (key === 'OpenType') {
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index bfe8078..cde6d93 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -108,13 +108,13 @@
       })
     }
 
-    // _config.tabs = _config.tabs || []
-    // _config.tabgroups = _config.tabgroups || ['tabs']
-    // _config.setting.subtabs = _config.setting.subtabs || []
+    _config.tabs = _config.tabs || []
+    _config.tabgroups = _config.tabgroups || ['tabs']
+    _config.setting.subtabs = _config.setting.subtabs || []
 
     this.setState({
-      originActions: _oriActions,
       config: _config,
+      originActions: _oriActions,
       originMenu: JSON.parse(JSON.stringify(menu)),
       selectedTables: _config.tables || [],
       menuformlist: [
@@ -358,7 +358,16 @@
           key: 'field',
           label: this.state.dict['header.form.field'],
           initVal: card.field,
+          tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥',
+          tooltipClass: 'middle',
           required: true,
+          rules: [{
+            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig,
+            message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+          }, {
+            max: 50,
+            message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒'
+          }],
           readonly: false
         },
         {
@@ -373,6 +382,9 @@
           }, {
             value: 'select',
             text: this.state.dict['header.form.select']
+          }, {
+            value: 'multiselect',
+            text: this.state.dict['header.form.multiselect']
           }, {
             value: 'link',
             text: this.state.dict['header.form.link']
@@ -832,6 +844,13 @@
             label: this.state.dict['header.form.field'],
             initVal: card.field,
             required: true,
+            rules: [{
+              pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
+              message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+            }, {
+              max: 50,
+              message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒'
+            }],
             readonly: false
           },
           {
@@ -1159,9 +1178,15 @@
 
         if (res.type === 'search') {
           if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
-            let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource
+            let _datasource = res.values.dataSource
+
+            if (/\s/.test(_datasource)) {
+              _datasource = '(' + _datasource + ') tb'
+            }
+
+            let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource
             if (res.values.type === 'link') {
-              sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource
+              sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource
             }
             if (res.values.orderBy) {
               sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType
@@ -1823,13 +1848,24 @@
       cancelText: this.state.dict['header.cancel'],
       onOk() {
         let _config = JSON.parse(JSON.stringify(_this.state.config))
-        _config[element.type] = _config[element.type].filter(item => {
-          if (item.uuid === element.card.uuid) {
-            return false
-          } else {
-            return true
-          }
-        })
+
+        if (element.type === 'tabs') {
+          _config[element.card.groupId] = _config[element.card.groupId].filter(item => {
+            if (item.uuid === element.card.uuid) {
+              return false
+            } else {
+              return true
+            }
+          })
+        } else {
+          _config[element.type] = _config[element.type].filter(item => {
+            if (item.uuid === element.card.uuid) {
+              return false
+            } else {
+              return true
+            }
+          })
+        }
 
         let refreshtype = element.type + 'loading'
 
@@ -1849,6 +1885,10 @@
       },
       onCancel() {}
     })
+  }
+
+  profileAction = (element) => {
+    console.log(element)
   }
 
   changeTemplate = () => {
@@ -1882,6 +1922,17 @@
       let _LongParam = ''
       let _config = {...config, tables: this.state.selectedTables}
       let _pageParam = {...menu.PageParam, OpenType: res.opentype}
+
+      // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
+      if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) {
+        _config.enabled = false
+      } else if (_config.tabgroups.length > 1) {
+        _config.tabgroups.forEach(group => {
+          if (_config[group].length === 0) {
+            _config.enabled = false
+          }
+        })
+      }
 
       // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
       delete _config.type
@@ -2617,12 +2668,35 @@
     }
   }
 
-  onEnabledChange = () => {
+  onEnabledChange = (val, e) => {
     const { config } = this.state
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    let tabinvalid = true
+    if (config.tabgroups.length > 1) {
+      config.tabgroups.forEach(group => {
+        if (config[group].length === 0) {
+          tabinvalid = false
+        }
+      })
+    }
+
+    if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) {
+      notification.warning({
+        top: 92,
+        message: '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�',
+        duration: 10
+      })
+    } else if (!tabinvalid) {
+      notification.warning({
+        top: 92,
+        message: '鑿滃崟鏍囩椤佃缃敊璇紙澶氳鏍囩鍐咃紝琛屾爣绛句笉鍙负绌猴級锛屼笉鍙惎鐢紒',
+        duration: 10
+      })
+    } else {
+      this.setState({
+        config: {...config, enabled: !config.enabled}
+      })
+    }
   }
 
   onColumnNameChange = () => {
@@ -2690,6 +2764,11 @@
     const configAction = this.state.config.action.filter(_action =>
       !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab')
     )
+
+    let configTabs = []
+    this.state.config.tabgroups.forEach(group => {
+      configTabs.push(...this.state.config[group])
+    })
 
     return (
       <div className="common-table-board">
@@ -2773,7 +2852,7 @@
                       <Button
                         icon={item.icon}
                         style={{marginBottom: '10px'}}
-                        className={'mk-btn mk-' + item.class}
+                        className={'config-button mk-btn mk-' + item.class}
                         onClick={() => this.setSubConfig(item, 'button')}
                       >{item.label}</Button>
                     </div>
@@ -2796,7 +2875,7 @@
                     return (<SourceElement key={index} content={item}/>)
                   })}
                 </div>
-                {this.state.config.tabs.length > 0 ?
+                {configTabs.length > 0 ?
                   <p className="config-btn-title">
                     <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫爣绛鹃厤缃俊鎭��">
                       <Icon type="question-circle" />
@@ -2804,10 +2883,11 @@
                     {this.state.dict['header.menu.tab.configurable']}
                   </p> : null
                 }
-                {this.state.config.tabs.map((item, index) => {
+                {configTabs.map((item, index) => {
                   return (
                     <div key={index}>
                       <Button
+                        className="config-button"
                         icon={item.icon}
                         style={{marginBottom: '10px'}}
                         onClick={() => this.setSubConfig(item, 'tab')}
@@ -2821,7 +2901,7 @@
           <div className="setting">
             <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
               <div>
-                <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} />
+                <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>
                 <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
@@ -2855,6 +2935,7 @@
                     handleMenu={this.handleAction}
                     copyElement={(val) => this.handleAction(val, 'copy')}
                     deleteMenu={this.deleteElement}
+                    profileMenu={this.profileAction}
                     placeholder={this.state.dict['header.form.action.placeholder']}
                   /> : null
                 }
diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss
index 3cd5e5a..d1e5eea 100644
--- a/src/templates/comtableconfig/index.scss
+++ b/src/templates/comtableconfig/index.scss
@@ -96,6 +96,9 @@
       color: #c49f47;
       margin-right: 3px;
     }
+    .config-button {
+      min-width: 65px;
+    }
   }
   .tools:hover {
     overflow-y: auto;
@@ -269,8 +272,13 @@
             left: 20px;
             color: #26C281;
           }
+          .edit.profile {
+            left: 60px;
+            color: purple;
+          }
           button {
             cursor: move;
+            min-width: 65px;
             .anticon-table {
               font-size: 10px;
               position: absolute;
diff --git a/src/templates/comtableconfig/tabdragelement/index.jsx b/src/templates/comtableconfig/tabdragelement/index.jsx
index e81ad5e..7db819c 100644
--- a/src/templates/comtableconfig/tabdragelement/index.jsx
+++ b/src/templates/comtableconfig/tabdragelement/index.jsx
@@ -62,12 +62,12 @@
 
       const { index: overIndex } = findCard(`${targetId}`)
       let targetIndex = overIndex
-      if (!target) {
-        targetIndex++
-      }
-      if (targetIndex < 0) {
-        targetIndex = 0
-      }
+      // if (!target) {
+      targetIndex++
+      // }
+      // if (targetIndex < 0) {
+      //   targetIndex = 0
+      // }
 
       const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
       setCards(_cards)
diff --git a/src/templates/modalconfig/dragelement/index.jsx b/src/templates/modalconfig/dragelement/index.jsx
index c4f68e7..1879fed 100644
--- a/src/templates/modalconfig/dragelement/index.jsx
+++ b/src/templates/modalconfig/dragelement/index.jsx
@@ -77,7 +77,8 @@
       newcard.orderBy = ''
       newcard.orderType = 'asc'
       newcard.readonly = 'false'
-      newcard.required = 'false'
+      newcard.required = 'true'
+      newcard.focus = true
 
       let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
       if (target) {
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 8bf9967..732e7f8 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -506,9 +506,15 @@
       let _config = JSON.parse(JSON.stringify(this.state.config))
 
       if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
-        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + res.dataSource
+        let _datasource = res.dataSource
+
+        if (/\s/.test(_datasource)) {
+          _datasource = '(' + _datasource + ') tb'
+        }
+
+        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + _datasource
         if (res.type === 'link') {
-          sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + res.dataSource
+          sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + _datasource
         }
         if (res.orderBy) {
           sql = sql + ' order by ' + res.orderBy + ' ' + res.orderType
diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/modalconfig/modalform/index.jsx
index 5ce3d76..5a76b5f 100644
--- a/src/templates/modalconfig/modalform/index.jsx
+++ b/src/templates/modalconfig/modalform/index.jsx
@@ -56,6 +56,19 @@
     })
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   openTypeChange = (key, value) => {
     if (key === 'type') {
       let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required']
@@ -133,6 +146,7 @@
   getFields() {
     const { getFieldDecorator } = this.props.form
     const fields = []
+
     this.state.formlist.forEach((item, index) => {
       if (item.hidden) return
 
diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx
index 0b431b9..9252299 100644
--- a/src/templates/subtableconfig/actionform/index.jsx
+++ b/src/templates/subtableconfig/actionform/index.jsx
@@ -139,6 +139,19 @@
     })
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   // 鎵撳紑鏂瑰紡鎴栨樉绀轰綅缃彉鍖�
   openTypeChange = (key, value) => {
     if (key === 'OpenType') {
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index 0804431..325f49a 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -313,7 +313,16 @@
           key: 'field',
           label: this.state.dict['header.form.field'],
           initVal: card.field,
+          tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥',
+          tooltipClass: 'middle',
           required: true,
+          rules: [{
+            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig,
+            message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+          }, {
+            max: 50,
+            message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒'
+          }],
           readonly: false
         },
         {
@@ -328,6 +337,9 @@
           }, {
             value: 'select',
             text: this.state.dict['header.form.select']
+          }, {
+            value: 'multiselect',
+            text: this.state.dict['header.form.multiselect']
           }, {
             value: 'link',
             text: this.state.dict['header.form.link']
@@ -760,6 +772,13 @@
             label: this.state.dict['header.form.field'],
             initVal: card.field,
             required: true,
+            rules: [{
+              pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
+              message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+            }, {
+              max: 50,
+              message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒'
+            }],
             readonly: false
           },
           {
@@ -977,9 +996,15 @@
 
         if (res.type === 'search') {
           if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
-            let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource
+            let _datasource = res.values.dataSource
+
+            if (/\s/.test(_datasource)) {
+              _datasource = '(' + _datasource + ') tb'
+            }
+
+            let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource
             if (res.values.type === 'link') {
-              sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource
+              sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource
             }
             if (res.values.orderBy) {
               sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType
@@ -2334,9 +2359,17 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) {
+      notification.warning({
+        top: 92,
+        message: '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�',
+        duration: 10
+      })
+    } else {
+      this.setState({
+        config: {...config, enabled: !config.enabled}
+      })
+    }
   }
 
   onColumnNameChange = () => {
@@ -2439,7 +2472,7 @@
                       <Button
                         icon={item.icon}
                         style={{marginBottom: '10px'}}
-                        className={'mk-btn mk-' + item.class}
+                        className={'config-button mk-btn mk-' + item.class}
                         onClick={() => this.setSubConfig(item)}
                       >{item.label}</Button>
                     </div>
@@ -2460,7 +2493,7 @@
           <div className="setting">
             <Card title={'鏍囩锛堝瓙琛級椤甸潰閰嶇疆'} bordered={false} extra={
               <div>
-                <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} />
+                <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>
                 <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
diff --git a/src/templates/subtableconfig/index.scss b/src/templates/subtableconfig/index.scss
index b2ebdfc..44f7e97 100644
--- a/src/templates/subtableconfig/index.scss
+++ b/src/templates/subtableconfig/index.scss
@@ -96,6 +96,9 @@
       color: #c49f47;
       margin-right: 3px;
     }
+    .config-button {
+      min-width: 65px;
+    }
   }
   .tools:hover {
     overflow-y: auto;
diff --git a/src/templates/tableshare/colspanform/index.jsx b/src/templates/tableshare/colspanform/index.jsx
index 912030a..eb54b51 100644
--- a/src/templates/tableshare/colspanform/index.jsx
+++ b/src/templates/tableshare/colspanform/index.jsx
@@ -15,6 +15,19 @@
 
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   handleConfirm = () => {
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
diff --git a/src/templates/tableshare/columnform/index.jsx b/src/templates/tableshare/columnform/index.jsx
index 26afaa1..849731b 100644
--- a/src/templates/tableshare/columnform/index.jsx
+++ b/src/templates/tableshare/columnform/index.jsx
@@ -39,6 +39,19 @@
     })
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   typeChange = (key, value) => {
     if (key === 'type') {
       let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width']
@@ -83,6 +96,7 @@
       if (item.hidden) return
 
       if (item.type === 'text') { // 鏂囨湰鎼滅储
+        let rules = item.rules || []
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
@@ -97,7 +111,8 @@
                   {
                     required: !!item.required,
                     message: this.props.dict['form.required.input'] + item.label + '!'
-                  }
+                  },
+                  ...rules
                 ]
               })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)}
             </Form.Item>
diff --git a/src/templates/tableshare/dragelement/card.jsx b/src/templates/tableshare/dragelement/card.jsx
index 00bdafe..b329c20 100644
--- a/src/templates/tableshare/dragelement/card.jsx
+++ b/src/templates/tableshare/dragelement/card.jsx
@@ -7,7 +7,7 @@
 
 const { MonthPicker, WeekPicker, RangePicker } = DatePicker
 
-const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop, showfield }) => {
+const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => {
   const originalIndex = findCard(id).index
   const [{ isDragging }, drag] = useDrag({
     item: { type: ItemTypes[type], id, originalIndex },
@@ -44,10 +44,14 @@
   const copy = () => {
     copyCard(id)
   }
+  
+  const profile = () => {
+    profileCard(id)
+  }
 
   let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊
 
-  if (type === 'search' && card.type === 'select') {
+  if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) {
     if (card.initval) {
       let _option = card.options.filter(option => option.Value === card.initval)[0]
       if (_option) {
@@ -82,7 +86,7 @@
               {card.type === 'text' ?
                 <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> : null
               }
-              {(card.type === 'select' || card.type === 'link') ?
+              {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ?
                 <Select defaultValue={_defaultValue}></Select> : null
               }
               {card.type === 'date' ?
@@ -134,9 +138,12 @@
           </span> : null
         }
       </div>
-      <Icon className="edit" type="edit" onClick={edit} />
-      <Icon className="edit close" type="close" onClick={del} />
-      {type === 'action' ? <Icon className="edit copy" type="copy" onClick={copy} /> : null}
+      <Icon className="edit" title="缂栬緫" type="edit" onClick={edit} />
+      <Icon className="edit close" title="鍒犻櫎" type="close" onClick={del} />
+      {type === 'action' ? <Icon className="edit copy" title="澶嶅埗" type="copy" onClick={copy} /> : null}
+      {type === 'action' && ['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ?
+        <Icon className="edit profile" title="鏍¢獙瑙勫垯" type="profile" onClick={profile} /> : null
+      }
     </div>
   )
 }
diff --git a/src/templates/tableshare/dragelement/index.jsx b/src/templates/tableshare/dragelement/index.jsx
index 44f5461..2d7f306 100644
--- a/src/templates/tableshare/dragelement/index.jsx
+++ b/src/templates/tableshare/dragelement/index.jsx
@@ -7,7 +7,7 @@
 import ItemTypes from './itemtypes'
 import './index.scss'
 
-const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn, showfield }) => {
+const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu, handleGridBtn, showfield }) => {
   let target = null
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
@@ -28,6 +28,11 @@
   const editCard = id => {
     const { card } = findCard(id)
     handleMenu(card)
+  }
+  
+  const profileCard = id => {
+    const { card } = findCard(id)
+    profileMenu(card)
   }
 
   const delCard = id => {
@@ -59,6 +64,9 @@
       }
 
       let newcard = {}
+      newcard.uuid = Utils.getuuid()
+      newcard.focus = true
+      
       if (item.type === 'search') {
         let _match = 'like'
         if (item.subType === 'select' || item.subType === 'link') {
@@ -68,7 +76,7 @@
         } else if (item.subType === 'dateweek' || item.subType === 'daterange') {
           _match = 'between'
         }
-        newcard.uuid = Utils.getuuid()
+        
         newcard.label = 'label'
         newcard.field = ''
         newcard.initval = ''
@@ -85,7 +93,6 @@
         newcard.match = _match
         newcard.display = 'dropdown'
       } else if (item.type === 'action') {
-        newcard.uuid = Utils.getuuid()
         newcard.label = 'button'
         newcard.innerFunc = ''
         newcard.outerFunc = ''
@@ -114,7 +121,6 @@
           newcard.label = item.label
         }
       } else if (item.type === 'columns') {
-        newcard.uuid = Utils.getuuid()
         newcard.Align = 'left'
         newcard.label = 'label'
         newcard.field = ''
@@ -137,12 +143,12 @@
 
       const { index: overIndex } = findCard(`${targetId}`)
       let targetIndex = overIndex
-      if (!target) {
-        targetIndex++
-      }
-      if (targetIndex < 0) {
-        targetIndex = 0
-      }
+      // if (!target) {
+      targetIndex++
+      // }
+      // if (targetIndex < 0) {
+      //   targetIndex = 0
+      // }
 
       const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
       setCards(_cards)
@@ -190,6 +196,7 @@
           editCard={editCard}
           delCard={delCard}
           copyCard={copyCard}
+          profileCard={profileCard}
           findCard={findCard}
           hasDrop={hasDrop}
         />
diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx
index 73d67e2..df348b6 100644
--- a/src/templates/tableshare/searchform/index.jsx
+++ b/src/templates/tableshare/searchform/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd'
+import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd'
 import { dateOptions, matchReg } from '@/utils/option.js'
 import EditTable from '../editable'
 import './index.scss'
@@ -32,10 +32,14 @@
     let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
     let _options = ['label', 'field', 'initval', 'type', 'match']                // 榛樿鏄剧ず椤�
 
-    if ((type === 'select' || type === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
-      _options = [..._options, 'resourceType', 'setAll', 'options', 'display']
-    } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
-      _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']
+    if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
+      _options = [..._options, 'resourceType', 'options', 'display']
+    } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
+      _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']
+    }
+
+    if (type === 'select' || type === 'link') {
+      _options.push('setAll')
     }
 
     if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斾笂绾х殑瀛楁鍚�
@@ -55,7 +59,7 @@
         if (form.key === 'match') {
           if (type === 'text') {
             form.options = matchReg.text
-          } else if (type === 'select' || type === 'link') {
+          } else if (type === 'multiselect' || type === 'select' || type === 'link') {
             form.options = matchReg.select
           } else if (type === 'date') {
             form.options = matchReg.date
@@ -71,6 +75,19 @@
     })
   }
 
+  componentDidMount () {
+    const { card } = this.props
+
+    if (card.focus) {
+      try {
+        let _form = document.getElementById('label')
+        _form.select()
+      } catch {
+        console.warn('琛ㄥ崟focus澶辫触锛�')
+      }
+    }
+  }
+
   /**
    * @description 鎼滅储鏉′欢绫诲瀷鍒囨崲
    */
@@ -80,10 +97,14 @@
     if (key === 'type') {
       let _options = ['label', 'field', 'initval', 'type', 'match']
 
-      if ((value === 'select' || value === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
-        _options = [..._options, 'resourceType', 'setAll', 'options', 'display']
-      } else if ((value === 'select' || value === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
-        _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']
+      if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
+        _options = [..._options, 'resourceType', 'options', 'display']
+      } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
+        _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']
+      }
+
+      if (value === 'select' || value === 'link') {
+        _options.push('setAll')
       }
       
       if (value === 'link') {
@@ -107,7 +128,7 @@
           } else if (form.key === 'match') {                     // 鎼滅储鏉′欢绫诲瀷鍒囨崲鏃讹紝鍖归厤瑙勫垯绫诲瀷瀵瑰簲鍒囨崲
             if (value === 'text') {
               form.options = matchReg.text
-            } else if (value === 'select' || value === 'link') {
+            } else if (value === 'multiselect' || value === 'select' || value === 'link') {
               form.options = matchReg.select
             } else if (value === 'date') {
               form.options = matchReg.date
@@ -147,12 +168,16 @@
     let value = e.target.value
 
     if (key === 'resourceType') {
-      let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'setAll', 'display']
+      let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display']
 
       if (value === '0') {
         _options = [..._options, 'options']
       } else if (value === '1') {
         _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
+      }
+
+      if (openType === 'select' || openType === 'link') {
+        _options.push('setAll')
       }
       
       if (openType === 'link') {
@@ -176,16 +201,23 @@
       if (item.hidden) return
 
       if (item.type === 'text') { // 鏂囨湰鎼滅储
+        let rules = item.rules || []
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [
                   {
                     required: !!item.required,
                     message: this.props.dict['form.required.input'] + item.label + '!'
-                  }
+                  },
+                  ...rules
                 ]
               })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)}
             </Form.Item>
diff --git a/src/templates/tableshare/searchform/index.scss b/src/templates/tableshare/searchform/index.scss
index 1dc8fa9..55f5d81 100644
--- a/src/templates/tableshare/searchform/index.scss
+++ b/src/templates/tableshare/searchform/index.scss
@@ -10,4 +10,9 @@
       width: 100%;
     }
   }
+  .anticon-question-circle {
+    color: #c49f47;
+    position: relative;
+    left: -3px;
+  }
 }
\ No newline at end of file
diff --git a/src/utils/option.js b/src/utils/option.js
index ac8c433..ac5d707 100644
--- a/src/utils/option.js
+++ b/src/utils/option.js
@@ -134,6 +134,9 @@
   value: 'yellow',
   text: '榛勮壊'
 }, {
+  value: 'orange',
+  text: '姗欒壊'
+}, {
   value: 'danger',
   text: '绾㈣壊'
 }, {
@@ -158,6 +161,9 @@
   value: 'border-yellow',
   text: '鐧藉簳榛勬'
 }, {
+  value: 'border-orange',
+  text: '鐧藉簳姗欐'
+}, {
   value: 'border-danger',
   text: '鐧藉簳绾㈡'
 }, {
diff --git a/src/utils/utils.js b/src/utils/utils.js
index b0fd07f..2503f10 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -290,6 +290,10 @@
 
         newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : null
         newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : null
+      } else if (item.type === 'text') {
+        item.key.split(',').forEach(field => { // 缁煎悎鎼滅储锛屾墍瀛楁鎷兼帴
+          newsearches[field] = item.value
+        })
       } else {
         newsearches[item.key] = item.value
       }
@@ -309,13 +313,18 @@
     let searchText = ''
     searches.forEach(item => {
       if (!item.value) return
-      // eslint-disable-next-line
-      searchText += (searchText !== '' ? ' ' + 'AND' + ' ' : '')
-      if (item.type === 'text' || item.type === 'select') {
-        // eslint-disable-next-line
+      searchText += (searchText !== '' ? ' AND ' : '')
+      if (item.type === 'text') {
         let str = item.match === '=' ? '' : '%'
-        // eslint-disable-next-line
-        searchText += item.key + ' ' + item.match + ' ' + '\'' + str + item.value + str + '\''
+        let fields = item.key.split(',').map(field => { // 缁煎悎鎼滅储锛屾墍瀛楁鎷兼帴
+          return field + ' ' + item.match + ' \'' + str + item.value + str + '\''
+        })
+
+        searchText += '(' + fields.join(' OR ') + ')'
+      } else if (item.type === 'select') {
+        let str = item.match === '=' ? '' : '%'
+
+        searchText += item.key + ' ' + item.match + ' \'' + str + item.value + str + '\''
       } else if (item.type === 'date') {
         let _val = item.value
         let timetail = ' 00:00:00.000'
@@ -328,29 +337,24 @@
           timetail = ''
         }
 
-        // eslint-disable-next-line
-        searchText += '(' + item.key + ' ' + _match + ' ' + '\'' + _val + timetail + '\')'
+        searchText += '(' + item.key + ' ' + _match + ' \'' + _val + timetail + '\')'
       } else if (item.type === 'datemonth') { // 鏈�-杩囨护鏉′欢锛屼粠鏈堝紑濮嬭嚦缁撴潫锛岀粨鏉熸椂闂翠负鏈堟湯鍔犱竴澶╃殑0鐐癸紝鏂瑰紡涓�<
         let _startval = moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000'
         let _endval = moment(item.value, 'YYYY-MM').endOf('month').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000'
 
-        // eslint-disable-next-line
         searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')'
       } else if (item.type === 'dateweek') { // 鍛�-杩囨护鏉′欢
         let _startval = item.value[0] + ' 00:00:00.000'
         let _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000'
 
-        // eslint-disable-next-line
         searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')'
       } else if (item.type === 'daterange') {
         let _startval = item.value[0] + ' 00:00:00.000'
         let _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000'
 
-        // eslint-disable-next-line
         searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')'
       } else {
-        // eslint-disable-next-line
-        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')'
+        searchText += '(' + item.key + ' ' + item.match + ' \'' + item.value + '\')'
       }
     })
     return searchText
@@ -366,24 +370,18 @@
     let searchText = ''
     searches.forEach(item => {
       if (!item.value) return
-      // eslint-disable-next-line
-      searchText += (searchText !== '' ? ' ' + 'AND' + ' ' : '')
+      searchText += (searchText !== '' ? ' AND ' : '')
       if (item.type === 'text') {
         let options = item.key.split(',').map(op => {
           // equal鏃朵笉娣诲姞%
-          // eslint-disable-next-line
           let str = item.op === 'equal' ? '' : '%'
-          // eslint-disable-next-line
-          return op + ' ' + item.op + ' ' + '"' + str + item.value + str + '"'
+          return op + ' ' + item.op + ' \'' + str + item.value + str + '\''
         })
-        // eslint-disable-next-line
-        searchText += '(' + options.join(' ' + 'OR' + ' ') + ')'
+        searchText += '(' + options.join(' OR ') + ')'
       } else if (item.type === 'date') {
-        // eslint-disable-next-line
-        searchText += '(' + item.key + ' ' + item.op + ' ' + '"' + item.value + '")'
+        searchText += '(' + item.key + ' ' + item.op + ' \'' + item.value + '\')'
       } else {
-        // eslint-disable-next-line
-        searchText += '(' + item.key + ' ' + item.op + ' ' + '"' + item.value + '")'
+        searchText += '(' + item.key + ' ' + item.op + ' \'' + item.value + '\')'
       }
     })
     return searchText

--
Gitblit v1.8.0