From 65e310e342effbb7d98bd5f97b3404a44e3c5233 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 21 十二月 2019 00:29:36 +0800 Subject: [PATCH] 2019-12-21 --- src/tabviews/commontable/mutilform/index.jsx | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/tabviews/commontable/mutilform/index.jsx b/src/tabviews/commontable/mutilform/index.jsx index 4ceb1e2..a2aacd7 100644 --- a/src/tabviews/commontable/mutilform/index.jsx +++ b/src/tabviews/commontable/mutilform/index.jsx @@ -114,9 +114,16 @@ formlist: formlist }, () => { if (action.setting && action.setting.focus) { - let _item = document.getElementById(action.setting.focus) - if (_item) { - _item.select() + try { + let _form = document.getElementById('main-form-box') + let _item = _form.getElementsByTagName('input') + _item = [..._item] + _item.forEach(input => { + if (!input || input.id !== action.setting.focus) return + input.select() + }) + } catch { + console.warn('琛ㄥ崟鑾峰彇澶辫触锛�') } } }) @@ -202,7 +209,7 @@ <Col span={24 / cols} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, { - initialValue: item.initval || 'text', + initialValue: item.initval || '', rules: [ { required: item.required === 'true', @@ -426,7 +433,7 @@ } } return ( - <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="form-box"> + <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box"> <Row gutter={24}>{this.getFields()}</Row> </Form> ) -- Gitblit v1.8.0