From aa53227bc006816a30258c6390084aa74defb4d1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 27 十一月 2023 18:05:55 +0800
Subject: [PATCH] 2023-11-27

---
 src/components/normalform/modalform/mkRadio/index.jsx |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/components/normalform/modalform/mkRadio/index.jsx b/src/components/normalform/modalform/mkRadio/index.jsx
index 088ed0e..587fef6 100644
--- a/src/components/normalform/modalform/mkRadio/index.jsx
+++ b/src/components/normalform/modalform/mkRadio/index.jsx
@@ -19,10 +19,22 @@
 
   componentDidMount () {
     MKEmitter.addListener('mkFP', this.mkFormHandle)
+    MKEmitter.addListener('mkFC', this.mkFormControl)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
+  }
+
+  UNSAFE_componentWillReceiveProps (nextProps) {
+    const { config } = this.state
+
+    if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) {
+      this.setState({
+        config: fromJS(nextProps.config).toJS(),
+        options: fromJS(nextProps.config.options).toJS()
+      })
+    }
   }
 
   componentWillUnmount () {
@@ -30,6 +42,16 @@
       return
     }
     MKEmitter.removeListener('mkFP', this.mkFormHandle)
+    MKEmitter.removeListener('mkFC', this.mkFormControl)
+  }
+
+  mkFormControl = (type, field, value) => {
+    if (field !== this.props.config.field) return
+    
+    if (type === 'input') {
+      this.setState({value})
+      this.props.onChange(value, {})
+    }
   }
 
   mkFormHandle = (field, parentId) => {
@@ -45,7 +67,7 @@
       value: val
     })
 
-    this.props.onChange(val)
+    this.props.onChange(val, {})
 
     config.linkFields && config.linkFields.forEach((m, i) => {
       setTimeout(() => {

--
Gitblit v1.8.0