From b69b5f6329ca5f87932436b7a6c1ddfc3377e10f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 五月 2024 10:56:41 +0800
Subject: [PATCH] 2024-05-16

---
 src/tabviews/basetable/index.jsx |   54 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx
index 0ca4327..a8c9ff9 100644
--- a/src/tabviews/basetable/index.jsx
+++ b/src/tabviews/basetable/index.jsx
@@ -45,7 +45,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { MenuID, MenuName } = this.props
+    const { MenuID, MenuName, param } = this.props
 
     let _param = {
       func: 'sPC_Get_LongParam',
@@ -148,8 +148,8 @@
         try { // 閰嶇疆淇℃伅瑙f瀽
           let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
           if (userConfig) {
-            shortcuts = userConfig.action
-            userConfig.printers.forEach(item => {
+            shortcuts = userConfig.action || []
+            userConfig.printers && userConfig.printers.forEach(item => {
               window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item)
             })
           }
@@ -161,9 +161,18 @@
       // 鏉冮檺杩囨护
       let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
       let skip = window.GLOB.mkHS
-      let param = this.props.param || {} // url鍙傛暟
+      let urlparam = {} // url鍙傛暟
+      if (param) {
+        Object.keys(param).forEach(key => {
+          if (/^\$/.test(key)) {
+            urlparam[key] = param[key]
+          } else {
+            urlparam[key.toLowerCase()] = param[key]
+          }
+        })
+      }
 
-      window.GLOB.CacheData.set(MenuID, param)
+      window.GLOB.CacheData.set(MenuID, urlparam)
 
       let userName = sessionStorage.getItem('User_Name') || ''
       let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -181,7 +190,7 @@
       }
       if (config.urlFields) {
         config.urlFields.forEach(field => {
-          let val = `'${param[field] || ''}'`
+          let val = `'${urlparam[field.toLowerCase()] || ''}'`
           regs.push({
             reg: new RegExp('@' + field + '@', 'ig'),
             value: val
@@ -193,7 +202,7 @@
         regs.push({ reg: /@works_flow_code@/ig, value: `'${config.flow_code}'` })
       }
 
-      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true')
+      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, urlparam, MenuID, config.MenuName, config.process === 'true')
 
       let autoMatic = null
       if (config.autoMatic && config.autoMatic.enable === 'true') {
@@ -213,18 +222,6 @@
       config.components.forEach(component => {
         if (component.type === 'tabs') return
 
-        if (param.$searchkey) {
-          component.search = component.search.map(item => {
-            if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) {
-              item.initval = param.$searchval
-            }
-  
-            return item
-          })
-
-          component.$searches = Utils.initMainSearch(component.search)
-        }
-
         if (component.$searches.length) {
           component.$main = true
           
@@ -236,7 +233,7 @@
         }
       })
 
-      let BID = param.$BID || ''
+      let BID = urlparam.$BID || ''
 
       config.components = this.formatSetting(config.components, regs)
 
@@ -358,6 +355,14 @@
       // 鎼滅储鏉′欢鍒濆鍖�
       Utils.initSearchVal(item)
 
+      if (urlparam.$searchkey) {
+        item.search.forEach(cell => {
+          if (urlparam.$searchkey === cell.field.toLowerCase() && ['text', 'select', 'link', 'checkcard'].includes(cell.type)) {
+            cell.initval = urlparam.$searchval
+          }
+        })
+      }
+
       item.$searches = Utils.initMainSearch(item.search)
 
       let statFields = []
@@ -371,7 +376,10 @@
             col.type = 'custom'
           }
           
-          if (col.type === 'number') {
+          if (col.type === 'index') {
+            col.field = '$Index'
+            col.type = 'text'
+          } else if (col.type === 'number') {
             if (col.sum === 'true') {
               statFields.push(col)
             }
@@ -397,7 +405,7 @@
                   cell = this.getPrinter(cell, item.uuid)
                 }
 
-                return skip || permAction[cell.uuid]
+                return skip || permAction[cell.uuid] || cell.permission === 'false'
               } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
                 if (!cell.height) {
                   cell.innerHeight = 'auto'
@@ -464,7 +472,7 @@
             cell = this.getPrinter(cell, item.uuid)
           }
 
-          return skip || permAction[cell.uuid]
+          return skip || permAction[cell.uuid] || cell.permission === 'false'
         })
       }
       

--
Gitblit v1.8.0