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/settingcomponent/settingform/simplescript/index.jsx | 85 ++++++++++++++++++++++++------------------ 1 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx index f27e974..2f679b7 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx @@ -1,7 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Icon, Button, notification, Select, Popconfirm, Typography, Modal, Radio } from 'antd' +import { Form, Row, Col, Button, notification, Select, Popconfirm, Typography, Modal, Radio, Tooltip } from 'antd' +import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' import moment from 'moment' import Utils from '@/utils/utils.js' @@ -16,7 +17,6 @@ class CustomForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.object, // 璁剧疆 scripts: PropTypes.array, // 鑷畾涔夎剼鏈垪琛� searches: PropTypes.array, // 鎼滅储鏉′欢 @@ -27,9 +27,11 @@ } state = { + wrapId: Utils.getuuid(), editItem: null, loading: false, usefulFields: '', + urlFields: '', systemScripts: [], scriptsColumns: [ { @@ -39,12 +41,12 @@ render: (text) => { let title = text.match(/^\s*\/\*.+\*\//) title = title && title[0] ? title[0] : '' - text = title ? text.replace(title, '') : text + let _text = title ? text.replace(title, '') : text return ( <div> - {title ? <span style={{color: '#a50'}}>{title}</span> : null} - <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> + {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} + <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> </div> ) } @@ -55,9 +57,9 @@ width: '13%', render: (text, record) => { if (record.position === 'front') { - return 'sql鍓�' + return <span style={{color: '#26C281'}}>sql鍓�</span> } else { - return 'sql鍚�' + return <span style={{color: '#1890ff'}}>sql鍚�</span> } } }, @@ -67,15 +69,15 @@ width: '12%', render: (text, record) => record.status === 'false' ? ( - <div> - {this.props.dict['model.status.forbidden']} - <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, @@ -86,14 +88,14 @@ dataIndex: 'operation', render: (text, record) => (<div style={{textAlign: 'center'}}> - <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><Icon type="edit" /></span> - <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record) }> - <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> + <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> </Popconfirm> </div>) } @@ -105,6 +107,7 @@ let _usefulFields = [] let scriptsColumns = fromJS(this.state.scriptsColumns).toJS() + let _urlFields = '' if (searches) { searches.forEach(item => { @@ -119,14 +122,11 @@ } else if (_usefulFields.includes(item.field)) { _usefulFields.push(item.field + '1') } else { - _usefulFields.push(item.field) + _usefulFields.push(item.field.replace(/,/ig, ', ')) } }) - if (urlFields) { - _usefulFields.push(...urlFields) - } - + _urlFields = urlFields ? urlFields.join(', ') : '' _usefulFields = _usefulFields.join(', ') scriptsColumns = scriptsColumns.filter(item => { if (item.dataIndex === 'sql') { @@ -139,6 +139,7 @@ } this.setState({ + urlFields: _urlFields, usefulFields: _usefulFields, scripts: fromJS(scripts).toJS(), scriptsColumns @@ -150,6 +151,13 @@ } getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -168,12 +176,13 @@ Api.getSystemConfig(_sParam).then(res => { if (res.status) { let _scripts = res.data.map(item => { - let _item = { + return { name: item.funcname, value: window.decodeURIComponent(window.atob(item.longparam)) } - return _item }) + + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) this.setState({ systemScripts: _scripts @@ -288,12 +297,16 @@ exec_type: 'y', LText: SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions) } - param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) + param.LText = param.LText.replace(/\n/g, ' ') + + param.LText = Utils.formatOptions(param.LText) param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ loading: false, @@ -355,7 +368,7 @@ } scrolltop = () => { - let node = document.getElementById('model-setting-form-body').parentNode + let node = document.getElementById(this.state.wrapId).parentNode if (node && node.scrollTop) { let inter = Math.ceil(node.scrollTop / 10) @@ -403,7 +416,7 @@ render() { const { setting, scripts } = this.props const { getFieldDecorator } = this.props.form - const { usefulFields, scriptsColumns, systemScripts } = this.state + const { usefulFields, scriptsColumns, systemScripts, urlFields, wrapId } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -416,7 +429,7 @@ } return ( - <div className="modal-menu-setting-script"> + <div className="modal-menu-setting-script" id={wrapId}> <Form {...formItemLayout}> <Row gutter={24}> <Col span={4}> @@ -429,16 +442,14 @@ ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT锛�, retmsg </Form.Item> </Col> - {usefulFields ? <Col span={24} className="sqlfield"> + <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - id, bid, loginuid, sessionuid, userid, username, fullname, login_city, appkey, time_id{usefulFields ? ', ' + usefulFields : ''} + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip> + {usefulFields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎼滅储鏉′欢鍙橀噺锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>, {usefulFields}</Tooltip> : ''} + {urlFields ?<Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'url鍙橀噺锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>, <span style={{color: '#13c2c2'}}>{urlFields}</span></Tooltip> : ''} </Form.Item> - </Col> : null} - {!usefulFields ? <Col span={24} className="sqlfield"> - <Form.Item label={'鍙敤瀛楁'}> - id, bid, loginuid, sessionuid, userid, username, fullname, login_city, appkey, time_id - </Form.Item> - </Col> : null} + </Col> {!usefulFields ? <Col span={8} style={{whiteSpace: 'nowrap'}}> <Form.Item style={{marginBottom: 0}} label="鎵ц浣嶇疆"> {getFieldDecorator('position', { -- Gitblit v1.8.0