From 523cec6c87d88b43954a4409a8dfde6aade095a1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 22 五月 2020 11:02:10 +0800 Subject: [PATCH] 2020-05-22 --- src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx | 42 ++++++++++++++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx index cffe183..cab711c 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx @@ -11,6 +11,7 @@ class CustomForm extends Component { static propTpyes = { + type: PropTypes.string, // 鑿滃崟绫诲瀷 dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.object, // 璁剧疆 searches: PropTypes.array, // 鎼滅储鏉′欢 @@ -27,15 +28,22 @@ UNSAFE_componentWillMount() { const { searches } = this.props - let _usefulFields = searches.map(item => { + + let _usefulFields = [] + searches.forEach(item => { if (item.type === 'group') { if (item.transfer === 'true') { - return item.field + ', ' + item.datefield - } else { - return item.datefield + _usefulFields.push(item.field) } + _usefulFields.push(item.datefield) + _usefulFields.push(item.datefield + '1') + } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { + _usefulFields.push(item.field) + _usefulFields.push(item.field + '1') + } else if (_usefulFields.includes(item.field)) { + _usefulFields.push(item.field + '1') } else { - return item.field + _usefulFields.push(item.field) } }) @@ -52,6 +60,15 @@ this.props.form.setFieldsValue({ sql: record.sql, initsql: record.initsql || 'false' + }) + } + + handleCancel = () => { + this.setState({ + editItem: null + }) + this.props.form.setFieldsValue({ + sql: '' }) } @@ -123,6 +140,8 @@ func: 's_debug_sql', LText: _initsql + values.sql + tail } + + param.LText = param.LText.replace(/@\$|\$@/ig, '') let allSearch = Utils.initMainSearch(searches) allSearch = Utils.getAllSearchOptions(allSearch) @@ -200,7 +219,7 @@ } render() { - const { systemScripts, setting } = this.props + const { systemScripts, setting, type } = this.props const { getFieldDecorator } = this.props.form const { usefulFields } = this.state const formItemLayout = { @@ -224,12 +243,12 @@ </Col> : null} <Col span={16}> <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0}}> - errorCode, errmsg + ErrorCode, retmsg </Form.Item> </Col> <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - id, bid, loginuid, sessionuid, userid, appkey, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''} + id, bid, loginuid, sessionuid, userid, appkey, {type === 'main' ? 'out_id, ' : '' }time_id, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''} </Form.Item> </Col> <Col span={8} style={{whiteSpace: 'nowrap'}}> @@ -257,10 +276,13 @@ </Select> </Form.Item> </Col> - <Col span={4} className="add"> - <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> + <Col span={6} className="add"> + <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginTop: 5, marginBottom: 15, marginLeft: 30}}> 淇濆瓨 </Button> + <Button onClick={this.handleCancel} style={{marginTop: 5, marginBottom: 15, marginLeft: 10}}> + 鍙栨秷 + </Button> </Col> <Col span={24} className="sql"> <Form.Item label={'sql'}> -- Gitblit v1.8.0