From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 200 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 139 insertions(+), 61 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index d0ef468..a086d83 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' +import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Typography } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' @@ -12,51 +12,52 @@ const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const { TextArea } = Input +const { Paragraph } = Typography const actionTypeOptions = { - pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle'], - prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle'], - exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output'], - excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError'], - excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'], - popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'clickouter'], - tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'linkmenu'], - innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'], - funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class'] + pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'], + prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'], + exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'hidden'], + excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'hidden'], + excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search', 'hidden'], + popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'clickouter', 'hidden'], + tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'linkmenu', 'hidden'], + innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position', 'hidden'], + funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class', 'hidden'] } class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.object, // 椤甸潰璁剧疆 formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 card: PropTypes.any, // 鎸夐挳淇℃伅 - inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 + inputSubmit: PropTypes.func, // 鍥炶溅鎻愪氦浜嬩欢 + updRecord: PropTypes.func } state = { formlist: null, // 琛ㄥ崟淇℃伅 requireOptions: [{ value: 'notRequired', - text: this.props.dict['header.form.notRequired'] + text: '涓嶉�夋嫨琛�' }, { value: 'requiredSgl', - text: this.props.dict['header.form.requiredSgl'] + text: '閫夋嫨鍗曡' }, { value: 'required', - text: this.props.dict['header.form.required'] + text: '閫夋嫨澶氳' }, { value: 'requiredOnce', - text: this.props.dict['header.form.requiredOnce'] + text: '澶氳鎷兼帴' }], insertUpdateOptions: [{ value: 'insert', - text: this.props.dict['header.form.action.insert'] + text: '娣诲姞' }, { value: 'update', - text: this.props.dict['header.form.action.update'] + text: '淇敼' }, { value: 'audit', - text: this.props.dict['header.form.action.audit'] + text: '瀹℃牳' }], deleteOptions: [{ value: 'LogicDelete', @@ -66,17 +67,17 @@ text: '鐗╃悊鍒犻櫎' }, { value: 'custom', - text: this.props.dict['header.form.custom'] + text: '鑷畾涔�' }], interTypeOptions: [{ value: 'system', - text: this.props.dict['model.interface.system'] + text: '绯荤粺' }, { value: 'inner', - text: this.props.dict['model.interface.inner'] + text: '鍐呴儴' }, { value: 'outer', - text: this.props.dict['model.interface.outer'] + text: '澶栭儴' }, { value: 'custom', text: '鑷畾涔�' @@ -126,6 +127,8 @@ console.warn('琛ㄥ崟focus澶辫触锛�') } } + + this.props.updRecord && this.props.updRecord(this.record) } getMutilOptions = () => { @@ -145,31 +148,59 @@ reOptions.intertype = this.state.interTypeOptions if (intertype === 'custom') { - shows.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross') + shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') - } else { + } else if (this.record.procMode === 'inner') { reRequired.innerFunc = true shows.push('innerFunc') + } + if (this.record.callbackType === 'func') { + shows.push('callbackFunc') + } else if (this.record.callbackType !== 'none') { + shows.push('cbTable') } reReadonly.interface = false reRequired.interface = true } else if (intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc', 'output') - reRequired.innerFunc = false + shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType', 'output') + // reRequired.innerFunc = false + if (this.record.procMode === 'system') { + shows.push('sql', 'sqlType') + } else if (this.record.procMode === 'inner') { + reRequired.innerFunc = true + shows.push('innerFunc') + } + if (this.record.callbackType === 'func') { + shows.push('callbackFunc') + } else if (this.record.callbackType !== 'none') { + shows.push('cbTable') + } if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false } - } else if (intertype === 'inner') { + } else if (intertype === 'inner') { // preFunc 鍓嶇疆鍑芥暟 shows.push('innerFunc', 'output') + + // positecgroup + if (window.GLOB.appkey === '20201102081641237BDDE0D5F2E98420BA7EC') { + shows.push('preFunc') + } + reRequired.innerFunc = true } else { shows.push('sql', 'sqlType', 'output') + } + + if (Ot === 'required') { + shows.push('progress') } if (this.record.sqlType === 'insert') { @@ -188,12 +219,15 @@ reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false + reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -206,12 +240,14 @@ reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') reRequired.innerFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -250,12 +286,15 @@ if (_funcType === 'print') { shows.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false + reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -266,6 +305,17 @@ } } else if (_funcType === 'closetab') { shows.push('refreshTab') + } else if (_funcType === 'megvii') { + shows.push('subFunc', 'progress') + } else if (_funcType === 'refund') { + shows.push('Ot', 'execSuccess', 'execError') + + reOptions.Ot = requireOptions.filter(op => op.value === 'requiredSgl') + } else if (_funcType === 'filezip') { + reOptions.Ot = requireOptions + reRequired.innerFunc = false + + shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey') } } @@ -327,25 +377,24 @@ if (value === 'pop' || value === 'prompt' || value === 'exec') { _fieldval.intertype = 'system' _fieldval.sqlType = '' - } else if (value === 'excelIn') { _fieldval.intertype = 'system' _fieldval.Ot = 'notRequired' - _fieldval.label = this.props.dict['model.form.excelIn'] + _fieldval.label = '瀵煎叆Excel' _fieldval.class = 'dgreen' this.record.Ot = 'notRequired' - this.record.label = this.props.dict['model.form.excelIn'] + this.record.label = '瀵煎叆Excel' this.record.class = 'dgreen' - - } else if (value === 'excelOut') { _fieldval.intertype = 'system' - _fieldval.label = this.props.dict['model.form.excelOut'] + _fieldval.label = '瀵煎嚭Excel' _fieldval.class = 'dgreen' + _fieldval.execSuccess = 'never' this.record.Ot = 'notRequired' - this.record.label = this.props.dict['model.form.excelOut'] + this.record.label = '瀵煎嚭Excel' this.record.class = 'dgreen' + this.record.execSuccess = 'never' } else if (value === 'popview') { _fieldval.display = 'modal' @@ -366,10 +415,10 @@ } if (value === 'excelIn') { - _fieldval.label = this.props.dict['model.form.excelIn'] + _fieldval.label = '瀵煎叆Excel' _fieldval.class = 'border-dgreen' } else if (value === 'excelOut') { - _fieldval.label = this.props.dict['model.form.excelOut'] + _fieldval.label = '瀵煎嚭Excel' _fieldval.class = 'dgreen' _fieldval.control = '' this.record.control = '' @@ -383,6 +432,8 @@ if (!['funcbutton', 'excelIn', 'excelOut'].includes(value)) { _fieldval.position = 'toolbar' } + + this.props.updRecord && this.props.updRecord(this.record) } else if (key === 'position') { if (value === 'grid') { _fieldval.Ot = 'requiredSgl' @@ -408,12 +459,14 @@ _fieldval.class = 'purple' } else if (value === 'audit') { _fieldval.label = '瀹℃牳' - _fieldval.Ot = 'requiredSgl' + _fieldval.Ot = 'required' _fieldval.class = 'primary' } else if (value === 'LogicDelete' || value === 'delete') { _fieldval.label = '鍒犻櫎' - _fieldval.Ot = 'requiredSgl' + _fieldval.Ot = 'required' _fieldval.class = 'danger' + } else if (value === 'custom') { + _fieldval.Ot = 'required' } if (this.record.position === 'grid') { @@ -437,6 +490,8 @@ } } else if (key === 'intertype') { this.record.sysInterface = 'false' + + this.props.updRecord && this.props.updRecord(this.record) } else if (key === 'sysInterface') { if (value === 'true') { _fieldval.interface = window.GLOB.mainSystemApi || '' @@ -480,7 +535,6 @@ } getFields() { - const { dict } = this.props const { getFieldDecorator } = this.props.form const fields = [] @@ -495,14 +549,19 @@ if (item.type === 'text') { rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] if (item.key === 'innerFunc') { - let str = '^(' + item.fields.join('|') + ')' + let str = item.fields && item.fields.length ? '^(' + item.fields.join('|') + ')' : '^' let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') rules.push( { pattern: _patten, message: formRule.func.innerMessage }, + { max: formRule.func.max, message: formRule.func.maxMessage } + ) + } else if (item.key === 'sql' || item.key === 'sheet') { + rules.push( + { pattern: /^[a-zA-Z0-9@_]+$/, message: '琛ㄥ悕鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' }, { max: formRule.func.max, message: formRule.func.maxMessage } ) } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { @@ -510,6 +569,24 @@ { pattern: formRule.func.pattern, message: formRule.func.message }, { max: formRule.func.max, message: formRule.func.maxMessage } ) + } else if (item.key === 'output') { + if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { + rules = [{ + pattern: /^@[0-9a-zA-Z_]+@?$/, + message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } else { + rules = [{ + pattern: /^[0-9a-zA-Z_]*$/, + message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } } else { rules.push({ max: formRule.input.max, message: formRule.input.message }) } @@ -517,13 +594,13 @@ content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> } else if (item.type === 'number') { rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] content = <InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/> } else if (item.type === 'select') { rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <Select @@ -541,7 +618,7 @@ </Select> } else if (item.type === 'radio') { rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}}> @@ -550,13 +627,13 @@ } else if (item.type === 'cascader') { initVal = item.initVal || [] rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/> } else if (item.type === 'icon') { rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <MkEditIcon options={['edit', 'hint', 'direction', 'normal', 'data']} allowClear/> @@ -564,7 +641,7 @@ span = 24 className = 'textarea' rules = [ - { required: item.readonly ? false : item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.readonly ? false : item.required, message: '璇疯緭鍏�' + item.label + '!' } ] content = <TextArea rows={2} readOnly={item.readonly}/> @@ -586,11 +663,21 @@ </Col> ) }) + + if (window.debugger && this.props.card.uuid) { + fields.push( + <Col span={12} key="uuid"> + <Form.Item label="鎸夐挳ID"> + <Paragraph copyable>{this.props.card.uuid}</Paragraph> + </Form.Item> + </Col> + ) + } return fields } handleConfirm = () => { - const { setting, card } = this.props + const { card } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -600,15 +687,6 @@ values.position = values.position || 'toolbar' if (values.OpenType === 'excelOut') { - if (values.intertype === 'system' && setting.interType !== 'system') { // 瀵煎嚭excel闇�浣跨敤鏌ヨ鏁版嵁婧� - notification.warning({ - top: 92, - message: '琛ㄦ牸鏁版嵁鏌ヨ鏈娇鐢ㄧ郴缁熷嚱鏁帮紝瀵煎嚭Excel涓嶅彲浣跨敤绯荤粺鍑芥暟锛�', - duration: 5 - }) - return - } - values.Ot = 'notRequired' } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d values.linkTab = Utils.getuuid() -- Gitblit v1.8.0