| | |
| | | formlist: null, // 表单信息 |
| | | interType: null, // 接口类型:内部、外部 |
| | | procMode: null, // 参数方式 |
| | | linkmenu: null |
| | | linkmenu: null, |
| | | callbackType: null |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | let _intertype = card.intertype || 'system' // 接口类型 |
| | | let _procMode = card.procMode || 'system' // 参数请求方式 |
| | | let _callbackType = card.callbackType || 'script' |
| | | |
| | | let _options = this.getOptions(_intertype, _procMode, card.linkmenu) |
| | | let _options = this.getOptions(_intertype, _procMode, card.linkmenu, _callbackType) |
| | | |
| | | this.setState({ |
| | | interType: _intertype, |
| | | procMode: _procMode, |
| | | callbackType: _callbackType, |
| | | linkmenu: card.linkmenu, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'innerFunc' && _procMode === 'inner') { |
| | |
| | | }) |
| | | } |
| | | |
| | | getOptions = (_intertype, _procMode, linkmenu) => { |
| | | getOptions = (_intertype, _procMode, linkmenu, _callbackType) => { |
| | | const { card } = this.props |
| | | |
| | | if (card.type === 'prev') { |
| | |
| | | |
| | | if (_intertype === 'custom') { |
| | | _options.pop() |
| | | _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross') |
| | | _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') |
| | | if (_procMode === 'system') { |
| | | _options.push('sql', 'sqlType') |
| | | } else { |
| | | _options.push('innerFunc') |
| | | } |
| | | if (_callbackType === 'func') { |
| | | _options.push('callbackFunc') |
| | | } else if (_callbackType !== 'none') { |
| | | _options.push('cbTable') |
| | | } |
| | | } else if (_intertype === 'outer') { |
| | | _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') |
| | | _options.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType') |
| | | if (_procMode === 'system') { |
| | | _options.push('sql', 'sqlType') |
| | | } else if (_procMode === 'inner') { |
| | | _options.push('innerFunc') |
| | | } |
| | | if (_callbackType === 'func') { |
| | | _options.push('callbackFunc') |
| | | } else if (_callbackType !== 'none') { |
| | | _options.push('cbTable') |
| | | } |
| | | |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('innerFunc') |
| | | } else { |
| | |
| | | * 3、切换标签类型,重置可选标签 |
| | | */ |
| | | optionChange = (key, value) => { |
| | | const { procMode, linkmenu } = this.state |
| | | const { procMode, linkmenu, callbackType } = this.state |
| | | |
| | | if (key === 'intertype') { |
| | | let _options = this.getOptions(value, procMode, linkmenu) |
| | | let _options = this.getOptions(value, procMode, linkmenu, callbackType) |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | |
| | | }) |
| | | }) |
| | | } else if (key === 'procMode') { |
| | | let _options = this.getOptions(this.state.interType, value, linkmenu) |
| | | let _options = this.getOptions(this.state.interType, value, linkmenu, callbackType) |
| | | |
| | | this.setState({ |
| | | procMode: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'innerFunc') { |
| | | item.required = true |
| | | if (item.key === 'procMode') { |
| | | item.initVal = value |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'linkmenu') { |
| | | let _options = this.getOptions(this.state.interType, procMode, value) |
| | | let _options = this.getOptions(this.state.interType, procMode, value, callbackType) |
| | | |
| | | this.setState({ |
| | | linkmenu: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'callbackType') { |
| | | let _options = this.getOptions(this.state.interType, procMode, linkmenu, value) |
| | | |
| | | this.setState({ |
| | | callbackType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'callbackType') { |
| | | item.initVal = value |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType } = this.state |
| | | const { interType, callbackType } = this.state |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'output') { |
| | | if (interType === 'system') { |
| | | if (interType === 'system' || ((interType === 'outer' || interType === 'custom') && callbackType === 'script')) { |
| | | _rules = [{ |
| | | pattern: /^@[0-9a-zA-Z_]+@?$/, |
| | | message: '变量以@符开头,可使用字母、数字以及_' |