From afb39f8ab004b2607bb718edab02e99c7a010114 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 三月 2023 14:36:44 +0800
Subject: [PATCH] 2023-03-22

---
 src/utils/utils-custom.js |  123 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 110 insertions(+), 13 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index eb12ca9..823cb11 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -429,6 +429,9 @@
         if (item.wrap.datatype === 'public' && item.wrap.publicId) {
           item.wrap.publicId = md5(commonId + item.wrap.publicId)
         }
+        if (item.wrap.autoExec) {
+          item.wrap.autoExec = md5(commonId + item.wrap.autoExec)
+        }
 
         if (item.supNodes && item.supNodes.length > 0) {
           item.supNodes = item.supNodes.map(cell => {
@@ -453,16 +456,21 @@
             }
           }
 
+          if (card.setting.click === 'button' && card.setting.linkbtn) {
+            card.setting.linkbtn = md5(commonId + card.setting.linkbtn)
+          }
+
           if (card.elements) {
             card.elements = card.elements.map(cell => {
-              cell.uuid = this.getuuid()
-
               if (cell.eleType === 'button') {
+                cell.uuid = md5(commonId + cell.uuid)
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
                   cell.linkmenu = ''
                 }
                 this.resetBtn(cell, commonId)
+              } else {
+                cell.uuid = this.getuuid()
               }
               
               return cell
@@ -470,14 +478,15 @@
           }
           if (card.backElements) {
             card.backElements = card.backElements.map(cell => {
-              cell.uuid = this.getuuid()
-
               if (cell.eleType === 'button') {
+                cell.uuid = md5(commonId + cell.uuid)
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
                   cell.linkmenu = ''
                 }
                 this.resetBtn(cell, commonId)
+              } else {
+                cell.uuid = this.getuuid()
               }
 
               return cell
@@ -488,16 +497,20 @@
         if (item.wrap.datatype === 'public' && item.wrap.publicId) {
           item.wrap.publicId = md5(commonId + item.wrap.publicId)
         }
+        if (item.wrap.linkbtn) {
+          item.wrap.linkbtn = md5(commonId + item.wrap.linkbtn)
+        }
         if (item.elements) {
           item.elements = item.elements.map(cell => {
-            cell.uuid = this.getuuid()
-
             if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
               if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                 cell.pageTemplate = ''
                 cell.linkmenu = ''
               }
               this.resetBtn(cell, commonId)
+            } else {
+              cell.uuid = this.getuuid()
             }
 
             return cell
@@ -518,7 +531,7 @@
               })
             } else if (c.type === 'action' && c.elements) {
               c.elements = c.elements.map(cell => {
-                cell.uuid = this.getuuid()
+                cell.uuid = md5(commonId + cell.uuid)
 
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
@@ -548,7 +561,7 @@
             })
           } else if (col.type === 'action' && col.elements) {
             col.elements = col.elements.map(cell => {
-              cell.uuid = this.getuuid()
+              cell.uuid = md5(commonId + cell.uuid)
               this.resetBtn(cell, commonId)
               return cell
             })
@@ -661,6 +674,14 @@
    * @description 鎸夐挳閲嶇疆
    */
   static resetBtn (btn, commonId) {
+    if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.execMode === 'pop')) {
+      if (btn.modal && btn.modal.fields.length > 0) {
+        btn.modal.fields = btn.modal.fields.map(m => {
+          m.uuid = this.getuuid()
+          return m
+        })
+      }
+    }
     if (btn.switchTab && btn.switchTab.length > 0) {
       btn.switchTab = btn.switchTab.map(m => md5(commonId + m))
     }
@@ -688,7 +709,7 @@
   * @description 閲嶇疆缁勪欢閰嶇疆
   * @return {String}  item 缁勪欢淇℃伅
   */
-  static resetComponentConfig = (item) => {
+  static resetComponentConfig = (item, appType) => {
     if (item.type === 'navbar') {
       return item
     }
@@ -719,14 +740,46 @@
         return cell
       })
     } else if (['card', 'carousel', 'timeline'].includes(item.type)) {
+      if (item.wrap.autoExec) {
+        item.wrap.autoExec = md5(commonId + item.wrap.autoExec)
+      }
+
+      if (appType !== 'mob') {
+        if (item.wrap.pagestyle === 'slide') {
+          item.wrap.pagestyle = 'page'
+        }
+      } else {
+        if (item.wrap.pagestyle === 'switch') {
+          item.wrap.pagestyle = 'page'
+        }
+      }
+      
       item.subcards.forEach(card => {
         card.uuid = this.getuuid()
+
+        if (card.setting.click === 'button' && card.setting.linkbtn) {
+          card.setting.linkbtn = md5(commonId + card.setting.linkbtn)
+        }
+
         if (card.elements) {
           if (sessionStorage.getItem('editMenuType') === 'popview') {
             card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
           }
           card.elements = card.elements.map(cell => {
-            cell.uuid = this.getuuid()
+            if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
+
+              if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+                if (cell.modal && cell.modal.fields.length > 0) {
+                  cell.modal.fields = cell.modal.fields.map(m => {
+                    m.uuid = this.getuuid()
+                    return m
+                  })
+                }
+              }
+            } else {
+              cell.uuid = this.getuuid()
+            }
             return cell
           })
         }
@@ -735,7 +788,19 @@
             card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
           }
           card.backElements = card.backElements.map(cell => {
-            cell.uuid = this.getuuid()
+            if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
+              if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+                if (cell.modal && cell.modal.fields.length > 0) {
+                  cell.modal.fields = cell.modal.fields.map(m => {
+                    m.uuid = this.getuuid()
+                    return m
+                  })
+                }
+              }
+            } else {
+              cell.uuid = this.getuuid()
+            }
             return cell
           })
         }
@@ -745,8 +810,23 @@
         if (sessionStorage.getItem('editMenuType') === 'popview') {
           item.elements = item.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
         }
+        if (item.wrap.linkbtn) {
+          item.wrap.linkbtn = md5(commonId + item.wrap.linkbtn)
+        }
         item.elements = item.elements.map(cell => {
-          cell.uuid = this.getuuid()
+          if (cell.eleType === 'button') {
+            cell.uuid = md5(commonId + cell.uuid)
+            if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+              if (cell.modal && cell.modal.fields.length > 0) {
+                cell.modal.fields = cell.modal.fields.map(m => {
+                  m.uuid = this.getuuid()
+                  return m
+                })
+              }
+            }
+          } else {
+            cell.uuid = this.getuuid()
+          }
           return cell
         })
       }
@@ -784,7 +864,16 @@
             col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton')
           }
           col.elements = col.elements.map(cell => {
-            cell.uuid = this.getuuid()
+            cell.uuid = md5(commonId + cell.uuid)
+            if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+              if (cell.modal && cell.modal.fields.length > 0) {
+                cell.modal.fields = cell.modal.fields.map(m => {
+                  m.uuid = this.getuuid()
+                  return m
+                })
+              }
+            }
+
             return cell
           })
         }
@@ -820,6 +909,14 @@
       }
       item.action = item.action.map(cell => {
         cell.uuid = md5(commonId + cell.uuid)
+        if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+          if (cell.modal && cell.modal.fields.length > 0) {
+            cell.modal.fields = cell.modal.fields.map(m => {
+              m.uuid = this.getuuid()
+              return m
+            })
+          }
+        }
 
         return cell
       })

--
Gitblit v1.8.0