From 2f3b614bb34f5e2865e91c949712f5ee5e8a18f2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 十一月 2023 21:43:52 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/custom/components/form/step-form/index.jsx |   41 ++++++++++++++++++++++++++++-------------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx
index 7f3bb27..6e08986 100644
--- a/src/tabviews/custom/components/form/step-form/index.jsx
+++ b/src/tabviews/custom/components/form/step-form/index.jsx
@@ -45,7 +45,9 @@
       BID = BData.$BID || ''
     }
 
-    if (_config.wrap.datatype !== 'static') {
+    if (_config.wrap.datatype === 'dynamic') {
+      _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true'
+
       if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) {
         _data = window.GLOB.SyncData.get(_config.dataName) || []
         _data = _data[0] || {$$empty: true}
@@ -112,14 +114,7 @@
       step: _group.sort - 1,
       BID: BID || '',
       BData: BData || '',
-      config: _config,
-      arr_field: _config.columns.map(col => col.field).join(','),
-    }, () => {
-      if (_config.wrap.datatype !== 'static' && config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        setTimeout(() => {
-          this.loadData()
-        }, _config.setting.delay || 0)
-      }
+      config: _config
     })
   }
 
@@ -138,6 +133,8 @@
     if (config.setting.sync === 'true') {
       MKEmitter.addListener('transferSyncData', this.transferSyncData)
     }
+
+    this.initExec()
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -154,6 +151,16 @@
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
     MKEmitter.removeListener('transferSyncData', this.transferSyncData)
     MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
+  }
+
+  initExec = () => {
+    const { config } = this.state
+    
+    if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') {
+      setTimeout(() => {
+        this.loadData()
+      }, config.setting.delay || 0)
+    }
   }
 
   transferSyncData = (syncId) => {
@@ -211,6 +218,12 @@
 
     if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) {
       MKEmitter.emit('reloadData', config.setting.supModule, BID)
+    } else if (position === 'grid' && config.wrap.datatype === 'static') {
+      this.setState({
+        data: null
+      }, () => {
+        this.setState({data: {$$empty: true}})
+      })
     } else {
       this.loadData()
     }
@@ -261,7 +274,7 @@
 
     if (btn.linkmenu && btn.linkmenu.length > 0) {
       let menu_id = btn.linkmenu[btn.linkmenu.length - 1]
-      let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || ''
+      let menu = window.GLOB.mkThdMenus.get(menu_id) || ''
 
       if (!menu) return
 
@@ -275,7 +288,7 @@
   }
 
   async loadData (type) {
-    const { config, arr_field, BID } = this.state
+    const { config, BID } = this.state
 
     if (config.wrap.datatype === 'static') {
       this.setState({
@@ -306,7 +319,7 @@
     })
 
     let _orderBy = config.setting.order || ''
-    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID)
+    let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -375,13 +388,15 @@
     }
   }
 
-  mkFormSubmit = (btnId) => {
+  mkFormSubmit = (btnId, callback) => {
     const { group } = this.state
 
     if (group.uuid !== btnId) return
 
     this.formRef.handleConfirm().then(res => {
       MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res})
+    }, () => {
+      callback && callback()
     })
   }
 

--
Gitblit v1.8.0