From fbe8b1adf4b50323b7ea6ad09c810cb3e07a69b9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 04 二月 2020 11:47:38 +0800 Subject: [PATCH] 2020-02-04 --- src/templates/subtableconfig/settingform/index.jsx | 83 ++++++++++++++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index 0bb4886..a67d205 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -17,7 +17,8 @@ state = { interType: this.props.data.interType || 'inner', - columns: this.props.columns.filter(item => item.field && item.type !== 'colspan') + columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), + interReadonly: this.props.data.sysInterface === 'true' } handleConfirm = () => { @@ -44,10 +45,44 @@ }) } + /** + * @description 鍒囨崲鎺ュ彛绫诲瀷 + */ onChange = (e) => { this.setState({ interType: e.target.value + }, () => { + if (e.target.value === 'inner') return + + let _type = this.props.form.getFieldValue('sysInterface') + if (_type === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } }) + } + + onSysChange = (e) => { + if (e.target.value === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } } selectChange = (val) => { @@ -134,9 +169,21 @@ </Form.Item> </Col> {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.sysInterface']}> + {getFieldDecorator('sysInterface', { + initialValue: data.sysInterface || 'false' + })( + <Radio.Group onChange={this.onSysChange}> + <Radio value="true">{dict['header.form.true']}</Radio> + <Radio value="false">{dict['header.form.false']}</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: data.interface || '', + initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (data.interface || ''), rules: [ { required: true, @@ -145,6 +192,22 @@ { max: formRule.input.max, message: formRule.input.message + } + ] + })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.outerFunc']}> + {getFieldDecorator('outerFunc', { + initialValue: data.outerFunc || '', + rules: [ + { + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage } ] })(<Input placeholder="" autoComplete="off" />)} @@ -220,22 +283,6 @@ )} </Form.Item> </Col> - {interType === 'outer' ? <Col span={12}> - <Form.Item label={dict['header.form.outerFunc']}> - {getFieldDecorator('outerFunc', { - initialValue: data.outerFunc || '', - rules: [ - { - pattern: formRule.func.pattern, - message: formRule.func.message - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> : null} <Col span={12}> <Form.Item label="榛樿鎺掑簭"> {getFieldDecorator('order', { -- Gitblit v1.8.0