From 8b6f9a84e5eb704b25c105cce31904381bd81107 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 29 十一月 2022 18:41:58 +0800
Subject: [PATCH] 2022-11-29

---
 src/templates/zshare/verifycard/customform/index.jsx                              |   16 ++
 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx |    2 
 src/tabviews/zshare/actionList/normalbutton/index.jsx                             |  190 +++++++++++++++++++++++--------------
 src/templates/zshare/verifycard/index.jsx                                         |   10 -
 src/tabviews/zshare/actionList/excelInbutton/index.jsx                            |   81 ++++++++++++++--
 5 files changed, 208 insertions(+), 91 deletions(-)

diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 97a19f4..09ee076 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -14,6 +14,8 @@
 import MkIcon from '@/components/mk-icon'
 // import './index.scss'
 
+const { confirm } = Modal
+
 class ExcelInButton extends Component {
   static propTpyes = {
     BID: PropTypes.string,            // 涓昏〃ID
@@ -337,29 +339,86 @@
       
       param.excel_in_type = 'true'
       param.LText1 = Utils.formatOptions(result.insert)
-      param.LText2 = Utils.formatOptions(result.bottom)
-      param.LText = Utils.formatOptions(result.sql)
       param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      param.LText2 = result.bottom
+      param.LText = result.sql
+
+      let unCheckParam = null
+
+      if (/\$check@|@check\$/ig.test(param.LText2) || /\$check@|@check\$/ig.test(param.LText)) {
+        unCheckParam = fromJS(param).toJS()
+        param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
+        param.LText2 = param.LText2.replace(/\$check@|@check\$/ig, '')
+      }
+
+      param.LText2 = Utils.formatOptions(param.LText2)
+      param.LText = Utils.formatOptions(param.LText)
       param.secretkey = Utils.encrypt(param.LText, param.timestamp)
       if (window.GLOB.mkHS && param.timestamp) { // 浜戠楠岃瘉
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
       }
 
       param.menuname = btn.logLabel
-
+      
       if (window.GLOB.probation) {
         param.s_debug_type = 'Y'
       }
 
-      Api.genericInterface(param).then((res) => {
-        if (res.status) {
-          this.execSuccess(res)
-        } else {
-          this.execError(res)
+      if (unCheckParam) {
+        unCheckParam.LText = unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
+        unCheckParam.LText = Utils.formatOptions(unCheckParam.LText)
+        unCheckParam.LText2 = unCheckParam.LText2.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
+        unCheckParam.LText2 = Utils.formatOptions(unCheckParam.LText2)
+
+        unCheckParam.secretkey = Utils.encrypt(unCheckParam.LText, unCheckParam.timestamp)
+
+        unCheckParam.menuname = btn.logLabel
+
+        if (window.GLOB.probation) {
+          unCheckParam.s_debug_type = 'Y'
         }
-      }, () => {
-        this.execError({})
-      })
+
+        Api.genericInterface(param).then(res => {
+          if (res.status) {
+            this.execSuccess(res)
+          } else if (res.ErrCode === 'C') {
+            const _this = this
+            confirm({
+              title: '缁х画鎵ц锛�',
+              content: res.message,
+              onOk() {
+                return new Promise(resolve => {
+                  Api.genericInterface(unCheckParam).then(result => {
+                    if (result.status) {
+                      _this.execSuccess(result)
+                    } else {
+                      _this.execError(result)
+                    }
+                    resolve()
+                  })
+                })
+              },
+              onCancel() {
+                _this.execError(res)
+              }
+            })
+          } else {
+            this.execError(res)
+          }
+        }, () => {
+          this.execError({})
+        })
+      } else {
+        Api.genericInterface(param).then((res) => {
+          if (res.status) {
+            this.execSuccess(res)
+          } else {
+            this.execError(res)
+          }
+        }, () => {
+          this.execError({})
+        })
+      }
     } else if (btn.intertype === 'inner' && btn.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋�
       param.func = btn.innerFunc
 
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index bdbd6f8..7b6b06b 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -42,7 +42,6 @@
     loadingTotal: '',
     disabled: false,
     hidden: false,
-    checkParam: null,
     autoMatic: false,
     check: false
   }
@@ -402,7 +401,6 @@
       let param = { // 绯荤粺瀛樺偍杩囩▼
         func: 'sPC_TableData_InUpDe'
       }
-      let check_param = null
 
       if (this.props.BID) {
         param.BID = this.props.BID
@@ -442,11 +440,9 @@
         param.secretkey = Utils.encrypt('', param.timestamp)
 
         if (/\$check@|@check\$/ig.test(param.LText)) {
-          check_param = fromJS(param).toJS()
-          check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
-          check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
-          check_param.LText = Utils.formatOptions(check_param.LText)
-
+          if (btn.intertype === 'system') {
+            param.$unCheckParam = fromJS(param).toJS()
+          }
           param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
         }
 
@@ -487,11 +483,9 @@
           param.secretkey = Utils.encrypt('', param.timestamp)
 
           if (/\$check@|@check\$/ig.test(param.LText)) {
-            check_param = fromJS(param).toJS()
-            check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
-            check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
-            check_param.LText = Utils.formatOptions(check_param.LText)
-
+            if (btn.intertype === 'system') {
+              param.$unCheckParam = fromJS(param).toJS()
+            }
             param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
           }
 
@@ -522,11 +516,9 @@
           param.secretkey = Utils.encrypt('', param.timestamp)
 
           if (/\$check@|@check\$/ig.test(param.LText)) {
-            check_param = fromJS(param).toJS()
-            check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
-            check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
-            check_param.LText = Utils.formatOptions(check_param.LText)
-
+            if (btn.intertype === 'system') {
+              param.$unCheckParam = fromJS(param).toJS()
+            }
             param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
           }
 
@@ -536,9 +528,6 @@
 
       if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
-        if (check_param) {
-          check_param.open_key = Utils.encryptOpenKey(check_param.secretkey, check_param.timestamp)
-        }
       }
 
       param.menuname = btn.logLabel
@@ -547,13 +536,18 @@
         param.s_debug_type = 'Y'
       }
 
-      if (check_param) {
-        check_param.menuname = btn.logLabel
-        this.setState({checkParam: check_param})
-      }
-
       if (window.GLOB.breakpoint) {
         param.func = 'sPC_TableData_InUpDe_debug'
+      }
+
+      if (param.$unCheckParam) {
+        param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
+        param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText)
+        param.$unCheckParam.menuname = btn.logLabel
+
+        if (window.GLOB.probation) {
+          param.$unCheckParam.s_debug_type = 'Y'
+        }
       }
 
       _params.push(param)
@@ -589,11 +583,18 @@
           } else {
             param.LText = param.LText.replace(/@\$|\$@/ig, '')
           }
-          param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
 
           param.exec_type = 'y' // 鍚庡彴瑙g爜
           param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
           param.secretkey = Utils.encrypt('', param.timestamp)
+
+          if (/\$check@|@check\$/ig.test(param.LText)) {
+            if (btn.intertype === 'system') {
+              param.$unCheckParam = fromJS(param).toJS()
+            }
+            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
+          }
+
           param.LText = Utils.formatOptions(param.LText)
         } else if (btn.OpenType === 'pop') { // 琛ㄥ崟
           if (index !== 0) {
@@ -629,11 +630,18 @@
             } else {
               param.LText = param.LText.replace(/@\$|\$@/ig, '')
             }
-            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
 
             param.exec_type = 'y' // 鍚庡彴瑙g爜
             param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
             param.secretkey = Utils.encrypt('', param.timestamp)
+
+            if (/\$check@|@check\$/ig.test(param.LText)) {
+              if (btn.intertype === 'system') {
+                param.$unCheckParam = fromJS(param).toJS()
+              }
+              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
+            }
+
             param.LText = Utils.formatOptions(param.LText)
           } else {
             param.ID = primaryId
@@ -655,11 +663,18 @@
             } else {
               param.LText = param.LText.replace(/@\$|\$@/ig, '')
             }
-            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
 
             param.exec_type = 'y' // 鍚庡彴瑙g爜
             param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
             param.secretkey = Utils.encrypt('', param.timestamp)
+
+            if (/\$check@|@check\$/ig.test(param.LText)) {
+              if (btn.intertype === 'system') {
+                param.$unCheckParam = fromJS(param).toJS()
+              }
+              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
+            }
+
             param.LText = Utils.formatOptions(param.LText)
           }
         }
@@ -675,6 +690,16 @@
 
         if (window.GLOB.breakpoint) {
           param.func = 'sPC_TableData_InUpDe_debug'
+        }
+
+        if (param.$unCheckParam) {
+          param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
+          param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText)
+          param.$unCheckParam.menuname = btn.logLabel
+  
+          if (window.GLOB.probation) {
+            param.$unCheckParam.s_debug_type = 'Y'
+          }
         }
 
         return param
@@ -995,7 +1020,9 @@
         params = this.getInnerParam(data, formdata)
       }
 
-      if (params.length <= 20) {
+      if (params[0].$unCheckParam) {
+        this.checkLoopRequest(params, btn, _resolve)
+      } else if (params.length <= 20) {
         let deffers = params.map((param, i) => {
           return new Promise(resolve => {
             setTimeout(() => {
@@ -1529,6 +1556,69 @@
         } else {
           this.innerLoopRequest(params, btn, _resolve)
         }
+      } else {
+        this.execError(res)
+        _resolve()
+      }
+    }, () => {
+      this.updateStatus()
+      _resolve()
+    })
+  }
+
+  /**
+   * @description 鏁版嵁妫�楠屽惊鐜墽琛�
+   */
+  checkLoopRequest = (params, btn, _resolve) => {
+    let param = params.shift()
+    let unCheckParam = param.$unCheckParam
+
+    delete param.$unCheckParam
+
+    this.setState({
+      loadingNumber: params.length
+    })
+
+    Api.genericInterface(param).then(res => {
+      if (res.status) {
+        this.triggerNote(res) // 娑堟伅
+
+        if (params.length === 0) {
+          this.execSuccess(res)
+          _resolve()
+        } else {
+          this.checkLoopRequest(params, btn, _resolve)
+        }
+      } else if (res.ErrCode === 'C') {
+        const _this = this
+        confirm({
+          title: '缁х画鎵ц锛�',
+          content: res.message,
+          onOk() {
+            return new Promise(resolve => {
+              Api.genericInterface(unCheckParam).then(result => {
+                if (result.status) {
+                  _this.triggerNote(result) // 娑堟伅
+          
+                  if (params.length === 0) {
+                    _this.execSuccess(result)
+                    _resolve()
+                  } else {
+                    _this.checkLoopRequest(params, btn, _resolve)
+                  }
+                } else {
+                  _this.execError(res)
+                  _resolve()
+                }
+                resolve()
+              })
+            })
+          },
+          onCancel() {
+            _this.execError(res)
+            _resolve()
+          }
+        })
       } else {
         this.execError(res)
         _resolve()
@@ -2245,48 +2335,6 @@
       loadingNumber: '',
       loadingTotal: '',
     })
-
-    if (res.ErrCode === 'C') {
-      const _this = this
-      if (this.state.checkParam) {
-        let param = this.state.checkParam
-        confirm({
-          title: res.message || res.ErrMesg,
-          content: '缁х画鎵ц锛�',
-          onOk() {
-            return new Promise(resolve => {
-              Api.genericInterface(param).then((result) => {
-                if (result.status) {
-                  _this.execSuccess(result)
-                } else {
-                  _this.execError(result)
-                }
-                resolve()
-              }, () => {
-                _this.setState({
-                  visible: false
-                })
-                resolve()
-              })
-            })
-          },
-          onCancel() {
-            _this.setState({
-              visible: false
-            })
-            if (btn.execError !== 'never') {
-              MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
-            }
-          }
-        })
-        this.setState({checkParam: null})
-        return
-      } else {
-        Modal.error({
-          title: res.message || res.ErrMesg,
-        })
-      }
-    }
 
     if (btnconfig && btnconfig.setting && btnconfig.setting.errFocus) {
       MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus)
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
index 31105a0..f288e7d 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
@@ -183,7 +183,7 @@
         }
 
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
+        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
         param.LText = param.LText.replace(/\n/g, ' ')
         
         // 澶栬仈鏁版嵁搴撴浛鎹�
diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx
index be0e47b..32a9516 100644
--- a/src/templates/zshare/verifycard/customform/index.jsx
+++ b/src/templates/zshare/verifycard/customform/index.jsx
@@ -106,8 +106,18 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: this.props.initsql + values.sql
         }
+
+        param.LText = `${this.props.initsql}
+          /* 鑷畾涔夐獙璇� */
+          select @tbid='', @ErrorCode='',@retmsg=''
+          select top 1 @tbid='X' from (${values.sql}) a
+          If @tbid = ''
+          Begin
+            select @ErrorCode='${values.errorCode}',@retmsg='${values.errmsg}'
+            goto aaa
+          end
+          aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 
         if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
           window.GLOB.funcs.forEach(item => {
@@ -126,8 +136,10 @@
 
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
+
+        console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{10}/ig, '\n')}`)
+
         param.LText = param.LText.replace(/\n/g, ' ')
-        
         param.LText = Utils.formatOptions(param.LText)
         param.secretkey = Utils.encrypt('', param.timestamp)
         
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index c198cbb..8b7680b 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -664,8 +664,8 @@
         resolve(_fields)
       }
     }).then(_fields => {
-      let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
-      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(512)', '@mk_organization nvarchar(512)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)']
+      let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid']
+      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(512)', '@mk_organization nvarchar(512)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)']
       let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'']
       let fieldArr = _usefulfields.map(_f => _f.toLowerCase())
       let hasBid = false
@@ -724,10 +724,8 @@
       let hasColumn = false
       if (columns && columns.length > 0) {
         if (btnTab) { // 琛ㄥ崟鏍囩
-          if (btnTab.Ot !== 'notRequired' && btnTab.Ot !== 'requiredOnce') {
-            hasColumn = true
-          }
-        } else if (card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') {
+          hasColumn = btnTab.Ot !== 'notRequired'
+        } else if (card.Ot !== 'notRequired') {
           hasColumn = true
         }
       }

--
Gitblit v1.8.0