From 0c84df247914f893ef5e41d57a422e10a2dc814c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 12 十一月 2021 17:02:06 +0800
Subject: [PATCH] 2021-11-12

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

diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 5e448f2..5bc26a1 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
+import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
+import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -35,6 +36,7 @@
   state = {
     initsql: '',            // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪��
     notes: [],              // 鐭俊妯℃澘
+    setting: null,
     verify: {},
     fields: [],
     usefulfields: '',
@@ -97,13 +99,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       }
@@ -133,13 +135,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       },
@@ -207,13 +209,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       }
@@ -259,13 +261,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       },
@@ -276,14 +278,14 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
+            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
               title={this.props.dict['model.query.delete']}
               onConfirm={() => this.handleDelete(record, 'customverify')
             }>
-              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
+              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
             </Popconfirm>
           </div>)
       }
@@ -328,13 +330,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       },
@@ -345,14 +347,14 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
+            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
               title={this.props.dict['model.query.delete']}
               onConfirm={() => this.handleDelete(record, 'scripts')
             }>
-              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
+              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
             </Popconfirm>
           </div>)
       }
@@ -395,13 +397,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       },
@@ -412,14 +414,14 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
+            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
               title={this.props.dict['model.query.delete']}
               onConfirm={() => this.handleDelete(record, 'cbscripts')
             }>
-              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
+              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
             </Popconfirm>
           </div>)
       }
@@ -496,13 +498,13 @@
           (
             <div>
               {this.props.dict['model.status.forbidden']}
-              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
             </div>
           ) :
           (
             <div>
               {this.props.dict['model.status.open']}
-              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
             </div>
           )
       },
@@ -513,14 +515,14 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
+            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
               title={this.props.dict['model.query.delete']}
               onConfirm={() => this.handleDelete(record, 'ordercode')
             }>
-              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
+              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
             </Popconfirm>
           </div>)
       }
@@ -572,6 +574,7 @@
     }
 
     this.setState({
+      setting: config.setting || {},
       verify: _verify
     })
 
@@ -624,9 +627,9 @@
         resolve(_fields)
       }
     }).then(_fields => {
-      let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'login_city', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
-      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@login_city nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)']
-      let _select = ['@UserName=\'\'', '@FullName=\'\'', '@login_city=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'']
+      let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'login_city', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
+      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@login_city nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)']
+      let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@login_city=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'']
       let fieldArr = _usefulfields.map(_f => _f.toLowerCase())
       let hasBid = false
 
@@ -671,9 +674,6 @@
 
       if (!hasBid) { // 鍞竴鎬ч獙璇佹坊鍔燘ID
         uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' })
-      }
-
-      if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 琛ㄥ崟涓鍔燘ID
         _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' })
         fieldArr.push('bid')
         _declare.push(`@bid nvarchar(50)`)
@@ -809,9 +809,15 @@
           if (!_arr.includes('submituserid')) {
             _form.push('submituserid=@userid@')
           }
+          if (!_arr.includes('submituser')) {
+            _form.push('submituser=@username')
+          }
         } else {
           if (!_arr.includes('modifydate')) {
             _form.push('modifydate=getdate()')
+          }
+          if (!_arr.includes('modifyuser')) {
+            _form.push('modifyuser=@username')
           }
           if (!_arr.includes('modifyuserid')) {
             _form.push('modifyuserid=@userid@')
@@ -831,7 +837,7 @@
         }
 
         _form = _form.join(', ')
-        _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
+        _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
       }
 
       if (card.sqlType === 'insert') {
@@ -840,7 +846,7 @@
         _defaultsql = _updatesql
       } else if (card.sqlType === 'insertOrUpdate') {
         _defaultsql += `select @tbid=''
-          select @tbid='X' from ${card.sql} where ${config.setting.primaryKey}=@ID@
+          select @tbid='X' from ${card.sql} where ${config.setting.primaryKey || 'id'}=@ID@
           if @tbid=''
             begin
             ${_insertsql}
@@ -855,7 +861,7 @@
         if (_verify.voucher && _verify.voucher.enabled) {
           _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear'
         }
-        _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
+        _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
       } else if (card.sqlType === 'delete') {
         let _msg = ''
         if (columns && columns.length > 0 && card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') {
@@ -867,7 +873,7 @@
             _index++
           })
         }
-        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${config.setting.primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
+        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${config.setting.primaryKey || 'id'}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
       }
 
       let _columns = []
@@ -1313,6 +1319,7 @@
 
   handleConfirm = () => {
     const { card } = this.props
+    const { setting } = this.state
     let verify = fromJS(this.state.verify).toJS()
     
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -1328,6 +1335,13 @@
         notification.warning({
           top: 92,
           message: '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�',
+          duration: 5
+        })
+        return
+      } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 100) {
+        notification.warning({
+          top: 92,
+          message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�',
           duration: 5
         })
         return
@@ -1413,7 +1427,7 @@
                 {this.props.card.sqlType !== 'custom' ? <Col span={8}>
                   <Form.Item label={
                     <Tooltip placement="bottomLeft" title={'榛樿sql鎵ц椤哄簭涓鸿嚜瀹氫箟鑴氭湰涔嬪墠'}>
-                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      <QuestionCircleOutlined className="mk-form-tip" />
                       榛樿sql
                     </Tooltip>
                   }>
@@ -1445,7 +1459,7 @@
                 {verify.accountdate === 'true' ? <Col span={8}>
                   <Form.Item label={
                     <Tooltip placement="bottomLeft" title={'楠岃瘉鏃ユ湡涓虹┖鏃讹紝榛樿涓哄綋澶┿��'}>
-                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      <QuestionCircleOutlined className="mk-form-tip" />
                       楠岃瘉鏃ユ湡
                     </Tooltip>
                   }>
@@ -1469,7 +1483,7 @@
                 <Col span={8}>
                   <Form.Item label={
                     <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}>
-                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      <QuestionCircleOutlined className="mk-form-tip" />
                       鍙戦�佺煭淇�
                     </Tooltip>
                   }>
@@ -1493,7 +1507,7 @@
                 {verify.noteEnable === 'true' ? <Col span={8}>
                   <Form.Item label={
                     <Tooltip placement="bottomLeft" title={'瀹炴椂鍙戦�佹渶澶氬悓鏃跺彂閫�5涓敤鎴凤紝瀹氭椂鍙戦�佹渶澶氬悓鏃跺彂閫�100涓敤鎴枫��'}>
-                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      <QuestionCircleOutlined className="mk-form-tip" />
                       鍙戦�佹柟寮�
                     </Tooltip>
                   }>

--
Gitblit v1.8.0