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/customform/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx
index 0dc8608..32a9516 100644
--- a/src/templates/zshare/verifycard/customform/index.jsx
+++ b/src/templates/zshare/verifycard/customform/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, Button, notification, Modal } from 'antd'
+import { Form, Row, Col, Input, Select, Button, notification, Modal, Tooltip } from 'antd'
 import moment from 'moment'
 
 import Utils from '@/utils/utils.js'
@@ -10,7 +10,6 @@
 
 class CustomForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object,         // 瀛楀吀椤�
     btn: PropTypes.object,          // 鎸夐挳
     usefulfields: PropTypes.string, // 鍙敤瀛楁
     initsql: PropTypes.string,      // 鍙敤瀛楁
@@ -50,6 +49,15 @@
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
+        if (/^[\s\n]+$/.test(values.sql)) {
+          notification.warning({
+            top: 92,
+            message: '璇疯緭鍏ql!',
+            duration: 5
+          })
+          return
+        }
+        
         values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
         values.resultName = values.result === 'false' ? '涓嶅瓨鍦�' : '瀛樺湪'
 
@@ -98,8 +106,18 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: this.props.initsql + values.sql
         }
+
+        param.LText = `${this.props.initsql}
+          /* 鑷畾涔夐獙璇� */
+          select @tbid='', @ErrorCode='',@retmsg=''
+          select top 1 @tbid='X' from (${values.sql}) a
+          If @tbid = ''
+          Begin
+            select @ErrorCode='${values.errorCode}',@retmsg='${values.errmsg}'
+            goto aaa
+          end
+          aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 
         if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
           window.GLOB.funcs.forEach(item => {
@@ -116,12 +134,17 @@
           param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase)
         }
 
-        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}'`)
+
+        console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{10}/ig, '\n')}`)
+
+        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(res => {
+        Api.genericInterface(param).then(res => {
           if (res.status) {
             this.setState({
               loading: false,
@@ -158,22 +181,28 @@
         sm: { span: 16 }
       }
     }
+
+    // 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" id="verifycard2">
         <Row gutter={24}>
-          {usefulfields ? <Col span={21} className="sqlfield">
+          <Col span={21} 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</span></Tooltip>,&nbsp;
+              <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>,&nbsp;
+              <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}
+          </Col>
           <Col span={21} className="sql">
-            <Form.Item label={'sql'}>
+            <Form.Item label="sql">
               {getFieldDecorator('sql', {
                 initialValue: '',
                 rules: [
                   {
                     required: true,
-                    message: this.props.dict['form.required.input'] + 'sql!'
+                    message: '璇疯緭鍏ql!'
                   }
                 ]
               })(<CodeMirror />)}
@@ -198,7 +227,7 @@
                 rules: [
                   {
                     required: true,
-                    message: this.props.dict['form.required.select'] + '缁撴灉澶勭悊!'
+                    message: '璇烽�夋嫨缁撴灉澶勭悊!'
                   }
                 ]
               })(
@@ -210,13 +239,13 @@
             </Form.Item>
           </Col>
           <Col span={7}>
-            <Form.Item label={'鎻愮ず淇℃伅'}>
+            <Form.Item label="鎻愮ず淇℃伅">
               {getFieldDecorator('errmsg', {
                 initialValue: '',
                 rules: [
                   {
                     required: true,
-                    message: this.props.dict['form.required.input'] + '鎻愮ず淇℃伅!'
+                    message: '璇疯緭鍏ユ彁绀轰俊鎭�!'
                   },
                   {
                     pattern: /^[^']*$/ig,
@@ -233,7 +262,7 @@
                 rules: [
                   {
                     required: true,
-                    message: this.props.dict['form.required.select'] + '鎶ラ敊缂栫爜!'
+                    message: '璇烽�夋嫨鎶ラ敊缂栫爜!'
                   }
                 ]
               })(

--
Gitblit v1.8.0