From c5e5a7580632bc39a9e0c78d548f22a8be5f2019 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 18 十月 2023 18:04:51 +0800
Subject: [PATCH] 2023-10-18

---
 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
index 9aab9bf..180e506 100644
--- a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
+++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
@@ -2,7 +2,6 @@
 import PropTypes from 'prop-types'
 import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
-import moment from 'moment'
 
 import Utils from '@/utils/utils.js'
 import Api from '@/api'
@@ -132,6 +131,25 @@
             duration: 5
           })
           return
+        } else if (/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig.test(values.sql)) {
+          let list = values.sql.match(/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig)
+          let errors = []
+          list.forEach(str => {
+            str = str.replace(/^\s/, '')
+            let strs = str.match(/(\s|=)[a-z0-9_]+\./ig)
+            if (strs.length === 2 && (strs[0].replace(/\s|\./g, '') === strs[1].replace(/\s|\./g, ''))) {
+              errors.push(str)
+            }
+          })
+
+          if (errors.length > 0) {
+            notification.warning({
+              top: 92,
+              message: '涓嶅彲浣跨敤鍚屼竴涓〃瀛楁杩涜鍏宠仈锛�' + errors.join('銆�'),
+              duration: 5
+            })
+            return
+          }
         }
 
         let error = Utils.verifySql(values.sql, 'customscript')
@@ -195,23 +213,9 @@
           }
         }
 
-        let param = {
-          func: 's_debug_sql',
-          exec_type: 'y',
-          LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
-        }
-
-        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
-        param.LText = param.LText.replace(/\n/g, ' ')
+        let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
         
-        // 澶栬仈鏁版嵁搴撴浛鎹�
-        if (window.GLOB.externalDatabase !== null) {
-          param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase)
-        }
-
-        param.LText = Utils.formatOptions(param.LText)
-        param.secretkey = Utils.encrypt('', param.timestamp)
+        sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`)
 
         if (skip) {
           this.setState({
@@ -225,8 +229,8 @@
           })
         } else {
           this.setState({loading: true})
-          Api.genericInterface(param).then(res => {
-            if (res.status) {
+          Api.sDebug(sql).then(res => {
+            if (res.status || res.ErrCode === '-2') {
               this.setState({
                 loading: false,
                 editItem: null

--
Gitblit v1.8.0