| | |
| | | formlist: null, |
| | | openType: null, |
| | | interType: null, |
| | | expand: false |
| | | reqOptionSgl: [{ |
| | | MenuID: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptions: [{ |
| | | MenuID: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptionsMutil: [{ |
| | | MenuID: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }, { |
| | | MenuID: 'required', |
| | | text: this.props.dict['header.form.required'] |
| | | }, { |
| | | MenuID: 'requiredOnce', |
| | | text: this.props.dict['header.form.requiredOnce'] |
| | | }] |
| | | } |
| | | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _opentype = this.props.formlist.filter(form => form.key === 'OpenType')[0].initVal |
| | | let _intertype = this.props.formlist.filter(form => form.key === 'intertype')[0].initVal |
| | | let _options = null |
| | | if (_opentype === 'innerpage') { // 新页面(内部),可选模板 |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'outerpage') { // 新页面(外部),需要页面地址 |
| | | _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'blank' || _opentype === 'tab' || _opentype === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } |
| | | this.setState({ |
| | | openType: _opentype, |
| | | interType: _intertype, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'class') { |
| | | item.options = btnClasses |
| | | } else if (item.key === 'icon') { |
| | | item.options = btnIcons |
| | | } else if (item.key === 'Ot') { |
| | | if (_opentype === 'innerpage') { |
| | | item.options = this.state.reqOptionSgl |
| | | } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(_opentype)) { |
| | | item.options = this.state.reqOptions |
| | | } else { |
| | | item.options = this.state.reqOptionsMutil |
| | | } |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'OpenType') { |
| | | let _options = null |
| | | if (value === 'newpage') { |
| | | if (value === 'innerpage') { |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (value === 'outerpage') { |
| | | _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] |
| | | } else if (value === 'blank' || value === 'tab' || value === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | this.setState({ |
| | | openType: value, |
| | | expand: false, |
| | | interType: 'inner', |
| | | formlist: this.state.formlist.map(item => { |
| | | if (_options) { |
| | | item.hidden = !_options.includes(item.key) |
| | | if (item.key === 'intertype') { |
| | | item.initVal = 'inner' |
| | | item.initVal = this.state.interType |
| | | } |
| | | item.readonly = ['interface', 'outerFunc', 'callbackFunc'].includes(item.key) |
| | | } |
| | | if (item.key === 'Ot') { |
| | | if (value === 'innerpage') { |
| | | item.options = this.state.reqOptionSgl |
| | | item.initVal = 'requiredSgl' |
| | | item.hidden = true |
| | | } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(value)) { |
| | | item.options = this.state.reqOptions |
| | | item.initVal = 'requiredSgl' |
| | | item.hidden = true |
| | | } else { |
| | | item.options = this.state.reqOptionsMutil |
| | | } |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (!['innerpage', 'outerpage', 'blank', 'tab', 'pop', 'popview'].includes(value)) return |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'Ot') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | onChange = (e, key) => { |
| | | let value = e.target.value |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (value === 'inner') { |
| | | item.readonly = ['interface', 'outerFunc', 'callbackFunc'].includes(item.key) |
| | | } else { |
| | | item.readonly = false |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | |
| | | if (!err) { |
| | | values.id = this.props.card.id |
| | | values.uuid = this.props.card.uuid |
| | | if (!this.state.expand) { |
| | | values.intertype = 'inner' |
| | | } |
| | | resolve({ |
| | | type: 'action', |
| | | values |
| | |
| | | }) |
| | | } |
| | | |
| | | toggle = () => { |
| | | let expand = !this.state.expand |
| | | let _options = null |
| | | if (expand) { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | if (!expand) { |
| | | this.setState({ |
| | | expand: !this.state.expand, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'intertype') { |
| | | item.initVal = 'inner' |
| | | } |
| | | item.readonly = ['interface', 'outerFunc', 'callbackFunc'].includes(item.key) |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | expand: !this.state.expand, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _opentype = this.props.formlist.filter(form => form.key === 'OpenType')[0].initVal |
| | | let _intertype = this.props.formlist.filter(form => form.key === 'intertype')[0].initVal |
| | | let _options = null |
| | | if (_opentype === 'newpage') { |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'blank' || _opentype === 'tab' || _opentype === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } |
| | | this.setState({ |
| | | openType: _opentype, |
| | | interType: _intertype, |
| | | expand: _intertype === 'outer' ? true : false, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'class') { |
| | | item.options = btnClasses |
| | | } else if (item.key === 'icon') { |
| | | item.options = btnIcons |
| | | } |
| | | if (_intertype === 'inner') { |
| | | item.readonly = ['interface', 'outerFunc', 'callbackFunc'].includes(item.key) |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { openType } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-action-form" id="winter"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | {openType !== 'newpage' && openType !== 'blank' && openType !== 'tab' && openType !== 'popview' && <Row> |
| | | <Col span={24} style={{ textAlign: 'right' }}> |
| | | <span className="superconfig" onClick={this.toggle}> |
| | | 高级设置 <Icon type={this.state.expand ? 'up' : 'down'} /> |
| | | </span> |
| | | </Col> |
| | | </Row>} |
| | | </Form> |
| | | ) |
| | | } |