From 77ec79eb5e483a59157dff9b4fd75159e2fa132e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 17 四月 2020 14:48:43 +0800
Subject: [PATCH] 2020-04-17

---
 src/templates/zshare/verifycardexcelin/customscript/index.jsx |  104 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/src/templates/zshare/verifycardexcelin/customscript/index.jsx b/src/templates/zshare/verifycardexcelin/customscript/index.jsx
index 18e0aaa..8c4d235 100644
--- a/src/templates/zshare/verifycardexcelin/customscript/index.jsx
+++ b/src/templates/zshare/verifycardexcelin/customscript/index.jsx
@@ -124,6 +124,17 @@
           return
         }
 
+        let error = Utils.verifySql(values.sql, 'customscript')
+
+        if (error) {
+          notification.warning({
+            top: 92,
+            message: 'sql涓笉鍙娇鐢�' + error,
+            duration: 10
+          })
+          return
+        }
+
         let tail = `
           aaa:
         `
@@ -160,9 +171,22 @@
     })
   }
 
-  selectScript = (val) => {
+  selectScript = (val, option) => {
+    let _sql = this.props.form.getFieldValue('sql')
+    if (_sql) {
+      _sql = _sql + ` 
+
+      `
+    }
+
+    _sql = _sql.replace(/\s{6}$/, '')
+    _sql = _sql + `/*${option.props.title}*/
+    `
+    _sql = _sql.replace(/\s{4}$/, '')
+    _sql = _sql + val
+
     this.props.form.setFieldsValue({
-      sql: val
+      sql: _sql
     })
   }
 
@@ -184,12 +208,50 @@
     return (
       <Form {...formItemLayout} className="verify-form" id="verifycard2">
         <Row gutter={24}>
-          {usefulfields ? <Col span={21} className="sqlfield">
+          {usefulfields ? <Col span={24} className="sqlfield">
             <Form.Item label={'鍙敤瀛楁'}>
               {usefulfields}
             </Form.Item>
           </Col> : null}
-          <Col span={20} className="sql">
+          <Col span={8}>
+            <Form.Item style={{marginBottom: 0}} label={
+              <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}>
+                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                鎵ц浣嶇疆
+              </Tooltip>
+            }>
+              {getFieldDecorator('position', {
+                initialValue: 'back'
+              })(
+                <Radio.Group>
+                  <Radio value="front">sql鍓�</Radio>
+                  <Radio value="back">sql鍚�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={8}>
+            <Form.Item style={{marginBottom: 0}} label={
+              <Tooltip placement="bottomLeft" title={'浠庣郴缁熷嚱鏁伴泦涓�夋嫨闇�瑕佺殑鍑芥暟锛屽彲蹇�熸坊鍔犺嚦sql涓��'}>
+                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                蹇嵎娣诲姞
+              </Tooltip>
+            }>
+              <Select value="" onChange={this.selectScript}>
+                {systemScripts.map((option, i) =>
+                  <Select.Option title={option.name} key={i} value={option.value}>
+                    {option.name}
+                  </Select.Option>
+                )}
+              </Select>
+            </Form.Item>
+          </Col>
+          <Col span={4} className="add">
+            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
+              淇濆瓨
+            </Button>
+          </Col>
+          <Col span={24} className="sql">
             <Form.Item label={'sql'}>
               {getFieldDecorator('sql', {
                 initialValue: '',
@@ -200,40 +262,6 @@
                   }
                 ]
               })(<TextArea rows={15} />)}
-            </Form.Item>
-          </Col>
-          <Col span={4} className="add">
-            <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" style={{marginBottom: 20}}>
-              纭畾
-            </Button>
-            <Form.Item labelAlign="left" label={
-              <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}>
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
-                鎵ц浣嶇疆
-              </Tooltip>
-            } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }>
-              {getFieldDecorator('position', {
-                initialValue: 'back'
-              })(
-                <Radio.Group>
-                  <Radio value="front">sql鍓�</Radio>
-                  <Radio value="back">sql鍚�</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-            <Form.Item labelAlign="left" label={
-              <Tooltip placement="bottomLeft" title={'浠庣郴缁熷嚱鏁伴泦涓�夋嫨闇�瑕佺殑鍑芥暟锛屽彲蹇�熸坊鍔犺嚦sql涓��'}>
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
-                蹇嵎娣诲姞
-              </Tooltip>
-            } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }>
-              <Select onChange={this.selectScript}>
-                {systemScripts.map((option, i) =>
-                  <Select.Option title={option.name} key={i} value={option.value}>
-                    {option.name}
-                  </Select.Option>
-                )}
-              </Select>
             </Form.Item>
           </Col>
         </Row>

--
Gitblit v1.8.0