From c7df5603e14b98d6f80da425fab31d30574ca417 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 22 一月 2021 19:10:18 +0800 Subject: [PATCH] 2021-01-22 --- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 98 ++++++++++++++++++++++++++++-------------------- 1 files changed, 57 insertions(+), 41 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index 6516f5f..315b7a3 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -69,6 +69,19 @@ }, { value: 'custom', text: this.props.dict['header.form.custom'] + }], + interTypeOptions: [{ + value: 'system', + text: this.props.dict['model.interface.system'] + }, { + value: 'inner', + text: this.props.dict['model.interface.inner'] + }, { + value: 'outer', + text: this.props.dict['model.interface.outer'] + }, { + value: 'custom', + text: '鑷畾涔�' }] } @@ -77,7 +90,7 @@ const { card } = this.props let _opentype = card.OpenType // 鎵撳紑鏂瑰紡 - let _tabType = card.tabType || 'SubTable' // 鎸夐挳涓哄脊绐楋紙鏍囩锛夋椂锛屾爣绛剧殑绫诲瀷 + // let _tabType = card.tabType || 'SubTable' // 鎸夐挳涓哄脊绐楋紙鏍囩锛夋椂锛屾爣绛剧殑绫诲瀷 let _intertype = card.intertype || 'system' // 鎺ュ彛绫诲瀷 let _funcType = card.funcType || '' // 鍔熻兘鎸夐挳榛樿绫诲瀷 let _tabTemplate = card.tabTemplate // 鎸夐挳涓烘爣绛鹃〉鏃讹紝鏍囩绫诲瀷锛氫笁绾ц彍鍗曟垨琛ㄥ崟鏍囩椤� @@ -90,7 +103,7 @@ _opentype = 'tab' } - let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) + let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable') let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate) this.setState({ @@ -104,6 +117,9 @@ item.options = btnClasses } else if (item.key === 'icon') { item.options = btnIcons + } else if (item.key === 'intertype') { + let iscustom = ['pop', 'prompt', 'exec'].includes(_opentype) + item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom')) } else if (item.key === 'Ot') { if (card.position === 'grid' || _pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛� item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value)) @@ -188,7 +204,9 @@ } } } else if (_opentype !== 'popview') { // 鎵撳紑鏂瑰紡涓嶆槸寮圭獥椤甸潰鏃� - if (_intertype === 'outer') { + if (_intertype === 'custom') { + _options.push('sql', 'sqlType', 'innerFunc', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method') + } else if (_intertype === 'outer') { _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') } else if (_intertype === 'inner') { _options.push('innerFunc') @@ -205,24 +223,27 @@ } /** - * @description 涓嬫媺鍒囨崲 - * 1銆佹墦寮�鏂瑰紡鍒囨崲锛岄噸缃彲瑙佽〃鍗曞拰琛ㄥ崟鍊� - * 2銆佹樉绀轰綅缃垏鎹紝閲嶇疆閫夋嫨琛� - * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛� + * @description 鍒囨崲 */ - openTypeChange = (key, value) => { + optionChange = (key, value) => { + const { openType, funcType } = this.state const { card } = this.props if (key === 'OpenType') { - let _options = this.getOptions(value, this.state.interType, this.state.funcType, this.state.pageTemplate, card.tabTemplate) + let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate) let _fieldval = {} let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) + if (item.key === 'intertype') { + let iscustom = ['pop', 'prompt', 'exec'].includes(value) + item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom')) + } + if (item.hidden) return item if (item.key === 'intertype') { - _fieldval.intertype = this.state.interType + _fieldval.intertype = 'system' } else if (item.key === 'Ot') { if (this.state.position === 'grid' || this.state.pageTemplate === 'pay') { item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value)) @@ -253,6 +274,8 @@ this.setState({ openType: value, + funcType: '', + intertype: 'system', formlist: _formlist }, () => { if (value === 'excelIn') { @@ -275,10 +298,10 @@ if (value === 'grid' || this.state.pageTemplate === 'pay') { item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value)) _fieldval.Ot = 'requiredSgl' - } else if (this.state.openType === 'innerpage' && this.state.pageTemplate === 'billprint') { + } else if (openType === 'innerpage' && this.state.pageTemplate === 'billprint') { item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value)) _fieldval.Ot = 'requiredSgl' - } else if (['innerpage', 'blank', 'tab', 'popview'].includes(this.state.openType)) { + } else if (['innerpage', 'blank', 'tab', 'popview'].includes(openType)) { item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) _fieldval.Ot = 'requiredSgl' } else { @@ -290,26 +313,26 @@ }, () => { this.props.form.setFieldsValue(_fieldval) }) - } else if (key === 'tabType') { - let _tabs = this.props.tabs.filter(tab => tab.type === value) - let _fieldval = {} + // } else if (key === 'tabType') { + // let _tabs = this.props.tabs.filter(tab => tab.type === value) + // let _fieldval = {} - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'linkTab') { - item.options = [ - { - value: '', - text: '鏂板缓' - }, - ..._tabs - ] - } - return item - }) - }, () => { - this.props.form.setFieldsValue(_fieldval) - }) + // this.setState({ + // formlist: this.state.formlist.map(item => { + // if (item.key === 'linkTab') { + // item.options = [ + // { + // value: '', + // text: '鏂板缓' + // }, + // ..._tabs + // ] + // } + // return item + // }) + // }, () => { + // this.props.form.setFieldsValue(_fieldval) + // }) } else if (key === 'funcType') { let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate) let _fieldval = {} @@ -405,14 +428,7 @@ return item }) }) - } - } - - onChange = (e, key) => { - const { openType, funcType } = this.state - let value = e.target.value - - if (key === 'intertype') { + } else if (key === 'intertype') { let _options = this.getOptions(openType, value, funcType, '', '') this.setState({ @@ -560,7 +576,7 @@ <Select showSearch filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value) => {this.openTypeChange(item.key, value)}} + onChange={(value) => {this.optionChange(item.key, value)}} getPopupContainer={() => document.getElementById('winter')} > {item.options.map((option, index) => @@ -586,7 +602,7 @@ } ] })( - <Radio.Group onChange={(e) => {this.onChange(e, item.key)}} disabled={item.readonly}> + <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}} disabled={item.readonly}> { item.options.map(option => { return ( -- Gitblit v1.8.0