From 6f2b0cab4c9a4dacfebb2d6fbd4ec2fdc14e22ba Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 29 四月 2024 15:29:58 +0800
Subject: [PATCH] 2024-04-29

---
 src/tabviews/custom/index.jsx |  151 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 107 insertions(+), 44 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 5af3787..da25be6 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -41,6 +41,7 @@
 const AntvX6 = asyncComponent(() => import('./components/chart/antv-X6'))
 const Voucher = asyncComponent(() => import('./components/module/voucher'))
 const Account = asyncComponent(() => import('./components/module/account'))
+const Invoice = asyncComponent(() => import('./components/module/invoice'))
 const Iframe = asyncComponent(() => import('./components/iframe'))
 const Calendar = asyncComponent(() => import('./components/calendar'))
 const DebugTable = asyncComponent(() => import('@/tabviews/debugtable'))
@@ -249,7 +250,7 @@
 
       let initInters = []
 
-      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
+      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters, config.MenuName)
       config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true')
 
       let params = []
@@ -265,18 +266,6 @@
       // 瀛楁閫忚
       config.components.forEach(component => {
         if (component.type !== 'search') 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)
-        }
 
         window.GLOB.SearchBox.set(MenuID, component.$searches)
 
@@ -451,6 +440,8 @@
             }
           }
 
+          tab.$menuname = (MenuName || '') + '-' + (tab.label || '')
+
           return true
         })
 
@@ -563,21 +554,47 @@
         item.type = 'card'
       }
 
-      // 鎼滅储鏉′欢鍒濆鍖�
-      if (item.search) {
-        Utils.initSearchVal(item)
-
-        item.$searches = Utils.initMainSearch(item.search)
-      }
-
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        item.setting.supModule = item.supNodes[0].componentId
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗°�乼able澶氫笂绾х粍浠�
+        item.supNodes = item.supNodes.map(node => node.componentId)
+        if (item.supNodes[0]) {
+          item.setting.supModule = item.supNodes[0]
+        } else {
+          item.supNodes = null
+          item.setting.supModule = ''
+        }
       } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
         let pid = item.setting.supModule.pop()
         if (pid && pid !== 'empty') {
           item.setting.supModule = pid
         } else {
           item.setting.supModule = ''
+        }
+      } else if (item.type === 'search') {
+        if (item.wrap.supModule) {
+          item.wrap.supModule = item.wrap.supModule.pop()
+        }
+      }
+
+      // 鎼滅储鏉′欢鍒濆鍖�
+      if (item.search) {
+        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)
+
+        if (item.type === 'search' && item.wrap.supModule) {
+          if (!item.checkBid) {
+            item.wrap.supModule = ''
+          } else {
+            window.GLOB.SearchBox.set(item.$searchId + 'checkBid', true)
+          }
         }
       }
 
@@ -600,7 +617,7 @@
             cell = this.getPrinter(cell, item.uuid)
           }
 
-          return pass || permAction[cell.uuid]
+          return pass || permAction[cell.uuid] || cell.permission === 'false'
         })
       }
 
@@ -642,7 +659,7 @@
                     cell = this.getPrinter(cell, item.uuid)
                   }
 
-                  return pass || permAction[cell.uuid]
+                  return pass || permAction[cell.uuid] || cell.permission === 'false'
                 } else {
                   cell = this.resetElement(cell)
                 }
@@ -705,7 +722,7 @@
               cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
           })
 
           if (card.setting.click === 'menus') {
@@ -747,7 +764,7 @@
               cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
           })
         })
       } else if (item.type === 'balcony') {
@@ -771,7 +788,7 @@
             cell = this.resetElement(cell)
           }
 
-          return cell.eleType !== 'button' || pass || permAction[cell.uuid]
+          return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
         })
       } else if (item.type === 'form') {
         item.subcards = item.subcards.map(group => {
@@ -887,7 +904,7 @@
     }
 
     if (cell.OpenType === 'excelOut') { // 瀵煎嚭
-      cell.$menuName = item.name
+      cell.$menuName = item.$menuname
 
       if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
         cell.errorType = 'error1'
@@ -919,19 +936,31 @@
     }
 
     if (cell.verify && cell.verify.preHandle === 'true') {
-      try {
-        // eslint-disable-next-line
-        let func = new Function('btn', 'systemType', cell.verify.pre_func)
-        func(cell, window.GLOB.systemType)
-      } catch (e) {
-        console.warn(e)
+      let script = cell.verify.pre_func
+      if (!/#position-/.test(script) || /#position-init/.test(script)) {
+        try {
+          // eslint-disable-next-line
+          let func = new Function('btn', 'position', 'systemType', script)
+          func(cell, 'init', window.GLOB.systemType)
+        } catch (e) {
+          console.warn(e)
+        }
+      }
+      if (/#position-inner/.test(script)) {
+        cell.$innerScript = script
+      }
+      if (/#position-outer/.test(script)) {
+        cell.$outerScript = script
+      }
+      if (/#position-callback/.test(script)) {
+        cell.$callbackScript = script
       }
     }
 
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
-        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
           cell.execSuccess = 'mainline'
         }
       } else if (cell.syncComponentId === 'multiComponent') {
@@ -939,8 +968,17 @@
           return m.syncComId.pop() || ''
         })
 
-        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
-          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (item.supNodes) {
+          item.supNodes.forEach(node => {
+            if (!ids.includes(node)) return
+
+            if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
+              cell.execSuccess = 'mainline'
+            }
+            ids = ids.filter(id => id !== node)
+          })
+        } else if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
             cell.execSuccess = 'mainline'
           }
           ids = ids.filter(id => id !== item.setting.supModule)
@@ -966,6 +1004,17 @@
 
     if (cell.marks && cell.marks.length === 0) {
       cell.marks = null
+    }
+    if (cell.anchors && cell.anchors.length === 0) {
+      cell.anchors = null
+    }
+
+    if (cell.linkmenu && cell.linkmenu.length > 0) {
+      let menu_id = cell.linkmenu.pop()
+      cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || ''
+      if (!cell.linkThdMenu) {
+        cell.link = ''
+      }
     }
 
     if (['text', 'number', 'formula'].includes(cell.eleType)) {
@@ -1057,8 +1106,14 @@
       if (component.setting.useMSearch) {
         if (!window.GLOB.SearchBox.has(component.$searchId)) {
           component.setting.useMSearch = false
-        } else if (window.GLOB.SearchBox.has(component.$searchId + 'required')) {
-          component.$s_req = true
+        } else {
+          if (window.GLOB.SearchBox.has(component.$searchId + 'required')) {
+            component.$s_req = true
+          }
+          if (window.GLOB.SearchBox.has(component.$searchId + 'checkBid')) {
+            component.checkBid = true
+            component.setting.checkBid = true
+          }
         }
       }
 
@@ -1175,7 +1230,7 @@
   }
 
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatInterSetting = (inters, regs, MenuID, initInters) => {
+  formatInterSetting = (inters, regs, MenuID, initInters, MenuName) => {
     if (!inters) return []
 
     let initlimit = false
@@ -1233,7 +1288,7 @@
       })
       delete inter.scripts
 
-      inter.setting.$name = '鍏叡鏁版嵁婧�-' + inter.setting.name
+      inter.setting.$name = (MenuName || '') + '-鍏叡鏁版嵁婧�-' + inter.setting.name
       inter.setting.execute = inter.setting.execute !== 'false'
 
       if (!inter.setting.execute) {
@@ -1326,6 +1381,10 @@
         MKEmitter.emit('transferSyncData', MenuID)
 
         if (!result.message) return
+
+        if (/灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(result.message)) {
+          result.message = result.message + '璇锋鏌ュ瓧娈甸泦'
+        }
         if (result.ErrCode === 'N') {
           Modal.error({
             title: result.message,
@@ -1595,9 +1654,7 @@
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
-          <Col span={item.width} style={style} key={item.uuid}>
-            <NormalGroup config={item}/>
-          </Col>
+          <NormalGroup config={item} style={style} key={item.uuid}/>
         )
       } else if (item.type === 'editor') {
         return (
@@ -1653,6 +1710,12 @@
             <Account config={item}/>
           </Col>
         )
+      } else if (item.type === 'module' && item.subtype === 'invoice') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <Invoice config={item}/>
+          </Col>
+        )
       } else if (item.type === 'iframe') {
         return (
           <Col span={item.width} style={style} key={item.uuid}>

--
Gitblit v1.8.0