From 4cc738e535d1a20701d206e12cf9de8cc5a01170 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 01 六月 2024 15:24:12 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/components/normalform/modalform/index.jsx |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index 8a7599f..c685080 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -7,7 +7,6 @@
 import asyncComponent from '@/utils/asyncComponent'
 import MKEInput from './mkInput'
 import MKNumberInput from './mkNumberInput'
-import MKEmitter from '@/utils/events.js'
 import MKSelect from './mkSelect'
 import './index.scss'
 
@@ -155,7 +154,7 @@
       if (item.linkField) {
         let supInitVal = fieldMap.get(item.linkField).initval || ''
         
-        item.options = item.oriOptions.filter(option => option.ParentID === supInitVal)
+        item.options = item.oriOptions.filter(option => option.ParentID === supInitVal || option.ParentID === '')
       }
 
       return item
@@ -243,30 +242,27 @@
           if (item && item.linkField) {
             let supInitVal = this.record[item.linkField] || ''
             
-            item.options = item.oriOptions.filter(option => option.ParentID === supInitVal)
+            item.options = item.oriOptions.filter(option => option.ParentID === supInitVal || option.ParentID === '')
           }
 
           return item || cell
         })
       })
     } else if (item.reset_source) {
-      let map = new Map()
-      this.state.formlist.forEach(cell => {
-        if (!cell.field) return
-        map.set(cell.field, cell)
-      })
-
-      item.callback(map, this.record, MKEmitter)
-
-      this.setState({
-        formlist: this.state.formlist.map(cell => {
-          if (!cell.field) return cell
-
-          let item = map.get(cell.field)
-
-          return item || cell
+      let reOptions = item.callback(this.record)
+      
+      if (reOptions) {
+        this.setState({
+          formlist: this.state.formlist.map(cell => {
+            if (!cell.field || !reOptions[cell.field]) return cell
+  
+            cell.options = reOptions[cell.field]
+            cell.timestamp = new Date().getTime()
+            
+            return cell
+          })
         })
-      })
+      }
     }
   }
 

--
Gitblit v1.8.0