| | |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | // const { TextArea } = Input |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | interType: null, |
| | | interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', |
| | | columns: null, |
| | | currentTabs: null, |
| | | selectTabs: [] |
| | | selectTabs: [], |
| | | interReadonly: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | | let _columns = [] |
| | | let _interType = 'inner' |
| | | let _setting = config.setting |
| | | |
| | | try { |
| | | if (menu && menu.LongParam) { |
| | | _columns = menu.LongParam.columns.filter(item => item.field && item.type !== 'colspan') |
| | | config.groups.forEach(group => { |
| | | if (group.isDefault) { |
| | | let list = group.sublist.filter(item => !item.origin) |
| | | _columns = [..._columns, ...list] |
| | | } else { |
| | | _columns = [..._columns, ...group.sublist] |
| | | } |
| | | config.groups.forEach(group => { |
| | | let list = group.sublist.filter(item => item.field) |
| | | _columns = [..._columns, ...list] |
| | | }) |
| | | |
| | | let _colMap = new Map() |
| | |
| | | return true |
| | | } |
| | | }) |
| | | _interType = menu.LongParam.setting.interType |
| | | } catch { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | columns: _columns, |
| | | interType: _interType, |
| | | setting: _setting |
| | | setting: _setting, |
| | | interReadonly: _setting.sysInterface === 'true' |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, menu, usefulFields } = this.props |
| | | const { dict, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, setting } = this.state |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.sysInterface']}> |
| | | {getFieldDecorator('sysInterface', { |
| | | initialValue: setting.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: setting.interface || '', |
| | | initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (setting.interface || ''), |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={12}> |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={24}> |
| | | {/* {interType !== 'outer' ? <Col span={24}> |
| | | <Form.Item help={'数据ID:' + menu.MenuID} label={ |
| | | <Tooltip placement="topLeft" title="使用系统函数时,需填写数据源,自定义函数时,可忽略。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | initialValue: setting.dataresource |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> : null} */} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |