| | |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | menu: PropTypes.object, |
| | | config: PropTypes.object, |
| | | inputSubmit: PropTypes.any // 回车提交事件 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict, menu } = this.props |
| | | const { menu } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, setting, datatype, usefulFields } = this.state |
| | | |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '表名!' |
| | | message: '请输入表名!' |
| | | }, |
| | | { |
| | | max: 50, |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={dict['header.menu.datasource']}> |
| | | <Form.Item label="数据来源"> |
| | | {getFieldDecorator('datatype', { |
| | | initialValue: setting.datatype || 'query' |
| | | })( |
| | | <Radio.Group onChange={this.sourceChange}> |
| | | <Radio value="maintable">{dict['header.menu.maintable']}</Radio> |
| | | <Radio value="query">{dict['header.menu.query']}</Radio> |
| | | <Radio value="maintable">主表</Radio> |
| | | <Radio value="query">查询</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {datatype === 'query' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.intertype']}> |
| | | <Form.Item label="接口类型"> |
| | | {getFieldDecorator('interType', { |
| | | initialValue: interType |
| | | })( |
| | | <Radio.Group onChange={this.onChange}> |
| | | <Radio value="inner">{dict['model.interface.inner']}</Radio> |
| | | <Radio value="outer">{dict['model.interface.outer']}</Radio> |
| | | <Radio value="inner">内部</Radio> |
| | | <Radio value="outer">外部</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.sysInterface']}> |
| | | <Form.Item label="系统接口"> |
| | | {getFieldDecorator('sysInterface', { |
| | | initialValue: setting.sysInterface || 'false' |
| | | })( |
| | | <Radio.Group onChange={this.onSysChange}> |
| | | <Radio value="true">{dict['model.true']}</Radio> |
| | | <Radio value="false">{dict['model.false']}</Radio> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.interface']}> |
| | | <Form.Item label="接口地址"> |
| | | {getFieldDecorator('interface', { |
| | | initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + dict['header.form.interface'] + '!' |
| | | message: '请输入接口地址!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" overlayClassName="middle" title={`可自定义数据处理函数,函数名称需以${usefulFields.join(', ')}等字符开始;未设置时会调用系统函数,使用系统函数需完善数据源。`}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {dict['header.form.innerFunc']} |
| | | 内部函数 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('innerFunc', { |
| | |
| | | <Form.Item help={'数据ID:' + menu.MenuID} label={ |
| | | <Tooltip placement="topLeft" title="使用系统函数时,需填写数据源,自定义函数时,可忽略。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {'数据源'} |
| | | 数据源 |
| | | </Tooltip> |
| | | } className="textarea"> |
| | | {getFieldDecorator('dataresource', { |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | <Form.Item label="外部函数"> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: setting.outerFunc || '', |
| | | rules: [ |