From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 八月 2021 22:42:51 +0800
Subject: [PATCH] 2021-08-31

---
 src/components/normalform/index.jsx |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/components/normalform/index.jsx b/src/components/normalform/index.jsx
index 6c2d87a..de675fb 100644
--- a/src/components/normalform/index.jsx
+++ b/src/components/normalform/index.jsx
@@ -24,7 +24,7 @@
   }
 
   shouldComponentUpdate (nextProps, nextState) {
-    return !is(fromJS(this.state), fromJS(nextState))
+    return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.children), fromJS(nextProps.children))
   }
 
   trigger = () => {
@@ -55,32 +55,37 @@
     })
   }
 
+  cancel = () => {
+    this.setState({ visible: false })
+
+    this.props.cancel && this.props.cancel()
+  }
+
   render () {
-    const { title, width, children } = this.props
+    const { title, width, children, double } = this.props
     const { visible, dict, formlist } = this.state
 
     return (
-      <div className="normal-form-wrap">
-        <span onClick={this.trigger}>{children}</span>
+      <>
+        {!double ? <span onClick={this.trigger}>{children}</span> : <span onDoubleClick={this.trigger}>{children}</span>}
         <Modal
           wrapClassName="popview-modal"
           title={title}
           visible={visible}
           width={width}
           maskClosable={false}
-          okText={dict['model.submit']}
+          okText={dict['model.confirm']}
           onOk={this.submit}
-          onCancel={() => { this.setState({ visible: false }) }}
+          onCancel={this.cancel}
           destroyOnClose
         >
           <ModalForm
-            dict={dict}
             formlist={formlist}
             inputSubmit={this.submit}
             wrappedComponentRef={(inst) => this.Ref = inst}
           />
         </Modal>
-      </div>
+      </>
     )
   }
 }

--
Gitblit v1.8.0