From 4de0acf2a232ae29f2b5bd7bb2ee61a238c5d2d0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 24 十月 2023 17:31:55 +0800
Subject: [PATCH] 2023-10-24

---
 src/tabviews/custom/components/table/edit-table/index.jsx |   61 +++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index 6450750..9d5d2cb 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -27,7 +27,6 @@
     config: {},           // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑
     actions: null,        // 鎸夐挳闆�
     columns: null,        // 鏄剧ず鍒�
-    arr_field: '',        // 鏌ヨ瀛楁闆�
     setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
     data: [],             // 鍒楄〃鏁版嵁闆�
     selectedData: [],     // 宸查�夎〃鏍兼暟鎹�
@@ -36,7 +35,8 @@
     pageIndex: 1,         // 椤电爜
     pageSize: 10,         // 姣忛〉鏁版嵁鏉℃暟
     orderBy: '',          // 鎺掑簭
-    search: ''            // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞�
+    search: '',           // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞�
+    allSearch: null
   }
 
   /**
@@ -85,6 +85,10 @@
         if (item.Hide === 'true') return false
 
         item.tableId = setting.tableId
+
+        if (setting.commit === 'blur') {
+          item.blur = true
+        }
 
         if (item.type === 'colspan') {
           item.subcols = getColumns(item.subcols)
@@ -164,6 +168,18 @@
       _config.lineMarks = null
     }
 
+    let allSearch = null
+    if (_config.colsCtrls && _config.colsCtrls.length > 0) {
+      allSearch = [{key: 'BID', value: BID || ''}]
+      allSearch.push(..._config.$searches)
+      if (_config.setting.useMSearch) {
+        let mainSearch = window.GLOB.SearchBox.get(_config.$searchId) || []
+        allSearch.push(...mainSearch)
+      }
+    } else {
+      _config.colsCtrls = null
+    }
+
     this.setState({
       pageSize: setting.pageSize || 10,
       BID: BID || '',
@@ -173,8 +189,8 @@
       setting: setting,
       actions: _config.action,
       columns: _columns,
-      arr_field: _config.columns.map(col => col.field).join(','),
-      search: _config.$searches
+      search: _config.$searches,
+      allSearch
     }, () => {
       if (_config.setting.onload === 'true') {
         setTimeout(() => {
@@ -190,7 +206,7 @@
    * @param { String }  repage 琛ㄦ牸鏄惁閲嶇疆椤电爜
    */
   async loadmaindata (reset, repage) {
-    const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
+    const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
     if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
       this.setState({
@@ -222,7 +238,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID)
+    let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -252,10 +268,22 @@
         return item
       })
 
+      let total = result.total || 0
+      if (config.setting.custompage && data.length) {
+        total = data[data.length - 1].mk_total || 0
+      }
+
+      let allSearch = null
+      if (config.colsCtrls) {
+        allSearch = [{key: 'BID', value: BID || ''}]
+        allSearch.push(...searches)
+      }
+
       this.setState({
         data: data,
         selectedData: [],
-        total: result.total,
+        allSearch: allSearch,
+        total: total,
         loading: false
       })
 
@@ -298,8 +326,13 @@
    * @description 鑾峰彇鍗曡鏁版嵁
    */ 
   async loadmainLinedata (id) {
-    const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
+    const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
+    if (config.forbidLine) {
+      this.reloadtable()
+      return
+    }
+    
     let searches = fromJS(search).toJS()
     if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢
       let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || []
@@ -316,7 +349,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id)
+    let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -435,7 +468,7 @@
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   queryModuleParam = (menuId, callback) => {
-    const { arr_field, config, orderBy, search, setting} = this.state
+    const { config, orderBy, search, setting } = this.state
 
     if (config.uuid !== menuId) return
 
@@ -451,10 +484,8 @@
     }
 
     callback({
-      arr_field: arr_field,
       orderBy: orderBy || setting.order,
-      search: searches,
-      menuName: config.name
+      search: searches
     })
   }
 
@@ -579,7 +610,7 @@
   }
 
   render() {
-    const { BID, setting, actions, config, columns, BData, data, selectedData } = this.state
+    const { BID, setting, actions, config, columns, BData, data, selectedData, allSearch } = this.state
 
     let style = {...config.style}
     if (config.wrap.empty === 'hidden' && data.length === 0) {
@@ -605,9 +636,11 @@
           setting={setting}
           columns={columns}
           MenuID={config.uuid}
+          allSearch={allSearch}
           submit={config.submit}
           fields={config.columns}
           total={this.state.total}
+          colsCtrls={config.colsCtrls}
           lineMarks={config.lineMarks}
           loading={this.state.loading}
           refreshdata={this.refreshbytable}

--
Gitblit v1.8.0