From c0e1a2f76bb28ab71e54d30ac2dda945fa1e4a7e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 七月 2024 11:51:35 +0800 Subject: [PATCH] 2024-07-02 --- src/components/normalform/modalform/index.jsx | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index e30a12a..59a1ea6 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -32,6 +32,7 @@ state = { formlist: [], // 琛ㄥ崟椤� + formId: '' } record = {} @@ -40,6 +41,15 @@ let record = {} let controlFields = {} let fieldMap = new Map() + let formId = (() => { + let uuid = [] + let _options = '0123456789abcdefghigklmnopqrstuv' + for (let i = 0; i < 19; i++) { + uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) + } + uuid = uuid.join('') + return uuid + })() let formlist = this.props.formlist.filter(item => { if (item.controlFields) { // 澶氬眰琛ㄥ崟鎺у埗 @@ -56,6 +66,7 @@ if (item.options) { item.oriOptions = fromJS(item.options).toJS() } + item.$formId = formId if (item.type === 'text') { let _rules = [{ @@ -162,7 +173,7 @@ this.record = record - this.setState({ formlist }) + this.setState({ formlist, formId }) } checkNumber = (rule, value, callback, item) => { @@ -385,7 +396,7 @@ } return ( - <Form {...formItemLayout} className="normal-form-field" id="normal-form-field"> + <Form {...formItemLayout} className="normal-form-field" id={this.state.formId}> <Row gutter={24}>{this.getFields()}</Row> </Form> ) -- Gitblit v1.8.0