| | |
| | | formlist: null, // 表单信息 |
| | | interType: null, // 接口类型:内部、外部 |
| | | procMode: null, // 参数方式 |
| | | linkmenu: null |
| | | } |
| | | |
| | | |
| | |
| | | let _intertype = card.intertype || 'system' // 接口类型 |
| | | let _procMode = card.procMode || 'system' // 参数请求方式 |
| | | |
| | | let _options = this.getOptions(_intertype, _procMode) |
| | | let _options = this.getOptions(_intertype, _procMode, card.linkmenu) |
| | | |
| | | this.setState({ |
| | | interType: _intertype, |
| | | procMode: _procMode, |
| | | linkmenu: card.linkmenu, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'innerFunc' && _procMode === 'inner') { |
| | | item.required = true |
| | |
| | | }) |
| | | } |
| | | |
| | | getOptions = (_intertype, _procMode) => { |
| | | getOptions = (_intertype, _procMode, linkmenu) => { |
| | | const { card } = this.props |
| | | |
| | | if (card.type === 'prev') { |
| | |
| | | } else if (card.type === 'next') { |
| | | return ['type', 'label', 'enable'] |
| | | } |
| | | let _options = ['type', 'label', 'intertype', 'syncComponent', 'linkmenu', 'open', 'enable', 'output'] // 选项列表 |
| | | let _options = ['type', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'enable', 'output', 'reload'] // 选项列表 |
| | | |
| | | if (_intertype === 'custom') { |
| | | _options.pop() |
| | |
| | | } else { |
| | | _options.push('sql', 'sqlType') |
| | | } |
| | | |
| | | if (linkmenu && linkmenu !== 'goback') { |
| | | _options.push('open') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | |
| | | * 3、切换标签类型,重置可选标签 |
| | | */ |
| | | optionChange = (key, value) => { |
| | | const { procMode } = this.state |
| | | const { procMode, linkmenu } = this.state |
| | | |
| | | if (key === 'intertype') { |
| | | let _options = this.getOptions(value, procMode) |
| | | let _options = this.getOptions(value, procMode, linkmenu) |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | |
| | | }) |
| | | }) |
| | | } else if (key === 'procMode') { |
| | | let _options = this.getOptions(this.state.interType, value) |
| | | let _options = this.getOptions(this.state.interType, value, linkmenu) |
| | | |
| | | this.setState({ |
| | | procMode: value, |
| | |
| | | if (item.key === 'innerFunc') { |
| | | item.required = true |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'linkmenu') { |
| | | let _options = this.getOptions(this.state.interType, procMode, value) |
| | | |
| | | this.setState({ |
| | | linkmenu: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType } = this.state |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden || item.forbid) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | if (item.type === 'text') { |
| | | let _rules = [] |
| | | if (item.key === 'innerFunc') { |
| | | let str = '^(' + item.fields.join('|') + ')' |
| | |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'output') { |
| | | if (interType === 'system') { |
| | | _rules = [{ |
| | | pattern: /^@[0-9a-zA-Z_]*$/, |
| | | message: '变量以@符开头,可使用字母、数字以及_' |
| | | }, { |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | } else { |
| | | _rules = [{ |
| | | pattern: /^[0-9a-zA-Z_]*$/, |
| | | message: '字段可使用字母、数字以及_' |
| | | }, { |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | } |
| | | } else { |
| | | _rules = [{ |
| | | max: formRule.input.max, |
| | |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={0} max={10000} precision={0} />)} |
| | | })(<InputNumber min={0} max={10000} precision={0} onPressEnter={this.handleSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Form.Item help={item.help || null} label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.optionChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | allowClear={item.allowClear} |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="menu-action-list-form" id="winter"> |
| | | <Form {...formItemLayout} className="menu-form-action-list" id="winter"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |