From b8cdbe3fbd57bbd513509a7d76c529096b1a7153 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 15 七月 2020 14:39:10 +0800
Subject: [PATCH] 2020-07-15

---
 src/mob/datasource/verifycard/customscript/index.jsx |   78 +++++++--------------------------------
 1 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/src/mob/datasource/verifycard/customscript/index.jsx b/src/mob/datasource/verifycard/customscript/index.jsx
index 003bd51..cbc3019 100644
--- a/src/mob/datasource/verifycard/customscript/index.jsx
+++ b/src/mob/datasource/verifycard/customscript/index.jsx
@@ -1,11 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Button, notification, Modal, Select } from 'antd'
-import moment from 'moment'
+import { Form, Row, Col, Input, Button, notification, Select } from 'antd'
 
 import Utils from '@/utils/utils.js'
-// import SettingUtils from '../utils.jsx'
-import Api from '@/api'
 import './index.scss'
 
 const { TextArea } = Input
@@ -20,7 +17,8 @@
     arr_field: PropTypes.string,    // 鍒楀瓧娈�
     regoptions: PropTypes.array,    // 姝e垯鏇挎崲
     systemScripts: PropTypes.array, // 绯荤粺鑴氭湰
-    scriptsChange: PropTypes.func   // 琛ㄥ崟
+    scriptSubmit: PropTypes.func,   // 鑴氭湰楠岃瘉鍚庢彁浜�
+    scriptsChange: PropTypes.func   // 鑴氭湰楠岃瘉
   }
 
   state = {
@@ -75,9 +73,6 @@
   }
 
   handleConfirm = () => {
-    // const { setting, arr_field, regoptions, swhere } = this.props
-    const { setting } = this.props
-    
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
@@ -125,61 +120,16 @@
           return
         }
 
-        let _customScript = ''
-        setting.scripts && setting.scripts.forEach(script => {
-          if (this.state.editItem && this.state.editItem.uuid === script.uuid) {
-            _customScript += `
-            ${values.sql}
-            `
-          } else if (script.status !== 'false') {
-            _customScript += `
-            ${script.sql}
-            `
-          }
-        })
-
-        if (!this.state.editItem) {
-          _customScript += `
-            ${values.sql}
-            `
-        }
-
-        if (_customScript) {
-          _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg =''
-            ${_customScript}
-          `
-        }
-
-        // let _setting = {...setting, customScript: _customScript}
-
-        let param = {
-          func: 's_debug_sql',
-          // LText: SettingUtils.getDebugSql(_setting, arr_field, regoptions, swhere)
-        }
-
-        param.LText = Utils.formatOptions(param.LText)
-        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
-        
         this.setState({loading: true})
-        Api.getLocalConfig(param).then(res => {
-          if (res.status) {
-            this.setState({
-              loading: false,
-              editItem: null
-            }, () => {
-              this.props.scriptsChange(values)
-            })
-            this.props.form.setFieldsValue({
-              sql: ''
-            })
-          } else {
-            this.setState({loading: false})
-
-            Modal.error({
-              title: res.message
-            })
-          }
+        this.props.scriptsChange(values).then(() => {
+          this.setState({
+            editItem: null,
+            loading: false
+          })
+          this.props.form.setFieldsValue({
+            sql: ''
+          })
+          this.props.scriptSubmit(values)
         })
       }
     })
@@ -234,7 +184,7 @@
           </Col>
           <Col span={24} className="sqlfield">
             <Form.Item label={'鍙敤瀛楁'}>
-              id, bid, loginuid, sessionuid, userid, appkey, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''}
+              id, bid, loginuid, sessionuid, userid, appkey, time_id, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''}
             </Form.Item>
           </Col>
           <Col span={10}>
@@ -265,7 +215,7 @@
                 rules: [
                   {
                     required: true,
-                    message: this.props.dict['form.required.input'] + 'sql!'
+                    message: this.props.dict['mob.required.input'] + 'sql!'
                   }
                 ]
               })(<TextArea rows={15} />)}

--
Gitblit v1.8.0