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/zshare/verifycard/customscript/index.jsx | 45 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 1909699..1f172d4 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -12,7 +12,6 @@ class CustomForm extends Component { static propTpyes = { type: PropTypes.any, - dict: PropTypes.object, // 瀛楀吀椤� btn: PropTypes.object, // 鎸夐挳淇℃伅 usefulfields: PropTypes.string, // 鍙敤瀛楁 initsql: PropTypes.string, // sql鍓嶇紑 @@ -45,10 +44,27 @@ } handleConfirm = () => { + const { type } = this.props const { editItem } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { + if (type === 'fullscreen' && err) { + notification.warning({ + top: 92, + message: '璇疯緭鍏ql!', + duration: 5 + }) + return + } if (!err) { + if (/^[\s\n]+$/.test(values.sql)) { + notification.warning({ + top: 92, + message: '璇疯緭鍏ql!', + duration: 5 + }) + return + } values.uuid = editItem ? editItem.uuid : '' values.position = values.position || (editItem ? editItem.position : 'front') @@ -167,14 +183,17 @@ param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) } + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`) + console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) + param.LText = param.LText.replace(/\n/g, ' ') param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, @@ -231,6 +250,7 @@ render() { const { usefulfields, systemScripts, btn, type } = this.props const { getFieldDecorator } = this.props.form + const { editItem } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -244,12 +264,14 @@ let _type = type || '' + // let _usefulfields = usefulfields ? usefulfields.replace(/(BID|ID|LoginUID|SessionUid|UserID|Appkey|UserName|FullName|RoleID|mk_departmentcode|mk_organization|mk_nation|mk_province|mk_city|mk_district|mk_address|mk_user_type|BillCode|BVoucher|FIBVoucherDate|FiYear|ModularDetailCode),\s/ig, '') : null + return ( <Form {...formItemLayout} className="verify-form verify-custom-scripts" id={'verify-custom-scripts' + _type}> <Row gutter={24}> - {!_type && btn.sql ? <Col span={8}> + {!_type ? <Col span={8}> <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> - {btn.sql} + {btn.sql || ''} </Form.Item> </Col> : null} {!_type ? <Col span={10}> @@ -257,9 +279,12 @@ ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT锛�, retmsg </Form.Item> </Col> : null} - {!_type && usefulfields ? <Col span={24} className="sqlfield"> + {!_type ? <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - {usefulfields} + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</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={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞跺湪鍗曞彿鐢熸垚鎴栧垱寤哄嚟璇佹椂浣跨敤銆�'}><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> + {usefulfields ? <span>, {usefulfields}</span> : ''} </Form.Item> </Col> : null} {!_type ?<Col span={8} style={{whiteSpace: 'nowrap'}}> @@ -300,7 +325,7 @@ </Col> : null} <Col span={6} className="add"> <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> - 淇濆瓨 + {_type === 'fullscreen' && !editItem ? '娣诲姞' : '淇濆瓨'} </Button> <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}> 鍙栨秷 @@ -308,7 +333,7 @@ </Col> <Col span={24} className="sql"> <Form.Item label={ - <Tooltip placement="topLeft" title={'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃� $check@ -> /*銆� @check$ -> */'}> + <Tooltip placement="topLeft" overlayStyle={{width: '320px', maxWidth: '320px'}} title={<><div>{'璋冭瘯鏇挎崲绗� /*$breakpoint_begin_xxxx@ 銆丂breakpoint_end_xxxx$*/锛屽湪鎺у埗鍙颁腑杈撳叆 window.debug = \'xxxx\' 浼氬惎鐢ㄥ搴旂殑璋冭瘯璇彞锛屽揩鎹烽敭 ctrl+c 鎴栧湪鎺у埗鍙颁腑杈撳叆 window.debug = false 鍏抽棴璋冭瘯銆傛敞锛氳皟璇曟椂瀛楃 $breakpoint_proc@ 灏嗚鏇挎崲銆�'}</div><div style={{height: '5px'}}></div><div>{'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃朵細璇㈤棶鏄惁缁х画鎵ц锛岀‘瀹氭椂 $check@ -> /*銆� @check$ -> */銆傛敞锛�1銆侀渶浣跨敤绯荤粺鎺ュ彛 2銆佽璁剧疆涓衡�滈�夋嫨澶氳鈥濇椂鏃犳晥銆�'}</div></>}> <QuestionCircleOutlined className="mk-form-tip" /> sql </Tooltip> @@ -318,7 +343,7 @@ rules: [ { required: true, - message: this.props.dict['form.required.input'] + 'sql!' + message: '璇疯緭鍏ql!' } ] })(<CodeMirror />)} -- Gitblit v1.8.0