From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/components/normalform/index.jsx | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/normalform/index.jsx b/src/components/normalform/index.jsx index 5e1057e..c587960 100644 --- a/src/components/normalform/index.jsx +++ b/src/components/normalform/index.jsx @@ -3,10 +3,7 @@ import { is, fromJS } from 'immutable' import { Modal } from 'antd' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import ModalForm from './modalform' -import './index.scss' class NormalFormComponent extends Component { static propTpyes = { @@ -18,13 +15,12 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, visible: false, formlist: [] } 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,22 +51,28 @@ }) } + cancel = () => { + this.setState({ visible: false }) + + this.props.cancel && this.props.cancel() + } + render () { - const { title, width, children } = this.props - const { visible, dict, formlist } = this.state + const { title, width, children, double } = this.props + const { visible, 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.confirm']} + okText="纭畾" onOk={this.submit} - onCancel={() => { this.setState({ visible: false }) }} + onCancel={this.cancel} destroyOnClose > <ModalForm @@ -79,7 +81,7 @@ wrappedComponentRef={(inst) => this.Ref = inst} /> </Modal> - </div> + </> ) } } -- Gitblit v1.8.0