From 9b6ce1a5778c6e1a813237e87588c0052aae1bbb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 29 四月 2020 17:26:15 +0800
Subject: [PATCH] 2020-04-29

---
 src/templates/zshare/verifycard/customscript/index.jsx |   45 ++++++++++++++++++++++++++-------------------
 1 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index 98977c0..b1fabe2 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, Input, Button, notification, Modal, Select, Tooltip, Icon, Radio } from 'antd'
+import { Form, Row, Col, Input, Button, notification, Modal, Menu, Tooltip, Icon, Radio, Dropdown } from 'antd'
 import moment from 'moment'
 
 import Utils from '@/utils/utils.js'
@@ -12,6 +12,7 @@
 class CustomForm extends Component {
   static propTpyes = {
     dict: PropTypes.object,         // 瀛楀吀椤�
+    btn: PropTypes.object,          // 鎸夐挳淇℃伅
     usefulfields: PropTypes.string, // 鍙敤瀛楁
     initsql: PropTypes.string,      // sql鍓嶇紑
     systemScripts: PropTypes.array, // 绯荤粺鑴氭湰
@@ -130,7 +131,11 @@
     })
   }
 
-  selectScript = (val, option) => {
+  selectScript = (e) => {
+    const { systemScripts } = this.props
+
+    let option = systemScripts[+e.key]
+
     let _sql = this.props.form.getFieldValue('sql')
     if (_sql) {
       _sql = _sql + ` 
@@ -139,10 +144,10 @@
     }
 
     _sql = _sql.replace(/\s{6}$/, '')
-    _sql = _sql + `/*${option.props.title}*/
+    _sql = _sql + `/*${option.name}*/
     `
     _sql = _sql.replace(/\s{4}$/, '')
-    _sql = _sql + val
+    _sql = _sql + option.value
 
     this.props.form.setFieldsValue({
       sql: _sql
@@ -150,7 +155,7 @@
   }
 
   render() {
-    const { usefulfields, systemScripts } = this.props
+    const { usefulfields, systemScripts, btn } = this.props
     const { getFieldDecorator } = this.props.form
     const formItemLayout = {
       labelCol: {
@@ -171,7 +176,7 @@
               {usefulfields}
             </Form.Item>
           </Col> : null}
-          <Col span={8}>
+          <Col span={8} style={{whiteSpace: 'nowrap'}}>
             <Form.Item style={{marginBottom: 0}} label={
               <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}>
                 <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
@@ -189,27 +194,29 @@
               )}
             </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}>
+          <Col span={4} style={{lineHeight: '40px', textAlign: 'center'}}>
+            <Dropdown trigger={['click']} overlayClassName="mk-normal-dropdown" overlay={
+              <Menu onClick={this.selectScript}>
                 {systemScripts.map((option, i) =>
-                  <Select.Option title={option.name} key={i} value={option.value}>
-                    {option.name}
-                  </Select.Option>
+                  <Menu.Item key={i}>{option.name}</Menu.Item>
                 )}
-              </Select>
-            </Form.Item>
+              </Menu>
+            }>
+              <span style={{color: '#1890ff', display: 'inline-block', cursor: 'pointer'}}>
+                蹇嵎娣诲姞 <Icon type="down" style={{marginRight: '5px'}} />
+              </span>
+            </Dropdown>
           </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={8} style={{textAlign: 'right'}}>
+            {btn.sql ? <span style={{maxWidth: '100%', display: 'inline-block', position: 'relative', top: '20px', whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden'}}>
+              琛ㄥ悕:  {btn.sql}
+            </span> : null}
+          </Col>
           <Col span={24} className="sql">
             <Form.Item label={'sql'}>
               {getFieldDecorator('sql', {

--
Gitblit v1.8.0