From 0c1a33a33b45fc3265cb7fef20beb48407cd6c98 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 八月 2023 14:54:06 +0800 Subject: [PATCH] 2023-08-24 --- src/menu/datasource/verifycard/settingform/index.jsx | 165 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 144 insertions(+), 21 deletions(-) diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 7f8ddb1..6d5fa3e 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -8,12 +8,14 @@ import Utils from '@/utils/utils.js' import MenuUtils from '@/utils/utils-custom.js' import CodeMirror from '@/templates/zshare/codemirror' +import KeyInterface from '@/components/keyInterface' import './index.scss' const { TextArea } = Input class SettingForm extends Component { static propTpyes = { + updateStatus: PropTypes.func, config: PropTypes.object, // 缁勪欢閰嶇疆 setting: PropTypes.object, // 鏁版嵁婧愰厤缃� columns: PropTypes.array, // 鍒楄缃� @@ -25,16 +27,24 @@ modules: [], innerRules: [], innertip: '', + MenuType: '', ismain: false } UNSAFE_componentWillMount () { const { config, setting } = this.props - let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, config.uuid, window.GLOB.customMenu.interfaces) + let menu = window.GLOB.customMenu + let MenuType = '' + + if (menu.parentId === 'BillPrintTemp') { + MenuType = 'billPrint' + } + + let modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces) let ismain = false - if (window.GLOB.customMenu.Template === 'BaseTable') { + if (menu.Template === 'BaseTable') { ismain = config.name === '涓昏〃' } @@ -80,15 +90,24 @@ } } - this.setState({modules, innerRules, innertip, setting: _setting, ismain}) + this.setState({modules, innerRules, innertip, setting: _setting, ismain, MenuType}) } handleConfirm = () => { + const { config } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { values.sync = values.sync || 'false' + + if (['navbar', 'balcony', 'menubar', 'interface'].includes(config.type)) { + values.onload = 'true' + } + + if (values.interType === 'system' && values.onload === 'false') { + values.sync = 'false' + } // 鏁版嵁婧愬墠绔獙璇� if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { @@ -120,6 +139,14 @@ notification.warning({ top: 92, message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜板瓧绗� -- 锛屾敞閲婅鐢� /*鍐呭*/', + duration: 5 + }) + reject() + return + } else if (/,,/ig.test(values.dataresource)) { + notification.warning({ + top: 92, + message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜拌繛缁殑鑻辨枃閫楀彿锛�,,锛�', duration: 5 }) reject() @@ -156,12 +183,13 @@ if (key === 'sysInterface' && value === 'true') { this.props.form.setFieldsValue({interface: window.GLOB.mainSystemApi}) } + this.props.updateStatus(setting) } render() { const { columns, config } = this.props const { getFieldDecorator } = this.props.form - const { setting, modules, innerRules, innertip } = this.state + const { setting, modules, innerRules, innertip, MenuType } = this.state const formItemLayout = { labelCol: { @@ -205,8 +233,8 @@ message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!' }, { - pattern: /^[a-zA-Z@_]+$/, - message: '琛ㄥ悕鍙彲浣跨敤瀛楁瘝浠ュ強_' + pattern: /^[a-zA-Z0-9@_]+$/, + message: '琛ㄥ悕鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' } ] })(<Input placeholder={''} autoComplete="off" />)} @@ -232,9 +260,9 @@ </Col> {setting.interType === 'outer' ? <Col span={8}> <Form.Item label={ - <Tooltip placement="topLeft" title="鍗曠偣鐧诲綍绯荤粺"> + <Tooltip placement="topLeft" title="涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�"> <QuestionCircleOutlined className="mk-form-tip" /> - 绯荤粺鎺ュ彛 + 绯荤粺绫诲瀷 </Tooltip> }> {getFieldDecorator('sysInterface', { @@ -242,13 +270,14 @@ rules: [ { required: true, - message: '璇烽�夋嫨鏄惁浣跨敤绯荤粺鎺ュ彛!' + message: '璇烽�夋嫨绯荤粺绫诲瀷!' } ] })( <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'sysInterface')}}> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> + <Radio value="false">涓氬姟</Radio> + <Radio value="true">鍗曠偣</Radio> + <Radio value="external">澶栭儴</Radio> </Radio.Group>)} </Form.Item> </Col> : null} @@ -271,7 +300,7 @@ })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} - {setting.interType === 'outer' ? <Col className="outer-interface" span={24}> + {setting.interType === 'outer' && setting.sysInterface !== 'external' ? <Col className="outer-interface" span={24}> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || (setting.sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), @@ -284,8 +313,21 @@ })(<TextArea rows={2} readOnly={setting.sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {setting.interType === 'outer' && setting.sysInterface !== 'true' ? <Col className="outer-interface" span={24}> - <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃"> + {setting.interType === 'outer' && setting.sysInterface === 'external' ? <Col className="outer-interface" span={24}> + <Form.Item label="鎺ュ彛鍦板潃"> + {getFieldDecorator('exInterface', { + initialValue: setting.exInterface, + rules: [ + { + required: true, + message: '璇风紪杈戞帴鍙e湴鍧�!' + } + ] + })(<KeyInterface type="develop"/>)} + </Form.Item> + </Col> : null} + {setting.interType === 'outer' && setting.sysInterface === 'false' ? <Col className="outer-interface" span={24}> + <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 姝e紡鍦板潃 </Tooltip> @@ -293,6 +335,17 @@ {getFieldDecorator('proInterface', { initialValue: setting.proInterface || '' })(<TextArea rows={2}/>)} + </Form.Item> + </Col> : null} + {setting.interType === 'outer' && setting.sysInterface === 'external' ? <Col className="outer-interface" span={24}> + <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 姝e紡鍦板潃 + </Tooltip> + }> + {getFieldDecorator('exProInterface', { + initialValue: setting.exProInterface || '' + })(<KeyInterface type="product"/>)} </Form.Item> </Col> : null} {setting.interType === 'outer' ? <Col span={8}> @@ -304,7 +357,7 @@ </Col> : null} {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={ - <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''锛涙煡璇㈡浛鎹㈢ $select@ -> /* 鎴� ''銆� @select$ -> */ 鎴� ''锛涚粺璁℃浛鎹㈢ $sum@ -> /* 鎴� ''銆� @sum$ -> */ 鎴� ''銆俙}> + <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''銆俙}> <QuestionCircleOutlined className="mk-form-tip" /> 鏁版嵁婧� </Tooltip> @@ -353,7 +406,12 @@ </Col> {/* 鏁扮粍鏁版嵁锛岄渶璁剧疆鎺掑簭瑙勫垯 */} {config.format === 'array' ? <Col span={8}> - <Form.Item label="榛樿鎺掑簭"> + <Form.Item label={ + <Tooltip placement="topLeft" title="濡傛灉鍦ㄨ嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡@pageSize@鎴朄orderBy@锛岃鍦ㄦ暟鎹簮涓崟鐙啓鎺掑簭璇彞銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 榛樿鎺掑簭 + </Tooltip> + }> {getFieldDecorator('order', { initialValue: setting.order || 'ID desc', rules: [ @@ -376,7 +434,7 @@ </Radio.Group>)} </Form.Item> </Col> : null} - {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> + {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -427,9 +485,9 @@ </Form.Item> </Col> : null} {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */} - {!['navbar', 'interface'].includes(config.type) && !['editable', 'basetable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') ? <Col span={8}> + {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}> <Form.Item label={ - <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}> + <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細濡傝彍鍗曟湭浣跨敤鍚庣缂撳瓨锛屽垯鏌ヨ璇彞澶т簬8000瀛楃鏃舵棤鏁堛��'}> <QuestionCircleOutlined className="mk-form-tip" /> 鍚屾鏌ヨ </Tooltip> @@ -483,14 +541,31 @@ {getFieldDecorator('onload', { initialValue: setting.onload || 'true' })( - <Radio.Group> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'onload')}}> <Radio value="true">鍔犺浇</Radio> <Radio value="false">涓嶅姞杞�</Radio> </Radio.Group> )} </Form.Item> </Col> : null} - {config.type === 'interface' ? <Col span={8}> + {config.type === 'interface' && ((setting.supModule && setting.supModule[0] === 'empty') || MenuType === 'billPrint') ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍒濆鍖栧姞杞藉皢鍦ㄩ〉闈㈠姞杞藉墠鎵ц銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍔犺浇鏂瑰紡 + </Tooltip> + }> + {getFieldDecorator('loadlevel', { + initialValue: setting.loadlevel || 'default' + })( + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'loadlevel')}}> + <Radio value="default">榛樿</Radio> + <Radio value="init">鍒濆鍖�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {config.type === 'interface' && MenuType !== 'billPrint' ? <Col span={8}> <Form.Item label="瀹氭椂鍣�"> {getFieldDecorator('timer', { initialValue: setting.timer || '' @@ -523,6 +598,54 @@ })(<InputNumber min={0} max={500} precision={0} />)} </Form.Item> </Col> : null} + {config.subtype === 'dualdatacard' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="瀛愯〃鍦ㄤ富琛ㄤ腑鐨勬暟鎹泦鍚嶇О銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 瀛愯〃瀛楁 + </Tooltip> + }> + {getFieldDecorator('subdata', { + initialValue: setting.subdata || 'sub_data', + rules: [ + { + required: true, + message: '璇疯緭鍏ラ粯璁ゆ帓搴�!' + } + ] + })(<Input placeholder={''} autoComplete="off" />)} + </Form.Item> + </Col> : null} + {config.subtype === 'dualdatacard' ? <Col span={8}> + <Form.Item label="瀛愯〃涓婚敭"> + {getFieldDecorator('subKey', { + initialValue: setting.subKey || '' + })( + <Select> + {this.props.subColumns.map((option, i) => + <Select.Option key={i} value={option.field}> + {option.label} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> : null} + {config.subtype === 'dualdatacard' ? <Col span={8}> + <Form.Item label="瀛愯〃BID"> + {getFieldDecorator('subBID', { + initialValue: setting.subBID || '' + })( + <Select> + {this.props.subColumns.map((option, i) => + <Select.Option key={i} value={option.field}> + {option.label} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> : null} </Row> </Form> </div> -- Gitblit v1.8.0