From c78051cc51032d4e29d35ca356d11d77a473eced Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 09 八月 2021 18:20:08 +0800 Subject: [PATCH] 2021-08-09 --- src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 94 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 81 insertions(+), 13 deletions(-) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index 53ea2eb..4c4b17a 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip, Icon, notification, Select } from 'antd' +import { Form, Row, Col, Input, Radio, Tooltip, Icon, notification, Select, InputNumber } from 'antd' import moment from 'moment' import Api from '@/api' @@ -19,11 +19,12 @@ setting: PropTypes.object, // 鏁版嵁婧愰厤缃� columns: PropTypes.array, // 鍒楄缃� scripts: PropTypes.array, // 鑷畾涔夎剼鏈� + updateStatus: PropTypes.func, // 鐘舵�佹洿鏂� } state = { interType: 'system', - procMode: 'system', + procMode: 'script', requestMode: 'system', funcTooltip: '', funcRules: [] @@ -59,7 +60,7 @@ this.setState({ interType: setting.interType || 'system', - procMode: setting.procMode || 'system', + procMode: setting.procMode || 'script', requestMode: setting.requestMode || 'system', funcTooltip: tooltip, funcRules: rules @@ -175,6 +176,7 @@ interface: window.GLOB.mainSystemApi || '' }) } + this.props.updateStatus({[key]: value}) } primaryKeyChange = (val) => { @@ -214,6 +216,10 @@ required: true, message: dict['form.required.input'] + '琛ㄥ悕!' }, + { + max: 50, + message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!' + } ] })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> @@ -279,7 +285,7 @@ ] })( <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onRadioChange(e, 'procMode')}}> - <Radio value="system">鍓嶇疆鑴氭湰</Radio> + <Radio value="script">鍓嶇疆鑴氭湰</Radio> <Radio value="inner">鍓嶇疆鍑芥暟</Radio> </Radio.Group>)} </Form.Item> @@ -291,8 +297,8 @@ 鍓嶇疆鍑芥暟 </Tooltip> }> - {getFieldDecorator('innerFunc', { - initialValue: setting.innerFunc || '', + {getFieldDecorator('prevFunc', { + initialValue: setting.prevFunc || '', rules: [ { required: true, @@ -308,19 +314,19 @@ </Form.Item> </Col> : null} {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}> - <Form.Item label="鎺ュ彛鍦板潃"> + <Form.Item label="娴嬭瘯鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || '', rules: [ { required: true, - message: dict['form.required.input'] + '鎺ュ彛鍦板潃!' + message: dict['form.required.input'] + '娴嬭瘯鍦板潃!' }, ] })(<TextArea rows={2} />)} </Form.Item> </Col> : null} - {interType === 'custom' ? <Col className="data-source" span={24}> + {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="姝e紡绯荤粺鎵�浣跨敤鐨勭殑鎺ュ彛鍦板潃銆�"> <Icon type="question-circle" /> @@ -330,6 +336,23 @@ {getFieldDecorator('proInterface', { initialValue: setting.proInterface || '' })(<TextArea rows={2} />)} + </Form.Item> + </Col> : null} + {interType === 'custom' ? <Col span={12}> + <Form.Item label="璇锋眰鏂瑰紡"> + {getFieldDecorator('method', { + initialValue: setting.method || 'post', + rules: [ + { + required: true, + message: dict['form.required.select'] + '璇锋眰鏂瑰紡!' + }, + ] + })( + <Radio.Group> + <Radio value="get">GET</Radio> + <Radio value="post">POST</Radio> + </Radio.Group>)} </Form.Item> </Col> : null} {interType === 'custom' ? <Col span={12}> @@ -390,7 +413,7 @@ </Col> : null} {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> <Form.Item help={'鏁版嵁ID锛�' + menu.MenuID} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } label={ - <Tooltip placement="topLeft" title={'浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\''}> + <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''锛涙煡璇㈡浛鎹㈢ $select@ -> /* 鎴� ''銆� @select$ -> */ 鎴� ''锛涚粺璁℃浛鎹㈢ $sum@ -> /* 鎴� ''銆� @sum$ -> */ 鎴� ''銆俙}> <Icon type="question-circle" /> 鏁版嵁婧� </Tooltip> @@ -446,7 +469,7 @@ <Col span={12}> <Form.Item label="榛樿鎺掑簭"> {getFieldDecorator('order', { - initialValue: setting.order || '', + initialValue: setting.order || 'ID desc', rules: [ { required: true, @@ -463,12 +486,29 @@ {interType === 'custom' ? <Col span={12}> <Form.Item label="鍥炶皟鏂瑰紡"> {getFieldDecorator('callbackType', { - initialValue: setting.callbackType || 'default' + initialValue: setting.callbackType || 'script' })( - <Radio.Group> + <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}> <Radio value="default">榛樿鑴氭湰</Radio> <Radio value="script">鑷畾涔夎剼鏈�</Radio> </Radio.Group>)} + </Form.Item> + </Col> : null} + {interType === 'custom' ? <Col span={12}> + <Form.Item label="鍥炶皟琛ㄥ悕"> + {getFieldDecorator('cbTable', { + initialValue: setting.cbTable || '', + rules: [ + { + required: true, + message: dict['form.required.input'] + '鍥炶皟琛ㄥ悕!' + }, + { + max: formRule.input.max, + message: formRule.input.message + } + ] + })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} {interType === 'custom' ? <Col span={12}> @@ -484,6 +524,22 @@ <Radio.Group> <Radio value="sync">鍚屾</Radio> <Radio value="async">寮傛</Radio> + </Radio.Group>)} + </Form.Item> + </Col> : null} + {interType === 'custom' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title={'濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�'}> + <Icon type="question-circle" /> + 璺ㄥ煙璇锋眰 + </Tooltip> + }> + {getFieldDecorator('cross', { + initialValue: setting.cross || 'true' + })( + <Radio.Group> + <Radio value="true">鏀寔</Radio> + <Radio value="false">涓嶆敮鎸�</Radio> </Radio.Group>)} </Form.Item> </Col> : null} @@ -560,6 +616,18 @@ </Col> <Col span={12}> <Form.Item label={ + <Tooltip placement="topLeft" title="楂樼骇鎼滅储寮圭獥鐨勫搴︼紝娉細褰撳搴﹀�煎皬浜�100鏃惰〃绀哄崰绐楀彛鐨勭櫨鍒嗘瘮锛屽ぇ浜�100鏃惰〃绀哄搴︾殑缁濆鍊笺��"> + <Icon type="question-circle" /> + 楂樼骇鎼滅储 + </Tooltip> + }> + {getFieldDecorator('advanceWidth', { + initialValue: setting.advanceWidth || 1000 + })(<InputNumber min={10} max={3000} precision={0}/>)} + </Form.Item> + </Col> + <Col span={12}> + <Form.Item label={ <Tooltip placement="topLeft" title="鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�"> <Icon type="question-circle" /> 鍙屽嚮浜嬩欢 -- Gitblit v1.8.0