From f9f60bb0dd17a764ba03faa8041f5b6e9e071553 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 18 一月 2025 23:37:44 +0800
Subject: [PATCH] 2025-01-18

---
 src/utils/utils-custom.js |   48 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 611c2fb..ea5e994 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -1961,14 +1961,14 @@
       if (cell.OpenType === 'form' && cell.formType === 'count_line') return
      
       if (cell.intertype === 'system') {
-        if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
-        }
+        // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+        // }
       } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
         if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
           errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣})
-        } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+        // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
         }
       }
     } else if (cell.OpenType === 'funcbutton') {
@@ -3533,6 +3533,11 @@
             isconst: item.constant === 'true'
           }
 
+          if (item.type === 'linkMain' && item.verifyVal === 'true') {
+            _item.$verify = true
+            _item.label = item.label
+          }
+
           if (_item.type === 'datemonth') {
             _item.type = 'text'
           } else if (_item.type === 'number' || _item.type === 'rate') {
@@ -3571,8 +3576,19 @@
       formdata.push(item)
     }
 
+    let verifyValSql = ''
     // 鑾峰彇瀛楁閿�煎
     formdata && formdata.forEach(form => {
+      if (form.$verify) {
+        verifyValSql += `
+        if @${form.key}=${form.type === 'number' ? 0 : `''`}
+        begin
+          select @errorcode='E',@retmsg='${form.label}锛屽叧鑱斾富琛ㄥけ鏁�'
+          goto aaa
+        end
+        `
+      }
+
       let _key = form.key.toLowerCase()
 
       if (!formkeys.includes(_key)) {
@@ -3747,22 +3763,21 @@
     if (formdata && verify.billcodes && verify.billcodes.length > 0) {
       verify.billcodes.forEach(item => {
         let _key = item.field.toLowerCase()
-        let _linkKey = item.linkField ? item.linkField.toLowerCase() : ''
   
         if (!formkeys.includes(_key)) return // 琛ㄥ崟涓笉鍚崟鍙风敓鎴愬瓧娈�
   
         let _lpline = ''
         if (item.TypeCharOne === 'Lp') {
-          if (_linkKey === 'bid' && BID) { // 鏇挎崲bid
+          if (/^BID$/ig.test(item.linkField)) {
             _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)`
           } else {
-            _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)`
+            _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${item.linkField},48)`
           }
         } else if (item.TypeCharOne === 'BN') {
-          if (_linkKey === 'bid' && BID) { // 鏇挎崲bid
+          if (/^BID$/ig.test(item.linkField)) {
             _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)`
           } else {
-            _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)`
+            _lpline = `set @ModularDetailCode= 'BN'+ right(@${item.linkField},48)`
           }
         } else {
           _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)`
@@ -3875,15 +3890,20 @@
     let hasvoucher = false
   
     // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎
-    if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'notRequired') {
+    if (verify.voucher && verify.voucher.enabled) {
       let _voucher = verify.voucher
+      let linkField = `@${_voucher.linkField}`
+  
+      if (/^BID$/ig.test(_voucher.linkField)) {
+        linkField = BID
+      }
   
       hasvoucher = true
   
       _sql += `
         /* 鍒涘缓鍑瘉 */
         exec s_BVoucher_Create
-          @Bill = @${_voucher.linkField},
+          @Bill = ${linkField},
           @BVoucherType ='${_voucher.BVoucherType}',
           @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
           @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
@@ -4277,6 +4297,10 @@
       _sql += _backCustomScript
     }
 
+    if (verifyValSql) {
+      _sql += verifyValSql
+    }
+
     if (verify.workFlow === 'true' && process) {
       if (verify.flowType === 'start') {
         _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`)

--
Gitblit v1.8.0