From c6f8e27d35cd31bb6393a1e7f747b6b2593dbd7a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 六月 2022 13:56:57 +0800
Subject: [PATCH] 2022-06-08

---
 src/tabviews/custom/index.jsx |   90 ++++++++++++++++++++++++++++++---------------
 1 files changed, 60 insertions(+), 30 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index e794b18..226bea5 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -523,23 +523,6 @@
         }
       }
 
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        if (item.supNodes && item.supNodes[0]) {
-          item.setting.supModule = item.supNodes[0].componentId
-        } else {
-          item.wrap.supType = 'single'
-          item.supNodes = null
-          item.setting.supModule = ''
-        }
-      } else if (item.setting && item.setting.supModule) {
-        let pid = item.setting.supModule.pop()
-        if (pid && pid !== 'empty') {
-          item.setting.supModule = pid
-        } else {
-          item.setting.supModule = ''
-        }
-      }
-
       // 鎼滅储鏉′欢鍒濆鍖�
       if (item.search && item.search.length > 0) {
         item.search = Utils.initSearchVal(item.search)
@@ -601,6 +584,19 @@
         item.statFields = statFields
       }
 
+      let mutil = false
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
+        mutil = true
+        item.setting.supModule = item.supNodes[0].componentId
+      } else if (item.setting && item.setting.supModule) {
+        let pid = item.setting.supModule.pop()
+        if (pid && pid !== 'empty') {
+          item.setting.supModule = pid
+        } else {
+          item.setting.supModule = ''
+        }
+      }
+
       // 鏉冮檺杩囨护
       let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 寮圭獥鏍囩鎸夐挳Id
       if (item.action && item.action.length > 0) {
@@ -616,7 +612,7 @@
           cell.$view = 'CustomPage'
           cell.$toolbtn = true
 
-          if (cell.syncComponentId === item.uuid) {
+          if (!mutil && cell.syncComponentId === item.setting.supModule) {
             cell.syncComponentId = ''
           }
 
@@ -657,7 +653,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -699,7 +695,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -733,6 +729,8 @@
         if (item.wrap.linkType === 'sync') {
           item.wrap.syncModuleId = item.wrap.syncModule.pop()
           balMap.set(item.wrap.syncModuleId, true)
+        } else if (item.wrap.linkType === 'sup') {
+          item.wrap.supModule = item.wrap.supModule.pop()
         }
         item.elements = item.elements.filter(cell => {
           if (cell.eleType === 'button') {
@@ -746,7 +744,7 @@
             cell.$tabId = tabId
             cell.$view = 'CustomPage'
 
-            if (cell.syncComponentId === item.uuid) {
+            if (cell.syncComponentId === item.wrap.supModule) {
               cell.syncComponentId = ''
             }
 
@@ -787,7 +785,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -831,7 +829,7 @@
             cell.$tabId = tabId
             cell.$view = 'CustomPage'
 
-            if (cell.syncComponentId === item.uuid) {
+            if (cell.syncComponentId === item.setting.supModule) {
               cell.syncComponentId = ''
             }
 
@@ -853,14 +851,46 @@
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
           item.submit.$menuId = item.uuid
         }
-      }
+      } else if (item.type === 'form') {
+        item.subcards = item.subcards.map(group => {
+          group.subButton.uuid = group.uuid
+          group.subButton.$menuId = group.uuid
+          // group.subButton.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺
+          group.subButton.OpenType = 'formSubmit'
+          group.subButton.execError = 'never'
 
-      // if (item.wrap && item.wrap.doubleClick) {
-      //   let index = item.action.findIndex((btn) => btn.uuid === item.wrap.doubleClick)
-      //   if (index === -1) {
-      //     item.wrap.doubleClick = ''
-      //   }
-      // }
+          if (!group.subButton.Ot) {
+            group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
+          }
+
+          group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : ''
+
+          if (group.subButton.syncComponentId === item.setting.supModule) {
+            group.subButton.syncComponentId = ''
+          }
+
+          group.fields = group.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 || !roleId || cell.blacklist.length === 0) return cell
+            if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+              cell.hidden = 'true'
+            }
+      
+            return cell
+          })
+
+          return group
+        })
+      }
       
       return true
     })

--
Gitblit v1.8.0