From 22d35064c88fc88c00761b7709786900467e8f14 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 02 八月 2023 13:01:06 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/templates/zshare/verifycard/customscript/index.jsx |   76 ++++++++++++++++++++++++--------------
 1 files changed, 48 insertions(+), 28 deletions(-)

diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index 8e7181a..b176479 100644
--- a/src/templates/zshare/verifycard/customscript/index.jsx
+++ b/src/templates/zshare/verifycard/customscript/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select } from 'antd'
+import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
@@ -23,7 +23,8 @@
 
   state = {
     editItem: null,
-    loading: false
+    loading: false,
+    skip: false
   }
 
   edit = (record) => {
@@ -45,7 +46,7 @@
 
   handleConfirm = () => {
     const { type } = this.props
-    const { editItem } = this.state
+    const { editItem, skip } = this.state
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (type === 'fullscreen' && err) {
@@ -203,26 +204,38 @@
         param.LText = Utils.formatOptions(param.LText)
         param.secretkey = Utils.encrypt('', param.timestamp)
         
-        this.setState({loading: true})
-        Api.genericInterface(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
-            })
-          }
-        })
+        if (skip) {
+          this.setState({
+            skip: false,
+            editItem: null
+          }, () => {
+            this.props.scriptsChange(values)
+          })
+          this.props.form.setFieldsValue({
+            sql: ' '
+          })
+        } else {
+          this.setState({loading: true})
+          Api.genericInterface(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
+              })
+            }
+          })
+        }
       }
     })
   }
@@ -241,6 +254,9 @@
     if (!value || !option) return
 
     let _sql = this.props.form.getFieldValue('sql')
+    if (/^\s+$/.test(_sql)) {
+      _sql = ''
+    }
     if (_sql) {
       _sql = _sql + ` 
 
@@ -261,7 +277,7 @@
   render() {
     const { usefulfields, systemScripts, btn, type } = this.props
     const { getFieldDecorator } = this.props.form
-    const { editItem } = this.state
+    const { editItem, skip } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -298,7 +314,7 @@
               {usefulfields ? <span>, {usefulfields}</span> : ''}
             </Form.Item>
           </Col> : null}
-          {!_type ?<Col span={8} style={{whiteSpace: 'nowrap'}}>
+          {!_type ? <Col span={8} style={{whiteSpace: 'nowrap'}}>
             <Form.Item style={{marginBottom: 0}} label={
               <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}>
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -316,7 +332,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {!_type ?<Col span={10}>
+          {!_type ? <Col span={8}>
             <Form.Item label={'蹇嵎娣诲姞'} style={{marginBottom: 0}}>
               <Select
                 showSearch
@@ -334,14 +350,18 @@
               </Select>
             </Form.Item>
           </Col> : null}
-          <Col span={6} className="add">
-            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
+          <Col span={5} className="add" style={{whiteSpace: 'nowrap'}}>
+            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 30}}>
               {_type === 'fullscreen' && !editItem ? '娣诲姞' : '淇濆瓨'}
             </Button>
             <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}>
               鍙栨秷
             </Button>
           </Col>
+          {!_type ? <Col span={3} style={{paddingTop: '15px', fontSize: '12px', whiteSpace: 'nowrap'}}>
+            寮哄埗淇濆瓨锛�
+            <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/>
+          </Col> : null}
           <Col span={24} className="sql">
             <Form.Item label={
               <Tooltip placement="topLeft" overlayStyle={{width: '320px', maxWidth: '320px'}} title={<><div>{'璋冭瘯鏇挎崲绗� /*$breakpoint_begin_xxxx@ 銆丂breakpoint_end_xxxx$*/锛屽湪鎺у埗鍙颁腑杈撳叆 window.debug = \'xxxx\' 浼氬惎鐢ㄥ搴旂殑璋冭瘯璇彞锛屽揩鎹烽敭 ctrl+c 鎴栧湪鎺у埗鍙颁腑杈撳叆 window.debug = false 鍏抽棴璋冭瘯銆傛敞锛氳皟璇曟椂瀛楃 $breakpoint_proc@ 灏嗚鏇挎崲銆�'}</div><div style={{height: '5px'}}></div><div>{'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃朵細璇㈤棶鏄惁缁х画鎵ц锛岀‘瀹氭椂 $check@ -> /*銆� @check$ -> */銆傛敞锛�1銆侀渶浣跨敤绯荤粺鎺ュ彛 2銆佽璁剧疆涓衡�滈�夋嫨澶氳鈥濇椂鏃犳晥銆�'}</div></>}>

--
Gitblit v1.8.0