From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- src/menu/components/share/actioncomponent/actionform/index.jsx | 79 +++++++++++++++++++++++++++------------ 1 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index c33e8c4..58d7a25 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -2,18 +2,20 @@ import PropTypes from 'prop-types' import { fromJS } from 'immutable' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' -import { btnIcons, btnCustomClasses, formRule } from '@/utils/option.js' +import { btnCustomClasses, formRule } from '@/utils/option.js' +import asyncComponent from '@/utils/asyncComponent' import './index.scss' const { TextArea } = Input +const MkIcon = asyncComponent(() => import('@/components/mkIcon')) const actionTypeOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'resetPageIndex', 'pagination', 'search', 'width'], - popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', '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'] @@ -35,6 +37,8 @@ interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮� funcType: null, // 鍔熻兘绫诲瀷 procMode: null, // 鍙傛暟鏂瑰紡 + pageTemplate: null, + appType: sessionStorage.getItem('appType'), Ot: null, requireOptions: [{ value: 'notRequired', @@ -91,10 +95,11 @@ let _opentype = card.OpenType // 鎵撳紑鏂瑰紡 let _intertype = card.intertype || 'system' // 鎺ュ彛绫诲瀷 let _funcType = card.funcType || '' // 鍔熻兘鎸夐挳榛樿绫诲瀷 - let _procMode = card.procMode || 'system' // 鍙傛暟璇锋眰鏂瑰紡 - let _Ot = card.Ot || 'requiredSgl' // 鍙傛暟璇锋眰鏂瑰紡 + let _procMode = card.procMode || 'system' + let _Ot = card.Ot || 'requiredSgl' + let _pageTemplate = card.pageTemplate || '' - let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _procMode, _Ot) + let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) this.setState({ Ot: _Ot, @@ -102,6 +107,7 @@ interType: _intertype, procMode: _procMode, funcType: _funcType, + pageTemplate: _pageTemplate, formlist: this.props.formlist.map(item => { if (item.key === 'class') { item.options = btnCustomClasses @@ -110,12 +116,10 @@ } 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 === 'icon') { - item.options = btnIcons } else if (item.key === 'Ot') { if (type === 'card') { item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) - } else if (card.pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛� + } 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)) @@ -165,15 +169,20 @@ } } else if (_opentype === 'funcbutton') { if (_funcType === 'print') { - _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex') + _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'controlField', 'controlVal') if (_intertype === 'outer') { _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') } else if (_intertype === 'inner') { _options.push('innerFunc') } + } else if (_funcType === 'mkBinding' || _funcType === 'mkUnBinding') { + _options.push('execSuccess', 'execError') + } else if (_funcType === 'closetab') { + _options.push('refreshTab') } } else if (_opentype !== 'popview' && _opentype !== 'tab') { if (_intertype === 'custom') { + _options = _options.filter(m => m !== 'output') _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross') if (_procMode === 'system') { _options.push('sql', 'sqlType') @@ -189,7 +198,7 @@ } } - if (_Ot !== 'notRequired' && _opentype !== 'excelOut') { + if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') { _options.push('controlField', 'controlVal') } if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) { @@ -220,13 +229,12 @@ */ optionChange = (key, value) => { const { card, type } = this.props - const { openType, procMode, Ot } = this.state + const { openType, procMode, Ot, pageTemplate } = this.state if (key === 'OpenType') { - let _options = this.getOptions(value, 'system', this.state.funcType, card.pageTemplate, 'system', Ot) + let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot) let _fieldval = {} - let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -258,6 +266,8 @@ item.options = this.state.insertUpdateOptions } _fieldval.sqlType = '' + } else if (item.key === 'pageTemplate') { + item.initVal = '' } return item @@ -267,6 +277,7 @@ openType: value, intertype: 'system', procMode: 'system', + pageTemplate: '', formlist: _formlist }, () => { if (value === 'excelIn') { @@ -280,7 +291,7 @@ this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'funcType') { - let _options = this.getOptions(openType, this.state.interType, value, card.pageTemplate, procMode, Ot) + let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot) let _fieldval = {} this.setState({ @@ -347,6 +358,7 @@ let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot) this.setState({ + pageTemplate: value, formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -367,7 +379,7 @@ this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'intertype') { - let _options = this.getOptions(openType, value, this.state.funcType, '', procMode, Ot) + let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot) this.setState({ interType: value, @@ -389,7 +401,7 @@ }) }) } else if (key === 'procMode') { - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', value, Ot) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot) this.setState({ procMode: value, @@ -403,7 +415,7 @@ }) }) } else if (key === 'Ot') { - let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', procMode, value) + let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value) this.setState({ Ot: value, @@ -523,7 +535,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 + } else if (item.type === 'select') { fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? @@ -543,13 +555,14 @@ })( <Select showSearch - filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} + allowClear={item.allowClear === true} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} onChange={(value) => {this.optionChange(item.key, value)}} getPopupContainer={() => document.getElementById('winter')} > {item.options.map((option, index) => - <Select.Option id={index} key={option.value || option.field} value={option.value || option.field}> - {item.key === 'icon' && option.value ? <Icon type={option.value} /> : ''} {option.text || option.label} + <Select.Option key={index} value={(option.value || option.field)}> + {(option.text || option.label)} </Select.Option> )} </Select> @@ -622,6 +635,24 @@ </Form.Item> </Col> ) + } else if (item.type === 'icon') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal, + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <MkIcon allowClear/> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'mcascader') { fields.push( <Col span={12} key={index}> -- Gitblit v1.8.0