From 81a5ae579e84d7cfe0cda268d4156d4b78a27454 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 30 十二月 2024 13:46:34 +0800
Subject: [PATCH] 2024-12-30

---
 src/tabviews/zshare/mutilform/mkPopSelect/index.jsx |    4 +-
 src/tabviews/zshare/mutilform/index.jsx             |    3 +
 src/menu/components/share/pastecomponent/index.jsx  |   22 ++++++++++
 src/menu/components/share/pastebasetable/index.jsx  |    7 +++
 src/utils/utils-custom.js                           |   57 +++++++---------------------
 5 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/src/menu/components/share/pastebasetable/index.jsx b/src/menu/components/share/pastebasetable/index.jsx
index 84811f8..9204d46 100644
--- a/src/menu/components/share/pastebasetable/index.jsx
+++ b/src/menu/components/share/pastebasetable/index.jsx
@@ -4,6 +4,7 @@
 import { SnippetsOutlined } from '@ant-design/icons'
 
 import Utils from '@/utils/utils.js'
+import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 // import './index.scss'
 
@@ -52,6 +53,10 @@
           } else if (col.type === 'custom' && col.elements) {
             col.elements = col.elements.map(cell => {
               cell.uuid = Utils.getuuid()
+
+              if (cell.eleType === 'button') {
+                MenuUtils.resetBtn(cell, cell.uuid)
+              }
               return cell
             })
           }
@@ -69,6 +74,8 @@
 
         cell.uuid = _uuid
 
+        MenuUtils.resetBtn(cell, cell.uuid)
+
         return cell
       })
 
diff --git a/src/menu/components/share/pastecomponent/index.jsx b/src/menu/components/share/pastecomponent/index.jsx
index a96fa09..f0e89a1 100644
--- a/src/menu/components/share/pastecomponent/index.jsx
+++ b/src/menu/components/share/pastecomponent/index.jsx
@@ -6,6 +6,7 @@
 
 import Utils from '@/utils/utils.js'
 import MKEmitter from '@/utils/events.js'
+import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 // import './index.scss'
 
@@ -28,7 +29,9 @@
       item.uuid = _uuid
     }
 
-    if (item.copyType === 'cardcell' && config.subtype === 'datacard') {
+    if (item.copyType === 'action') {
+      MenuUtils.resetBtn(item, _uuid)
+    } else if (item.copyType === 'cardcell' && config.subtype === 'datacard') {
       item.setting = item.setting || {}
       item.$cardType = 'extendCard'
       item.setting.width = item.setting.width || 6
@@ -39,6 +42,10 @@
             cell.datatype = 'static'
           }
           cell.uuid = Utils.getuuid()
+
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -48,6 +55,10 @@
             cell.datatype = 'static'
           }
           cell.uuid = Utils.getuuid()
+
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -64,12 +75,18 @@
       if (item.elements) {
         item.elements = item.elements.map(cell => {
           cell.uuid = Utils.getuuid()
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
       if (item.backElements) {
         item.backElements = item.backElements.map(cell => {
           cell.uuid = Utils.getuuid()
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -87,6 +104,9 @@
           } else if (col.type === 'custom' && col.elements) {
             col.elements = col.elements.map(cell => {
               cell.uuid = Utils.getuuid()
+              if (cell.eleType === 'button') {
+                MenuUtils.resetBtn(cell, _uuid)
+              }
               return cell
             })
           }
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index 8f4fc89..00c1b69 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -286,6 +286,9 @@
         } else {
           item.showValue = ''
         }
+        if (window.backend && action.uuid) {
+          item.formSqlId = md5(action.uuid.replace(/_pop$/, '') + item.uuid)
+        }
       } else if (item.type === 'brafteditor') {
         if (window.backend && newval && /<\/span>/.test(newval) && item.encryption === 'true') {
           try {
diff --git a/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
index 4b967e2..8b18bcf 100644
--- a/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
@@ -122,8 +122,8 @@
     })
 
     let param = null
-    if (window.backend && window.GLOB.CacheData.has('sql_' + config.uuid)) {
-      let ex = window.GLOB.CacheData.get('sql_' + config.uuid)
+    if (window.backend && window.GLOB.CacheData.has('sql_' + config.formSqlId)) {
+      let ex = window.GLOB.CacheData.get('sql_' + config.formSqlId)
       let sysvals = {
         time_id: Utils.getguid(),
         mk_departmentcode: sessionStorage.getItem('departmentcode') || '',
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 00e48a7..7989e15 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -652,7 +652,7 @@
    */
   static resetBtn (btn, commonId) {
     if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.execMode === 'pop')) {
-      if (btn.modal && btn.modal.fields.length > 0) {
+      if (btn.modal && btn.modal.fields && btn.modal.fields.length > 0) {
         btn.modal.fields = btn.modal.fields.map(m => {
           m.uuid = this.getuuid()
           return m
@@ -684,6 +684,10 @@
 
         return md5(commonId + m)
       })
+    }
+
+    if (btn.OpenType === 'popview' && btn.config && btn.config.components) {
+      btn.config.components = this.resetConfig(btn.config.components, commonId)
     }
   }
 
@@ -771,14 +775,7 @@
             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
-                  })
-                }
-              }
+              this.resetBtn(cell, commonId)
             } else {
               cell.uuid = this.getuuid()
             }
@@ -792,14 +789,8 @@
           card.backElements = card.backElements.map(cell => {
             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
-                  })
-                }
-              }
+
+              this.resetBtn(cell, commonId)
             } else {
               cell.uuid = this.getuuid()
             }
@@ -818,14 +809,8 @@
         item.elements = item.elements.map(cell => {
           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
-                })
-              }
-            }
+
+            this.resetBtn(cell, commonId)
           } else {
             cell.uuid = this.getuuid()
           }
@@ -850,14 +835,7 @@
             col.elements = col.elements.map(cell => {
               cell.uuid = md5(commonId + cell.uuid)
               if (cell.eleType === 'button') {
-                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
-                    })
-                  }
-                }
+                this.resetBtn(cell, commonId)
               }
               return cell
             })
@@ -902,14 +880,7 @@
       }
       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
-            })
-          }
-        }
+        this.resetBtn(cell, commonId)
 
         return cell
       })
@@ -3331,7 +3302,7 @@
           } else if (form.type === 'popSelect') {
             let msg = getPopSelectSql(form)
         
-            sqls.push({uuid: form.uuid, type: 'popSource', ...msg})
+            sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'popSource', ...msg})
           }
         })
       }
@@ -3374,7 +3345,7 @@
             } else if (form.type === 'popSelect') {
               let msg = getPopSelectSql(form)
           
-              sqls.push({uuid: form.uuid, type: 'popSource', ...msg})
+              sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'popSource', ...msg})
             }
           })
         }

--
Gitblit v1.8.0