From 1bec8d69cf14bd88591eee5b0320c5c8f6c25a08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 08 三月 2024 21:19:31 +0800
Subject: [PATCH] Merge branch 'master' into positec

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

diff --git a/src/components/normalform/modalform/mkRadio/index.jsx b/src/components/normalform/modalform/mkRadio/index.jsx
index aab46a3..ddebf3e 100644
--- a/src/components/normalform/modalform/mkRadio/index.jsx
+++ b/src/components/normalform/modalform/mkRadio/index.jsx
@@ -4,7 +4,6 @@
 import { Radio } from 'antd'
 
 import MKEmitter from '@/utils/events.js'
-import './index.scss'
 
 class MKRadio extends Component {
   static propTpyes = {
@@ -20,6 +19,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('mkFP', this.mkFormHandle)
+    MKEmitter.addListener('mkFC', this.mkFormControl)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -31,6 +31,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) => {
@@ -46,7 +56,7 @@
       value: val
     })
 
-    this.props.onChange(val)
+    this.props.onChange(val, {})
 
     config.linkFields && config.linkFields.forEach((m, i) => {
       setTimeout(() => {
@@ -81,11 +91,11 @@
   }
 
   render() {
-    const { value, options } = this.state
+    const { value, options, config } = this.state
 
     return (
-      <Radio.Group value={value} onChange={this.onChange}>
-        {options.map(option => <Radio key={option.value} value={option.value}>{option.label}</Radio>)}
+      <Radio.Group style={{whiteSpace: 'nowrap'}} disabled={config.disabled} value={value} onChange={this.onChange}>
+        {options.map(option => <Radio key={option.value} disabled={option.disabled} value={option.value}>{option.label}</Radio>)}
       </Radio.Group>
     )
   }

--
Gitblit v1.8.0