From 5223edbcccfed84a33a706e5637ee65a61f377aa Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 22 十二月 2021 18:00:39 +0800 Subject: [PATCH] 2021-12-22 --- src/menu/components/share/actioncomponent/actionform/index.jsx | 129 ++++++++++++++++++++++++++----------------- 1 files changed, 78 insertions(+), 51 deletions(-) diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 8bc29d8..d328729 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -9,17 +9,17 @@ import './index.scss' const { TextArea } = Input -const MkIcon = asyncComponent(() => import('@/components/mkIcon')) +const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const actionTypeOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], - excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'], - excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'], - popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'placement'], - tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'], - innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open'], - funcbutton: ['label', 'OpenType', 'funcType', 'show', 'icon', 'class', 'width'] + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'], + excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'], + excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'], + popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'syncComponent', 'clickouter'], + tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width'], + innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'open'], + funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width'] } class ActionForm extends Component { @@ -39,6 +39,7 @@ funcType: null, // 鍔熻兘绫诲瀷 procMode: null, // 鍙傛暟鏂瑰紡 control: '', + display: '', pageTemplate: null, appType: sessionStorage.getItem('appType'), Ot: null, @@ -67,10 +68,10 @@ }], deleteOptions: [{ value: 'LogicDelete', - text: this.props.dict['header.form.action.LogicDelete'] + text: '閫昏緫鍒犻櫎' }, { value: 'delete', - text: this.props.dict['header.form.action.delete'] + text: '鐗╃悊鍒犻櫎' }, { value: 'custom', text: this.props.dict['header.form.custom'] @@ -98,14 +99,16 @@ let _intertype = card.intertype || 'system' // 鎺ュ彛绫诲瀷 let _funcType = card.funcType || '' // 鍔熻兘鎸夐挳榛樿绫诲瀷 let _procMode = card.procMode || 'system' - let _Ot = card.Ot || 'requiredSgl' + let _display = card.display || 'modal' + let _Ot = card.Ot let _pageTemplate = card.pageTemplate || '' let control = card.control || '' - let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control) + let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control, _display) this.setState({ Ot: _Ot, + display: _display, control: control, openType: _opentype, interType: _intertype, @@ -129,18 +132,14 @@ let iscustom = ['pop', 'prompt', 'exec'].includes(_opentype) item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom')) } else if (item.key === 'Ot') { - if (type === 'card') { - if (card.sqlType === 'insert') { - item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value)) - } else { - item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) - } + if (card.sqlType === 'insert') { + item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value)) + } else if (type === 'card') { + item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) } else if (_pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛� item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value)) } else if (['innerpage', 'tab', 'popview', 'excelIn'].includes(_opentype)) { item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) - } else if (card.sqlType === 'insert') { - item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value)) } else { item.options = this.state.requireOptions } @@ -160,7 +159,7 @@ }) } - getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control) => { + getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control, _display) => { let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 閫夐」鍒楄〃 if (_opentype === 'innerpage') { // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴) @@ -200,7 +199,11 @@ } else if (_funcType === 'goBack') { _options.push('reload') } - } else if (_opentype !== 'popview' && _opentype !== 'tab') { + } else if (_opentype === 'popview') { + if (_display === 'drawer') { + _options.push('placement') + } + } else if (_opentype !== 'tab') { if (_intertype === 'custom') { _options = _options.filter(m => m !== 'output') _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross') @@ -223,9 +226,6 @@ if (_control) { _options.push('controlField', 'controlVal') } - } - if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) { - _options.push('swipe') } return _options @@ -251,11 +251,11 @@ * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛� */ optionChange = (key, value) => { - const { card, type } = this.props - const { openType, procMode, Ot, pageTemplate, control } = this.state + const { type } = this.props + const { openType, procMode, Ot, pageTemplate, control, display } = this.state if (key === 'OpenType') { - let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot, control) + let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot, control, 'modal') let _fieldval = {} let _formlist = this.state.formlist.map(item => { @@ -266,6 +266,8 @@ item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom')) } else if (item.key === 'control') { item.initVal = control + } else if (item.key === 'display') { + item.initVal = 'modal' } if (item.hidden) return item @@ -312,6 +314,7 @@ openType: value, intertype: 'system', procMode: 'system', + display: 'modal', pageTemplate: '', formlist: _formlist }, () => { @@ -326,7 +329,7 @@ this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'funcType') { - let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot, control) + let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot, control, display) let _fieldval = {} if (value === 'print') { @@ -367,49 +370,63 @@ }) } else if (key === 'sqlType') { let _fieldval = {} + let hasclass = true this.setState({ formlist: this.state.formlist.map(item => { - if (item.key === 'Ot' && type === 'card') { + if (item.key === 'Ot') { if (value === 'insert') { item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value)) - } else { + } else if (type === 'card') { item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) + } else { + item.options = this.state.requireOptions } - } else if (item.key === 'Ot' && value === 'insert') { - item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value)) - } else if (item.key === 'Ot') { - item.options = this.state.requireOptions + } else if (item.key === 'class') { + hasclass = item.forbid !== true } return item }) }, () => { if (value === 'insert') { _fieldval.label = '娣诲姞' - _fieldval.class = 'green' _fieldval.Ot = 'notRequired' + if (hasclass) { + _fieldval.class = 'green' + } else { + _fieldval.color = 'success' + } } else if (value === 'update') { _fieldval.label = '淇敼' - _fieldval.class = 'purple' _fieldval.Ot = 'requiredSgl' + if (hasclass) { + _fieldval.class = 'purple' + } else { + _fieldval.color = 'primary' + } + } else if (value === 'audit') { _fieldval.label = '瀹℃牳' - _fieldval.class = 'primary' _fieldval.Ot = 'requiredSgl' + if (hasclass) { + _fieldval.class = 'primary' + } else { + _fieldval.color = 'warning' + } } else if (value === 'LogicDelete' || value === 'delete') { _fieldval.label = '鍒犻櫎' - _fieldval.class = 'danger' _fieldval.Ot = 'requiredSgl' - } - - if (card.$type === 'tableButton') { // 琛ㄦ牸鎸夐挳 - delete _fieldval.Ot + if (hasclass) { + _fieldval.class = 'danger' + } else { + _fieldval.color = 'danger' + } } this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'pageTemplate') { let _fieldval = {} - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot, control) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot, control, display) this.setState({ pageTemplate: value, @@ -433,7 +450,7 @@ this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'intertype') { - let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot, control) + let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot, control, display) this.setState({ interType: value, @@ -455,7 +472,7 @@ }) }) } else if (key === 'procMode') { - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot, control) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot, control, display) this.setState({ procMode: value, @@ -469,7 +486,7 @@ }) }) } else if (key === 'Ot') { - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value, control) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value, control, display) this.setState({ Ot: value, @@ -479,10 +496,20 @@ }) }) } else if (key === 'control') { - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, value) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, value, display) this.setState({ control: value, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + return item + }) + }) + } else if (key === 'display') { + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, control, value) + + this.setState({ + display: value, formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) return item @@ -717,7 +744,7 @@ } ] })( - <MkIcon allowClear/> + <MkEditIcon options={['edit', 'hint', 'direction', 'normal', 'data']} allowClear/> )} </Form.Item> </Col> -- Gitblit v1.8.0