From 4e570c993e66a47ead0f83de76b63b0a2f8c5446 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 05 六月 2023 17:28:16 +0800
Subject: [PATCH] 2023-06-05

---
 src/tabviews/custom/index.jsx |   63 +++++++++++++------------------
 1 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 42725b3..0eef227 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -473,9 +473,7 @@
         item.search = Utils.initSearchVal(item.search)
       }
 
-      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 && typeof(item.setting.supModule) !== 'string') {
         let pid = item.setting.supModule.pop()
@@ -500,13 +498,6 @@
           cell = this.resetButton(item, cell, popview)
 
           cell.$toolbtn = true
-
-          if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-            cell.syncComponentId = ''
-            if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-              cell.execSuccess = 'mainline'
-            }
-          }
 
           if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
             cell = this.getPrinter(cell, item.uuid)
@@ -553,13 +544,6 @@
                   if (cell.hidden === 'true') return false
 
                   cell = this.resetButton(item, cell, popview)
-
-                  if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-                    cell.syncComponentId = ''
-                    if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                      cell.execSuccess = 'mainline'
-                    }
-                  }
 
                   if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                     cell = this.getPrinter(cell, item.uuid)
@@ -618,13 +602,6 @@
 
               cell = this.resetButton(item, cell, popview)
 
-              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-                cell.syncComponentId = ''
-                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                  cell.execSuccess = 'mainline'
-                }
-              }
-
               if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                 cell = this.getPrinter(cell, item.uuid)
               }
@@ -642,13 +619,6 @@
               if (cell.hidden === 'true') return false
 
               cell = this.resetButton(item, cell, popview)
-
-              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-                cell.syncComponentId = ''
-                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                  cell.execSuccess = 'mainline'
-                }
-              }
 
               if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                 cell = this.getPrinter(cell, item.uuid)
@@ -673,13 +643,6 @@
             if (cell.hidden === 'true') return false
 
             cell = this.resetButton(item, cell, popview)
-
-            if (cell.syncComponentId && cell.syncComponentId === item.wrap.supModule) {
-              cell.syncComponentId = ''
-              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                cell.execSuccess = 'mainline'
-              }
-            }
 
             if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
               cell = this.getPrinter(cell, item.uuid)
@@ -805,6 +768,32 @@
       }
     }
 
+    if (cell.syncComponentId) {
+      if (cell.syncComponentId === item.setting.supModule) {
+        cell.syncComponentId = ''
+        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+          cell.execSuccess = 'mainline'
+        }
+      } else if (cell.syncComponentId === 'multiComponent') {
+        let ids = cell.syncComponents.map(m => {
+          return m.syncComId.pop() || ''
+        })
+
+        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+            cell.execSuccess = 'mainline'
+          }
+          ids = ids.filter(id => id !== item.setting.supModule)
+        }
+        
+        if (ids.length === 0) {
+          cell.syncComponentId = ''
+        } else {
+          cell.syncComponentIds = ids
+        }
+      }
+    }
+
     return cell
   }
 

--
Gitblit v1.8.0