From 592ff0aa0f2d45d143872b672a1468e268d3157f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 22 二月 2020 17:25:20 +0800
Subject: [PATCH] 2020-02-22

---
 src/templates/formtabconfig/index.jsx         |   49 +++++++
 src/components/sidemenu/editthdmenu/index.jsx |    9 +
 src/templates/comtableconfig/index.jsx        |   47 ++++++-
 src/templates/subtableconfig/index.jsx        |   46 ++++++
 src/templates/tableshare/editable/index.jsx   |    6 +
 src/templates/modalconfig/index.jsx           |   61 +++++++++
 src/tabviews/subtable/index.jsx               |    6 +
 src/templates/tableshare/searchform/index.jsx |   35 ++++-
 src/locales/zh-CN/comtable.js                 |    1 
 src/templates/ushare/editable/index.jsx       |   16 ++
 src/locales/en-US/comtable.js                 |    1 
 src/templates/tableshare/formconfig.js        |   16 ++
 src/utils/utils.js                            |   16 +-
 src/templates/ushare/modalform/index.jsx      |   32 ++++
 14 files changed, 304 insertions(+), 37 deletions(-)

diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx
index a078950..eaf40a6 100644
--- a/src/components/sidemenu/editthdmenu/index.jsx
+++ b/src/components/sidemenu/editthdmenu/index.jsx
@@ -68,7 +68,8 @@
     btnTab: null,           // 鎵撳紑鏂版爣绛炬垨褰撳墠椤甸潰鍒锋柊鐨勬寜閽�
     btnTabConfig: null,     // 鎵撳紑鏂版爣绛炬寜閽厤缃�
     handleMVisible: false,  // 娣诲姞鎴栦慨鏀硅彍鍗曟ā鎬佹锛堣鑹叉潈闄愬垎閰嶇瓑锛�
-    sysMenu: false          // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級
+    sysMenu: false,         // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級
+    optionLibs: []          // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -166,6 +167,7 @@
             type: 'edit',
             editMenu: _menu,
             loading: false,
+            optionLibs: new Map(), // 缂栬緫鏃讹紝鍒濆鍖栦负绌�
             tabview: _Template.length > 0 ? _menu.PageParam.Template : 'template'
           }, () => {
             document.getElementById('root').style.overflowY = 'hidden'
@@ -451,6 +453,7 @@
       this.setState({
         loading: false,
         tabview: template.type,
+        optionLibs: new Map(), // 鏂板缓鏃讹紝鍒濆鍖栦笅鎷夐�夐」搴�
         editMenu: {
           ...editMenu,
           type: template.type,
@@ -696,6 +699,7 @@
         {this.state.tabview === 'CommonTable' &&
           <ComTableConfig
             menu={this.state.editMenu}
+            optionLibs={this.state.optionLibs}
             supMenuList={this.props.supMenuList}
             reloadmenu={() => {this.props.reload()}}
             handleView={this.handleView}
@@ -704,6 +708,7 @@
         {this.state.tabview === 'Modal' &&
           <ModalConfig
             menu={this.state.editMenu}
+            optionLibs={this.state.optionLibs}
             editTab={this.state.editTab}
             tabConfig={this.state.tabConfig}
             editSubTab={this.state.editSubTab}
@@ -718,6 +723,7 @@
         {this.state.tabview === 'SubTable' &&
           <SubTable
             menu={this.state.editMenu}
+            optionLibs={this.state.optionLibs}
             editTab={this.state.editTab}
             editSubTab={this.state.editSubTab}
             tabConfig={this.state.tabConfig}
@@ -730,6 +736,7 @@
         {this.state.tabview === 'FormTab' &&
           <FormTabConfig
             menu={this.state.editMenu}
+            optionLibs={this.state.optionLibs}
             btnTab={this.state.btnTab}
             config={this.state.subConfig}
             handleView={this.handleView}
diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js
index 8b29462..63275f9 100644
--- a/src/locales/en-US/comtable.js
+++ b/src/locales/en-US/comtable.js
@@ -209,6 +209,7 @@
   'header.form.afterExecError': '澶辫触鍚�',
   'header.form.pagination': '鍒嗛〉',
   'header.form.regular': '姝e垯鏍¢獙',
+  'header.form.quickadd': '蹇嵎娣诲姞',
   'header.modal.form.edit': '琛ㄥ崟-缂栬緫',
   'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫',
   'header.modal.action.edit': '鎸夐挳-缂栬緫',
diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js
index ef086ff..daf9837 100644
--- a/src/locales/zh-CN/comtable.js
+++ b/src/locales/zh-CN/comtable.js
@@ -209,6 +209,7 @@
   'header.form.afterExecError': '澶辫触鍚�',
   'header.form.pagination': '鍒嗛〉',
   'header.form.regular': '姝e垯鏍¢獙',
+  'header.form.quickadd': '蹇嵎娣诲姞',
   'header.modal.form.edit': '琛ㄥ崟-缂栬緫',
   'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫',
   'header.modal.action.edit': '鎸夐挳-缂栬緫',
diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index 4286b1d..0d982b0 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -60,6 +60,7 @@
    */
   UNSAFE_componentWillReceiveProps(nextProps) {
     if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) {
+      this.refs.subTable.resetTable()
       this.loadmaindata(nextProps.BID, 'refresh')
     } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) {
       this.reloadtable()
@@ -514,6 +515,11 @@
     } else if (btn.popClose === 'equaltab' && type === 'pop') {
       this.reloadtable()
       this.props.handleMainTable('equaltab')
+    } else if (btn.execSuccess === 'maingrid' && type === 'success') {
+      this.props.handleMainTable('maingrid')
+    } else if (btn.execSuccess === 'equaltab' && type === 'success') {
+      this.reloadtable()
+      this.props.handleMainTable('equaltab')
     }
   }
 
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 5f01667..5c221c9 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -40,6 +40,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     supMenuList: PropTypes.array,
     reloadmenu: PropTypes.func,
     handleView: PropTypes.func
@@ -70,7 +71,8 @@
     funcLoading: false,      // 瀛樺偍杩囩▼鍒涘缓涓�
     showColumnName: false,   // 鏄剧ず鍒楀瓧娈靛悕鎺у埗
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
-    profileVisible: false    // 楠岃瘉淇℃伅妯℃�佹
+    profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
+    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -79,7 +81,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { menu } = this.props
+    const { menu, optionLibs } = this.props
 
     let _LongParam = menu.LongParam
     let _config = ''
@@ -92,6 +94,21 @@
       _config.isAdd = true
     } else {
       _config = _LongParam
+      _config.search.forEach(item => {
+        if (
+          (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
+          item.resourceType === '0' &&
+          item.options && item.options.length > 0
+        ) {
+          optionLibs.set(item.uuid, {
+            uuid: item.uuid,
+            label: item.label,
+            parname: menu.MenuName,
+            type: 'search',
+            options: item.options
+          })
+        }
+      })
     }
 
     // 閰嶇疆榛樿鍊硷紝鍏煎
@@ -135,6 +152,7 @@
 
     this.setState({
       config: _config,
+      optionLibs: optionLibs,
       originActions: _oriActions,
       originMenu: JSON.parse(JSON.stringify(menu)),
       selectedTables: _config.tables || [],
@@ -521,10 +539,24 @@
    */
   handleSubmit = () => {
     const { menu } = this.props
-    const { config, card, modaltype } = this.state
+    const { config, card, modaltype, optionLibs } = this.state
 
     if (modaltype === 'search') {
       this.searchFormRef.handleConfirm().then(res => {
+        if ( // 鏇存柊涓嬫媺瀛楀吀
+          (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
+          res.resourceType === '0' &&
+          res.options && res.options.length > 0
+        ) {
+          optionLibs.set(res.uuid, {
+            uuid: res.uuid,
+            label: res.label,
+            parname: menu.MenuName,
+            type: 'search',
+            options: res.options
+          })
+        }
+
         let _search = config.search.map(item => {
           if (item.uuid === res.uuid) {
             return res
@@ -536,6 +568,7 @@
 
         this.setState({
           config: {...config, search: _search},
+          optionLibs: optionLibs,
           modaltype: ''
         })
       })
@@ -1126,7 +1159,7 @@
         return
       }
 
-      if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) {
+      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
         let param = {
           func: 's_DataSrc_Save',
           LText: setting.dataresource,
@@ -2301,7 +2334,7 @@
       if (
         res.interType === 'inner' &&
         !res.innerFunc &&
-        res.dataresource.length > 50 &&
+        /[^\s]+\s+[^\s]+/ig.test(res.dataresource) &&
         config.setting.dataresource !== res.dataresource
       ) {
         let param = {
@@ -2329,7 +2362,7 @@
    */
   setSubConfig = (item, type) => {
     const { menu } = this.props
-    const { config, originMenu } = this.state
+    const { config, originMenu, optionLibs } = this.state
 
     if (!originMenu.MenuID) { // menuID涓嶅瓨鍦ㄦ椂锛屼负鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛�
       notification.warning({
@@ -2381,6 +2414,7 @@
         }
 
         let param = {
+          optionLibs: optionLibs,
           editMenu: _originMenu,
           editTab: !isbutton ? item : '',
           tabConfig: null,
@@ -2815,6 +2849,7 @@
           <SearchForm
             dict={this.state.dict}
             card={this.state.card}
+            optionLibs={this.state.optionLibs}
             formlist={this.state.formlist}
             wrappedComponentRef={(inst) => this.searchFormRef = inst}
           />
diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index 1d89f85..27bb489 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -36,6 +36,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     btnTab: PropTypes.object,
     config: PropTypes.any,
     handleView: PropTypes.func
@@ -64,7 +65,8 @@
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
     profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
     editgroup: null,         // 褰撳墠缂栬緫缁�
-    groupVisible: false      // 缂栬緫缁勬ā鎬佹
+    groupVisible: false,     // 缂栬緫缁勬ā鎬佹
+    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -73,7 +75,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { menu, btnTab, config } = this.props
+    const { menu, btnTab, config, optionLibs } = this.props
 
     let _config = ''
     let columns = []
@@ -86,6 +88,24 @@
       }
     } else {
       _config = config
+
+      _config.groups.forEach(group => {
+        group.sublist.forEach(item => {
+          if (
+            (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
+            item.resourceType === '0' &&
+            item.options && item.options.length > 0
+          ) {
+            optionLibs.set(item.uuid, {
+              uuid: item.uuid,
+              label: item.label,
+              parname: btnTab.label,
+              type: 'Modal',
+              options: item.options
+            })
+          }
+        })
+      })
     }
 
     if (menu && menu.LongParam && menu.LongParam.columns) {
@@ -94,6 +114,7 @@
 
     this.setState({
       config: _config,
+      optionLibs: optionLibs,
       columns: columns,
       originMenu: JSON.parse(JSON.stringify(_config)),
       selectedTables: _config.tables,
@@ -247,6 +268,7 @@
     let _tabview = menu ? menu.LongParam.Template : ''
     let param = {
       editMenu: menu,
+      optionLibs: this.state.optionLibs,
       editTab: null,
       tabConfig: null,
       editSubTab: null,
@@ -493,10 +515,24 @@
    * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬�
    */
   handleSubmit = () => {
-    const { config, modaltype } = this.state
+    const { btnTab } = this.props
+    const { config, modaltype, optionLibs } = this.state
 
     if (modaltype === 'search') {
       this.modalFormRef.handleConfirm().then(res => {
+        if ( // 鏇存柊涓嬫媺瀛楀吀
+          (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
+          res.resourceType === '0' &&
+          res.options && res.options.length > 0
+        ) {
+          optionLibs.set(res.uuid, {
+            uuid: res.uuid,
+            label: res.label,
+            parname: btnTab.label,
+            type: 'Modal',
+            options: res.options
+          })
+        }
         let _groups = config.groups.map(group => {
           group.sublist = group.sublist.map(item => {
             if (item.uuid === res.uuid) {
@@ -513,6 +549,7 @@
 
         this.setState({
           config: {...config, groups: _groups},
+          optionLibs: optionLibs,
           modaltype: ''
         })
       })
@@ -882,7 +919,7 @@
         return
       }
 
-      if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) {
+      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
         let param = {
           func: 's_DataSrc_Save',
           LText: setting.dataresource,
@@ -1730,7 +1767,7 @@
       if (
         res.interType === 'inner' &&
         !res.innerFunc &&
-        res.dataresource.length > 50 &&
+        /[^\s]+\s+[^\s]+/ig.test(res.dataresource) &&
         config.setting.dataresource !== res.dataresource
       ) {
         let param = {
@@ -1783,6 +1820,7 @@
 
           let param = {
             editMenu: menu,
+            optionLibs: this.state.optionLibs,
             editTab: btn,
             tabConfig: null,
             editSubTab: null,
@@ -2205,6 +2243,7 @@
             dict={this.state.dict}
             card={this.state.card}
             formlist={this.state.formlist}
+            optionLibs={this.state.optionLibs}
             wrappedComponentRef={(inst) => this.modalFormRef = inst}
           />
         </Modal>
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 9982fb4..f290ca9 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -31,6 +31,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     editTab: PropTypes.any,
     editSubTab: PropTypes.any,
     tabConfig: PropTypes.any,
@@ -61,7 +62,8 @@
     selectedTables: [],    // 宸查�夎〃鍚�
     originConfig: null,    // 鍘熷鑿滃崟
     groupVisible: false,   // 鍏ㄥ眬閰嶇疆妯℃�佹
-    curgroup: null         // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
+    curgroup: null,        // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
+    optionLibs: null       // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -72,7 +74,7 @@
    * 4銆佽缃寜閽熀鏈俊鎭�
    */
   UNSAFE_componentWillMount () {
-    const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props
+    const {menu, editAction, tabConfig, subTabConfig, subConfig, optionLibs} = this.props
 
     let _config = ''
     let _tab = subTabConfig ? subTabConfig : tabConfig
@@ -87,6 +89,42 @@
 
     if (subConfig) {
       _config = subConfig
+
+      if (_config.groups.length > 0) {
+        _config.groups.forEach(group => {
+          group.sublist.forEach(item => {
+            if (
+              (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
+              item.resourceType === '0' &&
+              item.options && item.options.length > 0
+            ) {
+              optionLibs.set(item.uuid, {
+                uuid: item.uuid,
+                label: item.label,
+                parname: editAction.label,
+                type: 'Modal',
+                options: item.options
+              })
+            }
+          })
+        })
+      } else {
+        _config.fields.forEach(item => {
+          if (
+            (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
+            item.resourceType === '0' &&
+            item.options && item.options.length > 0
+          ) {
+            optionLibs.set(item.uuid, {
+              uuid: item.uuid,
+              label: item.label,
+              parname: editAction.label,
+              type: 'Modal',
+              options: item.options
+            })
+          }
+        })
+      }
     } else {
       _config = JSON.parse(JSON.stringify((Source.baseConfig)))
     }
@@ -100,6 +138,7 @@
 
     this.setState({
       menu: _menu,
+      optionLibs: optionLibs,
       config: _config,
       selectedTables: _config.tables || [],
       originConfig: JSON.parse(JSON.stringify(_config)),
@@ -231,6 +270,7 @@
     
     let param = {
       editMenu: menu,
+      optionLibs: this.state.optionLibs,
       editTab: editTab,
       tabConfig: tabConfig,
       editSubTab: editSubTab,
@@ -364,8 +404,23 @@
    * 3銆侀�氳繃loading鍒锋柊
    */
   handleSubmit = () => {
+    const {editAction, optionLibs} = this.props
     this.formRef.handleConfirm().then(res => {
       let _config = JSON.parse(JSON.stringify(this.state.config))
+
+      if ( // 鏇存柊涓嬫媺瀛楀吀
+        (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
+        res.resourceType === '0' &&
+        res.options && res.options.length > 0
+      ) {
+        optionLibs.set(res.uuid, {
+          uuid: res.uuid,
+          label: res.label,
+          parname: editAction.label,
+          type: 'Modal',
+          options: res.options
+        })
+      }
 
       if (_config.groups.length > 0) {
         _config.groups.forEach(group => {
@@ -391,6 +446,7 @@
 
       this.setState({
         config: _config,
+        optionLibs: optionLibs,
         visible: false
       })
     })
@@ -1050,6 +1106,7 @@
             dict={this.state.dict}
             card={this.state.card}
             formlist={this.state.formlist}
+            optionLibs={this.state.optionLibs}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />}
         </Modal>
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index d649cfb..1b37f90 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -38,6 +38,7 @@
 class SubTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     editTab: PropTypes.any,
     tabConfig: PropTypes.any,
     editSubTab: PropTypes.any,
@@ -75,7 +76,8 @@
     funcLoading: false,      // 瀛樺偍杩囩▼鍒涘缓涓�
     showColumnName: false,   // 鏄剧ず鍒楀瓧娈靛悕鎺у埗
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
-    profileVisible: false    // 楠岃瘉淇℃伅妯℃�佹
+    profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
+    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -84,7 +86,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { config, editTab, editSubTab } = this.props
+    const { config, editTab, editSubTab, optionLibs } = this.props
 
     let _config = null
 
@@ -95,6 +97,22 @@
       _config.isAdd = true
     } else {
       _config = JSON.parse(JSON.stringify(config))
+
+      _config.search.forEach(item => {
+        if (
+          (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
+          item.resourceType === '0' &&
+          item.options && item.options.length > 0
+        ) {
+          optionLibs.set(item.uuid, {
+            uuid: item.uuid,
+            label: item.label,
+            parname: _config.tabName,
+            type: 'search',
+            options: item.options
+          })
+        }
+      })
     }
     
     let _oriActions = []
@@ -117,6 +135,7 @@
 
     this.setState({
       originActions: _oriActions,
+      optionLibs: optionLibs,
       config: _config,
       originConfig: _config,
       selectedTables: _config.tables || [],
@@ -293,6 +312,7 @@
 
     let param = {
       editMenu: menu,
+      optionLibs: this.state.optionLibs,
       editTab: editSubTab ? editTab : null,
       tabConfig: null,
       editSubTab: null,
@@ -390,10 +410,24 @@
    * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬�
    */
   handleSubmit = () => {
-    const { card, config, modaltype } = this.state
+    const { card, config, modaltype, optionLibs } = this.state
 
     if (modaltype === 'search') {
       this.searchFormRef.handleConfirm().then(res => {
+        if ( // 鏇存柊涓嬫媺瀛楀吀
+          (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
+          res.resourceType === '0' &&
+          res.options && res.options.length > 0
+        ) {
+          optionLibs.set(res.uuid, {
+            uuid: res.uuid,
+            label: res.label,
+            parname: config.tabName,
+            type: 'search',
+            options: res.options
+          })
+        }
+
         let _search = config.search.map(item => {
           if (item.uuid === res.uuid) {
             return res
@@ -405,6 +439,7 @@
 
         this.setState({
           config: {...config, search: _search},
+          optionLibs: optionLibs,
           modaltype: ''
         })
       })
@@ -900,7 +935,7 @@
         return
       }
 
-      if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) {
+      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
         let param = {
           func: 's_DataSrc_Save',
           LText: setting.dataresource,
@@ -1859,7 +1894,7 @@
       if (
         res.interType === 'inner' &&
         !res.innerFunc &&
-        res.dataresource.length > 50 &&
+        /[^\s]+\s+[^\s]+/ig.test(res.dataresource) &&
         config.setting.dataresource !== res.dataresource
       ) {
         let param = {
@@ -1923,6 +1958,7 @@
 
           let param = {
             editMenu: menu,
+            optionLibs: this.state.optionLibs,
             editTab: editTab,
             tabConfig: editSubTab ? tabConfig : originConfig,
             editSubTab: _subtab,
diff --git a/src/templates/tableshare/editable/index.jsx b/src/templates/tableshare/editable/index.jsx
index 4f10603..40a23f8 100644
--- a/src/templates/tableshare/editable/index.jsx
+++ b/src/templates/tableshare/editable/index.jsx
@@ -1,4 +1,5 @@
 import React, {Component} from 'react'
+import { is, fromJS } from 'immutable'
 import { Table, Input, Button, Popconfirm, Form, Icon } from 'antd'
 import Utils from '@/utils/utils.js'
 import './index.scss'
@@ -211,6 +212,11 @@
   UNSAFE_componentWillReceiveProps (nextProps) {
     if (this.props.type !== nextProps.type) {
       this.resetColumn(nextProps.type)
+    } else if (!is(fromJS(this.props.data), fromJS(nextProps.data))) {
+      this.setState({
+        dataSource: nextProps.data,
+        count: nextProps.data.length
+      })
     }
   }
 
diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js
index 2413581..b02eba8 100644
--- a/src/templates/tableshare/formconfig.js
+++ b/src/templates/tableshare/formconfig.js
@@ -203,6 +203,14 @@
         value: 'sso',
         text: Formdict['header.form.database.sso']
       }]
+    },
+    {
+      type: 'select',
+      key: 'quick',
+      label: Formdict['header.form.quickadd'],
+      initVal: '',
+      required: false,
+      options: []
     }
   ]
 }
@@ -1031,6 +1039,14 @@
       label: Formdict['header.form.linkForm'],
       initVal: card.linkSubField || [],
       options: inputfields
+    },
+    {
+      type: 'select',
+      key: 'quick',
+      label: Formdict['header.form.quickadd'],
+      initVal: '',
+      required: false,
+      options: []
     }
   ]
 }
\ No newline at end of file
diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx
index 840f47d..660aa56 100644
--- a/src/templates/tableshare/searchform/index.jsx
+++ b/src/templates/tableshare/searchform/index.jsx
@@ -9,9 +9,10 @@
 
 class MainSearch extends Component {
   static propTpyes = {
-    dict: PropTypes.object,  // 瀛楀吀椤�
-    formlist: PropTypes.any, // 琛ㄥ崟
-    card: PropTypes.object   // 鎼滅储鏉′欢淇℃伅
+    dict: PropTypes.object,    // 瀛楀吀椤�
+    formlist: PropTypes.any,   // 琛ㄥ崟
+    optionLibs: PropTypes.any, // 鑷畾涔変笅鎷夐泦
+    card: PropTypes.object     // 鎼滅储鏉′欢淇℃伅
   }
 
   state = {
@@ -26,14 +27,14 @@
    * 2銆佷笅鎷夐�夋嫨锛屾牴鎹暟鎹簮绫诲瀷鏄剧ず鐩稿叧閰嶇疆
    */
   UNSAFE_componentWillMount () {
-    const { formlist } = this.props
+    const { formlist, optionLibs } = this.props
 
     let type = formlist.filter(cell => cell.key === 'type')[0].initVal
     let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
     let _options = ['label', 'field', 'initval', 'type', 'match']                // 榛樿鏄剧ず椤�
 
     if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
-      _options = [..._options, 'resourceType', 'options', 'display']
+      _options = [..._options, 'resourceType', 'options', 'display', 'quick']
     } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
       _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database']
     }
@@ -68,6 +69,14 @@
           } else if (type === 'dateweek' || type === 'daterange') {
             form.options = matchReg.daterange
           }
+        } else if (form.key === 'quick') {
+          form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid)
+          form.options = form.options.map(cell => {
+            return {
+              value: cell.uuid,
+              text: cell.label + '(' + cell.parname + ')'
+            }
+          })
         }
         form.hidden = !_options.includes(form.key)
         return form
@@ -98,7 +107,7 @@
       let _options = ['label', 'field', 'initval', 'type', 'match']
 
       if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') {        // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮
-        _options = [..._options, 'resourceType', 'options', 'display']
+        _options = [..._options, 'resourceType', 'options', 'display', 'quick']
       } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙�
         _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database']
       }
@@ -157,6 +166,18 @@
           })
         })
       })
+    } else if (key === 'quick') {
+      let option = this.props.optionLibs.get(value)
+
+      this.setState({
+        formlist: this.state.formlist.map(form => {
+          if (form.key === 'options') {
+            form.initVal = option.options
+          }
+
+          return form
+        })
+      })
     }
   }
 
@@ -171,7 +192,7 @@
       let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display']
 
       if (value === '0') {
-        _options = [..._options, 'options']
+        _options = [..._options, 'options', 'quick']
       } else if (value === '1') {
         _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
       }
diff --git a/src/templates/ushare/editable/index.jsx b/src/templates/ushare/editable/index.jsx
index 856c600..a5b94a1 100644
--- a/src/templates/ushare/editable/index.jsx
+++ b/src/templates/ushare/editable/index.jsx
@@ -307,6 +307,22 @@
   UNSAFE_componentWillReceiveProps (nextProps) {
     if (!is(fromJS(this.props.linkSubFields), fromJS(nextProps.linkSubFields)) || this.props.type !== nextProps.type) {
       this.resetColumn(nextProps.type, nextProps.linkSubFields)
+    } else if (!is(fromJS(this.props.data), fromJS(nextProps.data))) {
+      let _data = []
+      nextProps.data.forEach(item => {
+        let _item = {key: Utils.getuuid()}
+        this.state.columns.forEach(col => {
+          _item[col.dataIndex] = item[col.dataIndex] || ''
+          if (col.dataIndex !== 'ParentID' && !_item[col.dataIndex]) {
+            _item[col.dataIndex] = item.Text
+          }
+        })
+        _data.push(_item)
+      })
+      this.setState({
+        dataSource: _data,
+        count: nextProps.data.length
+      })
     }
   }
 
diff --git a/src/templates/ushare/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx
index 063fa5c..6df7446 100644
--- a/src/templates/ushare/modalform/index.jsx
+++ b/src/templates/ushare/modalform/index.jsx
@@ -10,7 +10,8 @@
 
 class MainSearch extends Component {
   static propTpyes = {
-    dict: PropTypes.object, // 瀛楀吀椤�
+    dict: PropTypes.object,    // 瀛楀吀椤�
+    optionLibs: PropTypes.any, // 鑷畾涔変笅鎷夐泦
     formlist: PropTypes.any,
     card: PropTypes.object
   }
@@ -23,6 +24,7 @@
   }
 
   UNSAFE_componentWillMount () {
+    const { optionLibs } = this.props
     let formlist = JSON.parse(JSON.stringify(this.props.formlist))
 
     let type = ''
@@ -50,7 +52,7 @@
     let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 榛樿鏄剧ず椤�
 
     if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
-      _options = [..._options, 'resourceType', 'options']
+      _options = [..._options, 'resourceType', 'options', 'quick']
     } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮
       _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
     } else if (type === 'number') {
@@ -87,7 +89,16 @@
           form.type = 'number'
           form.initVal = form.initVal || 0
           form.required = true
+        } else if (form.key === 'quick') {
+          form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid)
+          form.options = form.options.map(cell => {
+            return {
+              value: cell.uuid,
+              text: cell.label + '(' + cell.parname + ')'
+            }
+          })
         }
+
         form.show = _options.includes(form.key)
         return form
       })
@@ -108,11 +119,12 @@
   }
 
   openTypeChange = (key, value) => {
+
     if (key === 'type') {
       let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin']
 
       if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
-        _options = [..._options, 'resourceType', 'options']
+        _options = [..._options, 'resourceType', 'options', 'quick']
       } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮
         _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
       } else if (value === 'number') {
@@ -180,6 +192,18 @@
           })
         })
       })
+    } else if (key === 'quick') {
+      let option = this.props.optionLibs.get(value)
+
+      this.setState({
+        formlist: this.state.formlist.map(form => {
+          if (form.key === 'options') {
+            form.initVal = option.options
+          }
+
+          return form
+        })
+      })
     }
   }
 
@@ -211,7 +235,7 @@
     if (key === 'resourceType') {
       let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin']
       if (value === '0') {
-        _options = [..._options, 'options']
+        _options = [..._options, 'options', 'quick']
       } else if (value === '1') {
         _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
       }
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 6de456a..ba0e8e1 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1021,7 +1021,6 @@
       config.search.forEach(item => {
         if (item.field) {
           let type = ''
-          let _f = item.field
 
           if (item.type.match(/date/ig)) {
             type = 'datetime=null'
@@ -1029,12 +1028,15 @@
             type = 'nvarchar(50)=\'\''
           }
 
-          if (_fields.has(item.field)) {
-            _f = _f + '1'
-          }
-
-          _fields.set(item.field, true)
-          formParam = formParam + `mchr13k@${_f} ${type},`
+          item.field.split(',').forEach(cell => {
+            let _f = cell
+            if (_fields.has(cell)) {
+              _f = _f + '1'
+            }
+  
+            _fields.set(cell, true)
+            formParam = formParam + `mchr13k@${_f} ${type},`
+          })
         }
       })
     }

--
Gitblit v1.8.0