From 669839c40c0080786cefa6a8e62d3ada68a39b8e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 六月 2022 14:10:50 +0800
Subject: [PATCH] 2022-06-14

---
 src/tabviews/custom/components/form/normal-form/index.jsx |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx
index 7fd5624..60336e9 100644
--- a/src/tabviews/custom/components/form/normal-form/index.jsx
+++ b/src/tabviews/custom/components/form/normal-form/index.jsx
@@ -27,17 +27,18 @@
 
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
-    BID: '',                   // 涓婄骇ID
-    config: null,              // 鍥捐〃閰嶇疆淇℃伅
-    loading: false,            // 鏁版嵁鍔犺浇鐘舵��
-    sync: false,               // 鏄惁缁熶竴璇锋眰鏁版嵁
-    data: null,                  // 鏁版嵁
+    BID: '',
+    config: null,
+    loading: false,
+    sync: false,
+    data: null,
     group: null,
+    BData: '',
     step: 0
   }
 
   UNSAFE_componentWillMount () {
-    const { data, BID } = this.props
+    const { data, BID, BData } = this.props
     let config = fromJS(this.props.config).toJS()
 
     let _data = null
@@ -99,6 +100,7 @@
       group: _group,
       step: _group.sort - 1,
       BID: BID || '',
+      BData: BData || '',
       config: config,
       arr_field: config.columns.map(col => col.field).join(','),
     }, () => {
@@ -146,6 +148,7 @@
           _data = _data[0] || {$$empty: true}
         }
       }
+
       if (config.wrap.statusControl && _data[config.wrap.statusControl]) {
         let _status = _data[config.wrap.statusControl]
         let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
@@ -192,15 +195,27 @@
     this.execSuccess(btn, id)
   }
 
-  resetParentParam = (MenuID, id) => {
+  resetParentParam = (MenuID, id, data) => {
     const { config } = this.state
 
-    if (config.wrap.datatype === 'static' || !config.setting.supModule || config.setting.supModule !== MenuID) return
+    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
     
     if (id !== this.state.BID || id !== '') {
-      this.setState({ BID: id }, () => {
-        this.loadData()
-      })
+      if (config.wrap.datatype === 'static' || (config.setting.supModule && !id)) {
+        this.setState({
+          data: null,
+          BID: id,
+          BData: data
+        }, () => {
+          this.setState({
+            data: {$$empty: true}
+          })
+        })
+      } else {
+        this.setState({ BID: id, BData: data }, () => {
+          this.loadData()
+        })
+      }
     }
   }
 
@@ -333,7 +348,7 @@
   }
 
   render() {
-    const { config, loading, BID, data, group, dict, step } = this.state
+    const { config, loading, BID, BData, data, group, dict, step } = this.state
 
     return (
       <div className="custom-normal-form-box" id={'anchor' + config.uuid} style={{...config.style}}>
@@ -355,6 +370,7 @@
         </div> : null}
         {group && data ? <MutilForm
           BID={BID}
+          BData={BData}
           dict={dict}
           data={data}
           action={group}

--
Gitblit v1.8.0