From d3272e82652361e5e9bd045925222ef042b6731f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 18 十一月 2020 18:15:15 +0800
Subject: [PATCH] 2020-11-18

---
 src/menu/datasource/verifycard/customscript/index.jsx |   48 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx
index 996e2ff..9a9acce 100644
--- a/src/menu/datasource/verifycard/customscript/index.jsx
+++ b/src/menu/datasource/verifycard/customscript/index.jsx
@@ -1,5 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
+import { is, fromJS } from 'immutable'
 import { Form, Row, Col, Button, notification, Select } from 'antd'
 
 import Utils from '@/utils/utils.js'
@@ -42,7 +43,7 @@
       } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) {
         _usefulFields.push(item.field)
         _usefulFields.push(item.field + '1')
-      } else if (_usefulFields.includes(item.field)) {
+      } else if (item.type === 'date' && _usefulFields.includes(item.field)) {
         _usefulFields.push(item.field + '1')
       } else {
         _usefulFields.push(item.field)
@@ -52,6 +53,35 @@
     this.setState({
       usefulFields: _usefulFields.join(', ')
     })
+  }
+
+  UNSAFE_componentWillReceiveProps (nextProps) {
+    if (!is(fromJS(this.props.searches), fromJS(nextProps.searches))) {
+      
+      let _usefulFields = []
+      nextProps.searches.forEach(item => {
+        if (!item.field) return
+
+        if (item.type === 'group') {
+          if (item.transfer === 'true') {
+            _usefulFields.push(item.field)
+          }
+          _usefulFields.push(item.datefield)
+          _usefulFields.push(item.datefield + '1')
+        } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) {
+          _usefulFields.push(item.field)
+          _usefulFields.push(item.field + '1')
+        } else if (item.type === 'date' && _usefulFields.includes(item.field)) {
+          _usefulFields.push(item.field + '1')
+        } else {
+          _usefulFields.push(item.field)
+        }
+      })
+
+      this.setState({
+        usefulFields: _usefulFields.join(', ')
+      })
+    }
   }
 
   edit = (record) => {
@@ -69,7 +99,7 @@
       editItem: null
     })
     this.props.form.setFieldsValue({
-      sql: ''
+      sql: ' '
     })
   }
 
@@ -128,9 +158,13 @@
             loading: false
           })
           this.props.form.setFieldsValue({
-            sql: ''
+            sql: ' '
           })
           this.props.scriptSubmit(values)
+        }, () => {
+          this.setState({
+            loading: false
+          })
         })
       }
     })
@@ -178,18 +212,18 @@
               {setting.tableName}
             </Form.Item>
           </Col> : null}
-          <Col span={16}>
+          <Col span={8}>
             <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0}}>
               ErrorCode, retmsg
             </Form.Item>
           </Col>
           <Col span={24} className="sqlfield">
             <Form.Item label={'鍙敤瀛楁'}>
-              id, bid, loginuid, sessionuid, userid, appkey, time_id, calendarDate, calendarDate1{usefulFields ? ', ' + usefulFields : ''}
+              id, bid, loginuid, sessionuid, userid, appkey, time_id{usefulFields ? ', ' + usefulFields : ''}
             </Form.Item>
           </Col>
-          <Col span={10}>
-            <Form.Item label={'蹇嵎娣诲姞'} style={{marginBottom: 0}}>
+          <Col span={10} style={{width: '43%'}}>
+            <Form.Item label={'蹇嵎娣诲姞'} labelCol={{xs: { span: 24 }, sm: { span: 6 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 18 }} } style={{marginBottom: 0}}>
               <Select
                 showSearch
                 filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}

--
Gitblit v1.8.0