From 08cce3334a2dc81d690b518136b0aaea64e48b0b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 14 六月 2023 09:55:50 +0800
Subject: [PATCH] 2023-06-14

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |  110 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 81 insertions(+), 29 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index 76e6878..86d94de 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -4,6 +4,7 @@
 import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Radio, Spin, Typography, Popconfirm } from 'antd'
 import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons'
 import moment from 'moment'
+import md5 from 'md5'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -28,6 +29,7 @@
 
   state = {
     verify: {},
+    debugId: '',
     activeKey: 'setting',
     defaultscript: '', // 鑷畾涔夎剼鏈�
     excelColumns: [
@@ -158,20 +160,20 @@
           )
         }
       },
-      {
-        title: '鎵ц浣嶇疆',
-        dataIndex: 'position',
-        width: '10%',
-        render: (text, record) => {
-          if (record.position === 'init') {
-            return <span style={{color: 'orange'}}>鍒濆鍖�</span>
-          } else if (record.position === 'front') {
-            return <span style={{color: '#26C281'}}>sql鍓�</span>
-          } else {
-            return <span style={{color: '#1890ff'}}>sql鍚�</span>
-          }
-        }
-      },
+      // {
+      //   title: '鎵ц浣嶇疆',
+      //   dataIndex: 'position',
+      //   width: '10%',
+      //   render: (text, record) => {
+      //     if (record.position === 'init') {
+      //       return <span style={{color: 'orange'}}>鍒濆鍖�</span>
+      //     } else if (record.position === 'front') {
+      //       return <span style={{color: '#26C281'}}>sql鍓�</span>
+      //     } else {
+      //       return <span style={{color: '#1890ff'}}>sql鍚�</span>
+      //     }
+      //   }
+      // },
       {
         title: '鐘舵��',
         dataIndex: 'status',
@@ -585,6 +587,17 @@
       } else if (activeKey === 'setting') {
         this.settingForm.handleConfirm().then(res => {
           let _verify = {...verify, ...res}
+
+          if (res.dataType !== 'custom') {
+            delete _verify.tableName
+            delete _verify.dataresource
+            delete _verify.queryType
+            delete _verify.defaultSql
+            delete _verify.order
+
+            _verify.scripts = []
+          }
+          
           this.setState({
             verify: _verify
           }, () => {
@@ -688,6 +701,13 @@
           notification.warning({
             top: 92,
             message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇瀛楃 -- 锛屾敞閲婅鐢� /*鍐呭*/',
+            duration: 5
+          })
+          return
+        } else if (/,,/ig.test(values.sql)) {
+          notification.warning({
+            top: 92,
+            message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇杩炵画鐨勮嫳鏂囬�楀彿锛�,,锛�',
             duration: 5
           })
           return
@@ -988,7 +1008,7 @@
   }
 
   sqlverify = (_resolve, _reject, scripts) => {
-    const { searches, verify } = this.state
+    const { searches, verify, debugId } = this.state
 
     if (verify.dataType !== 'custom') {
       _resolve()
@@ -996,7 +1016,15 @@
     }
 
     let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-    let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, timestamp)
+    let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, '2023-04-20 15:29:37')
+
+    let _debugId = md5(sql)
+
+    if (debugId === _debugId) {
+      _resolve()
+      return
+    }
+
     let param = {
       func: 's_debug_sql',
       exec_type: 'y',
@@ -1008,6 +1036,7 @@
 
     Api.genericInterface(param).then(result => {
       if (result.status) {
+        this.setState({debugId: _debugId})
         _resolve()
       } else {
         _reject()
@@ -1019,7 +1048,22 @@
   }
 
   updateDataType = (val) => {
-    this.setState({verify: {...this.state.verify, dataType: val}})
+    const { config } = this.props
+
+    let verify = {...this.state.verify, dataType: val}
+    if (val === 'custom' && config.setting) {
+      verify.tableName = verify.tableName || config.setting.tableName || ''
+      verify.dataresource = verify.dataresource || config.setting.dataresource || ''
+      verify.queryType = verify.queryType || config.setting.queryType || ''
+      verify.defaultSql = verify.defaultSql || config.setting.execute || ''
+      verify.order = verify.order || config.setting.order || ''
+
+      if (verify.scripts.length === 0 && config.scripts && config.scripts.length > 0) {
+        verify.scripts = fromJS(config.scripts).toJS()
+      }
+    }
+
+    this.setState({verify: verify})
   }
 
   render() {
@@ -1113,7 +1157,7 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> S </span>
                     <Button onClick={() => {this.showError('S')}} type="primary" size="small">
                       鏌ョ湅
@@ -1121,14 +1165,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> Y </span>
                     <Button onClick={() => {this.showError('Y')}} type="primary" size="small">
                       鏌ョ湅
@@ -1138,7 +1182,15 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
+                    <span className="errorval"> -1 </span>
+                    鎵ц鎴愬姛鏃犳彁绀恒��
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> N </span>
                     <Button onClick={() => {this.showError('N')}} type="primary" size="small">
                       鏌ョ湅
@@ -1146,14 +1198,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> F </span>
                     <Button onClick={() => {this.showError('F')}} type="primary" size="small">
                       鏌ョ湅
@@ -1161,14 +1213,14 @@
                   </Form.Item>
                 </Col>
                 <Col span={8}>
-                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                  <Form.Item label="鍋滅暀鏃堕棿">
                     <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                   </Form.Item>
                 </Col>
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> E </span>
                     <Button onClick={() => {this.showError('E')}} type="primary" size="small">
                       鏌ョ湅
@@ -1178,7 +1230,7 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                  <Form.Item label="鎻愮ず缂栫爜">
                     <span className="errorval"> NM </span>
                     <Button onClick={() => {this.showError('NM')}} type="primary" size="small">
                       鏌ョ湅
@@ -1188,9 +1240,9 @@
               </Row>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
-                  <Form.Item label={'鎻愮ず缂栫爜'}>
-                    <span className="errorval"> -1 </span>
-                    涓嶆彁绀�
+                  <Form.Item label="鎻愮ず缂栫爜">
+                    <span className="errorval"> -2 </span>
+                    鎵ц澶辫触鏃犳彁绀�
                   </Form.Item>
                 </Col>
               </Row>

--
Gitblit v1.8.0