From 169f6cd29a0d3add4fe2cf35c3579b45fa83c0d4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 十一月 2023 00:02:45 +0800
Subject: [PATCH] 2023-11-14

---
 src/menu/components/form/simple-form/options.jsx                |    8 ++
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx         |    8 ++
 src/tabviews/custom/components/card/double-data-card/index.scss |    1 
 src/menu/components/card/cardcellcomponent/index.jsx            |    2 
 src/tabviews/custom/components/form/simple-form/index.jsx       |   53 ++++++++++++++++-
 src/tabviews/zshare/actionList/popupbutton/index.jsx            |    8 ++
 src/tabviews/zshare/actionList/normalbutton/index.jsx           |    8 ++
 src/tabviews/custom/components/card/data-card/index.scss        |    1 
 src/utils/utils-custom.js                                       |   31 +++++++++-
 src/menu/components/share/actioncomponent/index.jsx             |    2 
 src/tabviews/zshare/actionList/excelInbutton/index.jsx          |    8 ++
 11 files changed, 116 insertions(+), 14 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 3495c10..21d06f8 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -311,7 +311,7 @@
       }
     }
 
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId)
+    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId, true)
 
     if (cards.subtype === 'basetable') {
       this.setState({
diff --git a/src/menu/components/form/simple-form/options.jsx b/src/menu/components/form/simple-form/options.jsx
index daa2192..b9108ff 100644
--- a/src/menu/components/form/simple-form/options.jsx
+++ b/src/menu/components/form/simple-form/options.jsx
@@ -131,6 +131,14 @@
       options: fields
     },
     {
+      type: 'select',
+      field: 'refocus',
+      label: '鍒锋柊鐒︾偣',
+      initval: wrap.refocus || '',
+      required: false,
+      options: fields
+    },
+    {
       type: 'radio',
       field: 'cache',
       label: '閫夐」鏌ヨ',
diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx
index e33d65e..0109542 100644
--- a/src/menu/components/share/actioncomponent/index.jsx
+++ b/src/menu/components/share/actioncomponent/index.jsx
@@ -207,7 +207,7 @@
       }
     }
     
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId)
+    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId, config.subtype !== 'basetable')
 
     if (config.subtype === 'basetable') {
       delete card.eleType // 鍖哄垎鎸夐挳浣嶇疆
diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss
index 8cc715c..b2def5d 100644
--- a/src/tabviews/custom/components/card/data-card/index.scss
+++ b/src/tabviews/custom/components/card/data-card/index.scss
@@ -256,6 +256,7 @@
     position: absolute;
     top: 0px;
     right: 0px;
+    z-index: 1;
     button {
       margin-bottom: 0px!important;
     }
diff --git a/src/tabviews/custom/components/card/double-data-card/index.scss b/src/tabviews/custom/components/card/double-data-card/index.scss
index 86868e4..4d27218 100644
--- a/src/tabviews/custom/components/card/double-data-card/index.scss
+++ b/src/tabviews/custom/components/card/double-data-card/index.scss
@@ -310,6 +310,7 @@
     position: absolute;
     top: 0px;
     right: 0px;
+    z-index: 1;
     button {
       margin-bottom: 0px!important;
     }
diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx
index 1f08786..9f8adb5 100644
--- a/src/tabviews/custom/components/form/simple-form/index.jsx
+++ b/src/tabviews/custom/components/form/simple-form/index.jsx
@@ -176,11 +176,39 @@
   }
 
   reloadData = (menuId, id) => {
-    const { config } = this.state
+    const { config, group } = this.state
 
     if (config.uuid !== menuId) return
 
-    this.loadData()
+    if (id === 'focus-refresh' && config.wrap.refocus) {
+      let _group = fromJS(group).toJS()
+      _group.setting.focus = config.wrap.refocus
+
+      if (config.wrap.datatype === 'static') {
+        this.setState({
+          data: null,
+          group: _group
+        }, () => {
+          this.setState({data: {$$empty: true}})
+        })
+      } else {
+        this.setState({
+          group: _group
+        }, () => {
+          this.loadData(true)
+        })
+      }
+    } else if (id === 'focus-nofresh' && config.wrap.refocus) {
+      let formId = ''
+      group.fields.forEach(item => {
+        if (item.field === config.wrap.refocus) {
+          formId = item.uuid
+        }
+      })
+      MKEmitter.emit('mkFC', 'focus', formId)
+    } else {
+      this.loadData()
+    }
   }
 
   /**
@@ -197,6 +225,14 @@
     if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) {
       MKEmitter.emit('reloadData', config.setting.supModule, BID)
     } else if (position === 'grid' && config.wrap.datatype === 'static') {
+      if (config.wrap.refocus && group.setting.focus === config.wrap.refocus) {
+        let _group = fromJS(group).toJS()
+        _group.setting.focus = config.wrap.focus
+  
+        this.setState({
+          group: _group
+        })
+      }
       this.setState({
         data: null
       }, () => {
@@ -253,8 +289,17 @@
     }
   }
 
-  async loadData () {
-    const { config, BID } = this.state
+  async loadData (refocus) {
+    const { config, BID, group } = this.state
+
+    if (config.wrap.refocus && !refocus && group.setting.focus === config.wrap.refocus) {
+      let _group = fromJS(group).toJS()
+      _group.setting.focus = config.wrap.focus
+
+      this.setState({
+        group: _group
+      })
+    }
 
     if (config.wrap.datatype === 'public') {
       MKEmitter.emit('reloadData', config.wrap.publicId)
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 02b4f08..df4b7d4 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -199,9 +199,15 @@
       if (btn.syncComponentId === 'multiComponent') {
         btn.syncComponentIds.forEach((id, i) => {
           setTimeout(() => {
-            MKEmitter.emit('reloadData', id)
+            if (/\$focus/.test(id)) {
+              MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
+            } else {
+              MKEmitter.emit('reloadData', id)
+            }
           }, 20 * i)
         })
+      } else if (/\$focus/.test(btn.syncComponentId)) {
+        MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
       } else {
         MKEmitter.emit('reloadData', btn.syncComponentId)
       }
diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 7e032ca..1667d62 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -891,9 +891,15 @@
       if (btn.syncComponentId === 'multiComponent') {
         btn.syncComponentIds.forEach((id, i) => {
           setTimeout(() => {
-            MKEmitter.emit('reloadData', id)
+            if (/\$focus/.test(id)) {
+              MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
+            } else {
+              MKEmitter.emit('reloadData', id)
+            }
           }, 20 * i)
         })
+      } else if (/\$focus/.test(btn.syncComponentId)) {
+        MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
       } else {
         MKEmitter.emit('reloadData', btn.syncComponentId)
       }
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 0c5ae33..a274d27 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2298,9 +2298,15 @@
       if (btn.syncComponentId === 'multiComponent') {
         btn.syncComponentIds.forEach((id, i) => {
           setTimeout(() => {
-            MKEmitter.emit('reloadData', id)
+            if (/\$focus/.test(id)) {
+              MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
+            } else {
+              MKEmitter.emit('reloadData', id)
+            }
           }, 20 * i)
         })
+      } else if (/\$focus/.test(btn.syncComponentId)) {
+        MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
       } else {
         MKEmitter.emit('reloadData', btn.syncComponentId)
       }
diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx
index 5153d82..a92a711 100644
--- a/src/tabviews/zshare/actionList/popupbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx
@@ -215,9 +215,15 @@
       if (btn.syncComponentId === 'multiComponent') {
         btn.syncComponentIds.forEach((id, i) => {
           setTimeout(() => {
-            MKEmitter.emit('reloadData', id)
+            if (/\$focus/.test(id)) {
+              MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
+            } else {
+              MKEmitter.emit('reloadData', id)
+            }
           }, 20 * i)
         })
+      } else if (/\$focus/.test(btn.syncComponentId)) {
+        MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
       } else {
         MKEmitter.emit('reloadData', btn.syncComponentId)
       }
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 0c2939d..44a9750 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -6,7 +6,7 @@
    * @description 鑾峰彇涓嬬骇妯″潡
    * @return {String}  selfId  褰撳墠缁勪欢id
    */
-  static getSubModules (components, selfId, supId) {
+  static getSubModules (components, selfId, supId, has) {
     let modules = []
     components.forEach(item => {
       if (item.uuid === selfId || item.type === 'navbar') {
@@ -17,6 +17,17 @@
           label: item.name,
           disabled: supId === item.uuid
         })
+
+        if (item.type === 'form' && item.subtype === 'simpleform' && item.wrap.refocus && supId !== item.uuid) {
+          modules.push({
+            value: item.uuid + '$focus-refresh',
+            label: item.name + '锛堝埛鏂�-鑱氱劍锛�',
+          })
+          modules.push({
+            value: item.uuid + '$focus-nofresh',
+            label: item.name + '锛堜笉鍒锋柊-鑱氱劍锛�',
+          })
+        }
       } else if (item.type === 'tabs') {
         if (item.subtype === 'tabletabs') {
           item.subtabs.forEach(tab => {
@@ -38,7 +49,7 @@
                 type: 'tab',
                 value: f_tab.uuid,
                 label: f_tab.label,
-                children: this.getSubModules(f_tab.components, selfId, supId)
+                children: this.getSubModules(f_tab.components, selfId, supId, has)
               }
   
               if (subItem.children.length === 0) {
@@ -672,11 +683,23 @@
     }
     if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) {
       btn.syncComponents = btn.syncComponents.map(m => {
-        m.syncComId = m.syncComId.map(n => md5(commonId + n))
+        m.syncComId = m.syncComId.map(n => {
+          if (/\$focus/.test(n)) {
+            return md5(commonId + n.split('$')[0]) + '$' + n.split('$')[1]
+          }
+
+          return md5(commonId + n)
+        })
         return m
       })
     } else if (btn.syncComponent && btn.syncComponent.length > 0) {
-      btn.syncComponent = btn.syncComponent.map(m => md5(commonId + m))
+      btn.syncComponent = btn.syncComponent.map(m => {
+        if (/\$focus/.test(m)) {
+          return md5(commonId + m.split('$')[0]) + '$' + m.split('$')[1]
+        }
+
+        return md5(commonId + m)
+      })
     }
   }
 

--
Gitblit v1.8.0