From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx |   71 +++++++++++------------------------
 1 files changed, 22 insertions(+), 49 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx
index 9f4f640..adf4197 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx
@@ -7,8 +7,9 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
+import { checkSQL } from '@/utils/utils-custom.js'
 import CodeMirror from '@/templates/zshare/codemirror'
-import './index.scss'
+// import './index.scss'
 
 class CustomForm extends Component {
   static propTpyes = {
@@ -95,9 +96,26 @@
         _usefulFields.push(item.field)
         _usefulFields.push(item.datefield)
         _usefulFields.push(item.datefield + '1')
-      } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) {
+      } else if (item.type === 'dateweek') {
         _usefulFields.push(item.field)
         _usefulFields.push(item.field + '1')
+      } else if (item.type === 'datemonth') {
+        if (item.match === '=') {
+          _usefulFields.push(item.field)
+        } else {
+          _usefulFields.push(item.field)
+          _usefulFields.push(item.field + '1')
+        }
+      } else if (item.type === 'daterange') {
+        let _skey = item.field
+        let _ekey = item.field + '1'
+
+        if (/,/.test(item.field)) {
+          _skey = item.field.split(',')[0]
+          _ekey = item.field.split(',')[1]
+        }
+        _usefulFields.push(_skey)
+        _usefulFields.push(_ekey)
       } else if (item.type === 'date' && _usefulFields.includes(item.field)) {
         _usefulFields.push(item.field + '1')
       } else {
@@ -137,54 +155,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) return
 
         this.setState({
           loading: true

--
Gitblit v1.8.0