From c8e680b315ce010905f6b0409d3156218abfe056 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 11 三月 2021 19:03:31 +0800
Subject: [PATCH] 2021-03-11

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |  108 +++++++++++++++++++++++++++++------------------------
 1 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 7c56bbe..fc44aa9 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -197,9 +197,14 @@
     } else if (btn.OpenType === 'pop') {
       this.updateStatus('start')
 
+      let modal = this.state.btnconfig
+      if (!modal && btn.modal) {
+        modal = this.handleModelConfig(btn.modal)
+      }
+
       this.setState({
         tabledata: data,
-        btnconfig: btn.modal ? btn.modal : this.state.btnconfig
+        btnconfig: modal
       }, () => {
         this.improveAction()
       })
@@ -1397,6 +1402,57 @@
     })
   }
 
+  handleModelConfig = (config) => {
+    let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
+    if (config.groups.length > 0) {
+      config.groups.forEach(group => {
+        group.sublist = group.sublist.map(cell => {
+          // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛� 鏉冮檺榛戝悕鍗曞瓧娈佃缃负闅愯棌琛ㄥ崟
+          if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
+            let _option = Utils.getSelectQueryOptions(cell)
+
+            // 澶栬仈鏁版嵁搴撴浛鎹�
+            if (window.GLOB.externalDatabase !== null) {
+              _option.sql = _option.sql.replace(/@db@/ig, window.GLOB.externalDatabase)
+            }
+
+            cell.data_sql = Utils.formatOptions(_option.sql)
+            cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
+            cell.arr_field = _option.field
+          }
+
+          // 瀛楁鏉冮檺榛戝悕鍗�
+          if (!cell.blacklist || cell.blacklist.length === 0) return cell
+          if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+            cell.hidden = 'true'
+          }
+
+          return cell
+        })
+      })
+    } else {
+      config.fields = config.fields.map(cell => {
+        // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
+        if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
+          let _option = Utils.getSelectQueryOptions(cell)
+
+          cell.data_sql = Utils.formatOptions(_option.sql)
+          cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
+          cell.arr_field = _option.field
+        }
+
+        // 瀛楁鏉冮檺榛戝悕鍗�
+        if (!cell.blacklist || cell.blacklist.length === 0) return cell
+        if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+          cell.hidden = 'true'
+        }
+
+        return cell
+      })
+    }
+    return config
+  }
+
   /**
    * @description 鑾峰彇鎸夐挳閰嶇疆淇℃伅
    */
@@ -1443,54 +1499,8 @@
           })
           this.updateStatus('over')
         } else {
-          let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
-          if (_LongParam.groups.length > 0) {
-            _LongParam.groups.forEach(group => {
-              group.sublist = group.sublist.map(cell => {
-                // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛� 鏉冮檺榛戝悕鍗曞瓧娈佃缃负闅愯棌琛ㄥ崟
-                if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
-                  let _option = Utils.getSelectQueryOptions(cell)
-
-                  // 澶栬仈鏁版嵁搴撴浛鎹�
-                  if (window.GLOB.externalDatabase !== null) {
-                    _option.sql = _option.sql.replace(/@db@/ig, window.GLOB.externalDatabase)
-                  }
-
-                  cell.data_sql = Utils.formatOptions(_option.sql)
-                  cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
-                  cell.arr_field = _option.field
-                }
-
-                // 瀛楁鏉冮檺榛戝悕鍗�
-                if (!cell.blacklist || cell.blacklist.length === 0) return cell
-                if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-                  cell.hidden = 'true'
-                }
-
-                return cell
-              })
-            })
-          } else {
-            _LongParam.fields = _LongParam.fields.map(cell => {
-              // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
-              if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
-                let _option = Utils.getSelectQueryOptions(cell)
-
-                cell.data_sql = Utils.formatOptions(_option.sql)
-                cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
-                cell.arr_field = _option.field
-              }
-
-              // 瀛楁鏉冮檺榛戝悕鍗�
-              if (!cell.blacklist || cell.blacklist.length === 0) return cell
-              if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-                cell.hidden = 'true'
-              }
-
-              return cell
-            })
-          }
-
+          _LongParam = this.handleModelConfig(_LongParam)
+          
           this.setState({
             btnconfig: _LongParam
           }, () => {

--
Gitblit v1.8.0