From a02fc6a77fa1b35c6516b2d37108d80e260c6c85 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 十一月 2024 22:05:08 +0800 Subject: [PATCH] 2024-11-07 --- src/menu/datasource/verifycard/customscript/index.jsx | 99 +++++++------------------------------------------ 1 files changed, 15 insertions(+), 84 deletions(-) diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index adb3ad7..5b4c682 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -6,7 +6,7 @@ import Toast from 'antd-mobile/es/components/toast' import Dialog from 'antd-mobile/es/components/dialog' -import Utils from '@/utils/utils.js' +import { checkSQL, getSearchFields } from '@/utils/utils-custom.js' import CodeMirror from '@/templates/zshare/codemirror' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -33,41 +33,17 @@ UNSAFE_componentWillMount() { const { searches } = this.props - this.getSearchField(searches) + this.setState({ + usefulFields: getSearchFields(searches) + }) } UNSAFE_componentWillReceiveProps (nextProps) { if (!is(fromJS(this.props.searches), fromJS(nextProps.searches))) { - this.getSearchField(nextProps.searches) + this.setState({ + usefulFields: getSearchFields(nextProps.searches) + }) } - } - - getSearchField = (searches) => { - let _usefulFields = [] - searches.forEach(item => { - if (['dateweek', 'datemonth'].includes(item.type)) { - _usefulFields.push(item.key) - _usefulFields.push(item.key + '1') - } else if (item.type === 'daterange') { - let _skey = item.key - let _ekey = item.key + '1' - - if (/,/.test(item.key)) { - _skey = item.key.split(',')[0] - _ekey = item.key.split(',')[1] - } - _usefulFields.push(_skey) - _usefulFields.push(_ekey) - } else if (item.type === 'date' && _usefulFields.includes(item.key)) { - _usefulFields.push(item.key + '1') - } else { - _usefulFields.push(item.key) - } - }) - - this.setState({ - usefulFields: _usefulFields.join(', ') - }) } edit = (record) => { @@ -107,54 +83,9 @@ values.uuid = this.state.editItem ? this.state.editItem.uuid : '' - let _quot = values.sql.match(/'{1}/g) - let _lparen = values.sql.match(/\({1}/g) - let _rparen = values.sql.match(/\){1}/g) + let pass = checkSQL(values.sql, 'customscript') - _quot = _quot ? _quot.length : 0 - _lparen = _lparen ? _lparen.length : 0 - _rparen = _rparen ? _rparen.length : 0 - - if (_quot % 2 !== 0) { - notification.warning({ - top: 92, - message: 'sql涓璡'蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - return - } else if (_lparen !== _rparen) { - notification.warning({ - top: 92, - message: 'sql涓�()蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - return - } else if (/--/ig.test(values.sql)) { - notification.warning({ - top: 92, - message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇瀛楃 -- 锛屾敞閲婅鐢� /*鍐呭*/', - duration: 5 - }) - return - } else if (/,,/ig.test(values.sql)) { - notification.warning({ - top: 92, - message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇杩炵画鐨勮嫳鏂囬�楀彿锛�,,锛�', - duration: 5 - }) - return - } - - let error = Utils.verifySql(values.sql, 'customscript') - - if (error) { - notification.warning({ - top: 92, - message: 'sql涓笉鍙娇鐢�' + error, - duration: 5 - }) - return - } + if (!pass && !skip) return if (skip) { this.setState({ @@ -211,11 +142,11 @@ if (value === 'defaultsql') { value = this.props.defaultsql } else if (value === 'flowstart') { - value = `/* select a.*, w.remark as remark_w, w.statusname as statusname_w,w.status as status_w,w.works_flow_param,w.modifydate as modifydate_w from (select * from ${setting.tableName} where status=0 and deleted=0 $@ and createuserid=@userid@ @$) a + value = `/* select a.*, w.remark as remark_w, w.statusname as statusname_w,w.status as status_w,w.works_flow_param,w.works_flow_detail_id,w.modifydate as modifydate_w from (select * from ${setting.tableName} where status=0 and deleted=0 $@ and createuserid=@userid@ @$) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` this.props.addProcess() } else if (value === 'flowcheck') { - value = `/* select a.*, w.remark as remark_w, w.statusname as statusname_w,w.status as status_w,w.works_flow_param,w.modifydate as modifydate_w + value = `/* select a.*, w.remark as remark_w, w.statusname as statusname_w,w.status as status_w,w.works_flow_param,w.works_flow_detail_id,w.modifydate as modifydate_w from (select * from ${setting.tableName} where status=0 and deleted=0 ) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status>0 and status<888 and deleted=0) w on a.id=w.works_flow_id @@ -279,7 +210,7 @@ } render() { - const { systemScripts, setting, type } = this.props + const { systemScripts, setting, type, hasExtend } = this.props const { getFieldDecorator } = this.props.form const { usefulFields, skip } = this.state @@ -295,7 +226,7 @@ </Col> : null} <Col span={18}> <Form.Item label="鎶ラ敊瀛楁" style={{margin: 0}}> - ErrorCode, retmsg + errorcode, retmsg <span style={{marginLeft: 25}}> 鎴愬姛锛� <span className="error-val" onClick={() => {this.showError('S')}}> S </span>銆� @@ -312,9 +243,9 @@ </Col> <Col span={24}> <Form.Item label="鍙敤瀛楁" className="field-able"> - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, lang, time_id, typename, datam{window.GLOB.getLocation ? ', mk_longitude, mk_latitude' : ''}</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>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@鎴朄orderBy@浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@銆丂orderBy@ 鎴栬剼鏈腑瀛樺湪 @mk_total 浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}{hasExtend ? ', mk_time' : ''}</Tooltip> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'url鍙橀噺锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>{urlFields ? ', ' : ''}<span style={{color: '#13c2c2'}}>{urlFields}</span></Tooltip> {window.GLOB.process ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'宸ヤ綔娴佸彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}>, <span style={{color: 'purple'}}>works_flow_code</span></Tooltip> : null} </Form.Item> -- Gitblit v1.8.0