From eb31b84962c192de57abbb473cb4733a09bf4363 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 五月 2020 18:09:40 +0800
Subject: [PATCH] 2020-05-14

---
 src/templates/zshare/verifycard/index.jsx |   80 ++++++++++++++++++++-------------------
 1 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index c6c0af2..330c683 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1,6 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip } from 'antd'
+import { fromJS } from 'immutable'
+import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -13,10 +14,10 @@
 import BillcodeForm from './billcodeform'
 import VoucherForm from './voucherform'
 import './index.scss'
-import { fromJS } from 'immutable';
 
 const { TabPane } = Tabs
 const { confirm } = Modal
+const { Paragraph } = Typography
 
 class VerifyCard extends Component {
   static propTpyes = {
@@ -166,7 +167,10 @@
       {
         title: 'SQL',
         dataIndex: 'sql',
-        width: '45%'
+        width: '45%',
+        render: (text) => (
+          <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph>
+        )
       },
       {
         title: '缁撴灉澶勭悊',
@@ -227,7 +231,10 @@
       {
         title: 'SQL',
         dataIndex: 'sql',
-        width: '60%'
+        width: '60%',
+        render: (text) => (
+          <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph>
+        )
       },
       {
         title: '鎵ц浣嶇疆',
@@ -521,7 +528,7 @@
 
         if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) {
           keys.push(config.setting.primaryKey.toLowerCase())
-          values.push('\'\'')
+          values.push('@ID@')
         }
         if (!keys.includes('createuserid')) {
           keys.push('createuserid')
@@ -540,8 +547,8 @@
           values.push('@BID@')
         }
   
-        keys = keys.join(',')
-        values = values.join(',')
+        keys = keys.join(', ')
+        values = values.join(', ')
         _insertsql = `insert into ${this.props.card.sql} (${keys}) select ${values};`
       }
       
@@ -574,14 +581,9 @@
             _form.push('FiYear=@FiYear')
           }
         }
-        
-        let primaryKeyName = config.setting.primaryKey
-        if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) {
-          primaryKeyName = primaryKeyName + '@'
-        }
 
-        _form = _form.join(',')
-        _updatesql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@${primaryKeyName};`
+        _form = _form.join(', ')
+        _updatesql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@ID@;`
       }
 
       let _defaultsql = ''
@@ -764,7 +766,7 @@
 
             if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) {
               keys.push(config.setting.primaryKey.toLowerCase())
-              values.push('\'\'')
+              values.push('@ID@')
             }
             if (!keys.includes('createuserid')) {
               keys.push('createuserid')
@@ -783,10 +785,10 @@
               values.push('@BID@')
             }
       
-            keys = keys.join(',')
-            values = values.join(',')
+            keys = keys.join(', ')
+            values = values.join(', ')
             _defaultsql = `insert into ${this.props.card.sql} (${keys}) select ${values};`
-          } else if (this.props.card.sqlType === 'update') {
+          } else if (this.props.card.sqlType === 'update' || this.props.card.sqlType === 'audit') {
             let _form = []
             let _arr = []
 
@@ -797,11 +799,20 @@
               _form.push(item.field + '=@' + item.field)
             })
 
-            if (!_arr.includes('modifydate')) {
-              _form.push('modifydate=getdate()')
-            }
-            if (!_arr.includes('modifyuserid')) {
-              _form.push('modifyuserid=@userid@')
+            if (this.props.card.sqlType === 'audit') {
+              if (!_arr.includes('submitdate')) {
+                _form.push('submitdate=getdate()')
+              }
+              if (!_arr.includes('submituserid')) {
+                _form.push('submituserid=@userid@')
+              }
+            } else {
+              if (!_arr.includes('modifydate')) {
+                _form.push('modifydate=getdate()')
+              }
+              if (!_arr.includes('modifyuserid')) {
+                _form.push('modifyuserid=@userid@')
+              }
             }
 
             if (_verify.voucher && _verify.voucher.enabled) {
@@ -815,14 +826,9 @@
                 _form.push('FiYear=@FiYear')
               }
             }
-            
-            let primaryKeyName = config.setting.primaryKey
-            if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) {
-              primaryKeyName = primaryKeyName + '@'
-            }
 
-            _form = _form.join(',')
-            _defaultsql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@${primaryKeyName};`
+            _form = _form.join(', ')
+            _defaultsql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@ID@;`
           }
           
           this.setState({
@@ -891,14 +897,9 @@
 
       // 榛樿sql
       let _defaultsql = ''
-      let primaryKeyName = config.setting.primaryKey
-
-      if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) {
-        primaryKeyName = primaryKeyName + '@'
-      }
 
       if (this.props.card.sqlType === 'LogicDelete') {
-        _defaultsql = `update ${this.props.card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}=@${primaryKeyName};`
+        _defaultsql = `update ${this.props.card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}=@ID@;`
       } else if (this.props.card.sqlType === 'delete') {
         let _msg = ''
         if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') {
@@ -910,7 +911,7 @@
             }
           })
         }
-        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${this.props.card.sql} 鏁版嵁: ${_msg}${config.setting.primaryKey}='+@${primaryKeyName},200),@userid@,@username,@fullname delete ${this.props.card.sql} where ${config.setting.primaryKey}=@${primaryKeyName};`
+        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${this.props.card.sql} 鏁版嵁: ${_msg}${config.setting.primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${this.props.card.sql} where ${config.setting.primaryKey}=@ID@;`
       }
 
       this.setState({
@@ -1520,6 +1521,7 @@
   }
 
   render() {
+    const { card } = this.props
     const { verify, fields, uniqueColumns, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state
     const formItemLayout = {
       labelCol: {
@@ -1533,7 +1535,7 @@
     }
 
     let display = false
-    if (this.props.card.intertype === 'inner' && !this.props.card.innerFunc) {
+    if (card.intertype === 'inner' && !card.innerFunc) {
       display = true
     }
 
@@ -1590,7 +1592,7 @@
               pagination={false}
             />
           </TabPane>
-          <TabPane tab="鍞竴鎬ч獙璇�" key="2">
+          <TabPane tab={card.Ot !== 'requiredOnce' ? '鍞竴鎬ч獙璇�' : '鍚岀被鏁版嵁楠岃瘉'} key="2">
             <UniqueForm
               fields={fields}
               dict={this.props.dict}

--
Gitblit v1.8.0