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.js |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index bc7e3d2..f19e5a3 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1820,9 +1820,20 @@
   let _initFormfields = []
   let _initColfields = []
   let _declarefields = []
+  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 (!_initvars.includes(_key)) {
@@ -1830,7 +1841,7 @@
       let val = form.value
 
       if (form.type === 'number' || form.type === 'rate') {
-        if (isNaN(val)) {
+        if (isNaN(val) || val === '') {
           val = 0
         }
         _initFormfields.push(`@${_key}=${val}`)
@@ -2879,6 +2890,10 @@
     _sql += _backCustomScript
   }
 
+  if (verifyValSql) {
+    _sql += verifyValSql
+  }
+
   if (window.GLOB.breakpoint) {
     let start = new RegExp('\\/\\*\\$breakpoint_begin_' + window.GLOB.breakpoint + '@', 'ig')
     let end = new RegExp('@breakpoint_end_' + window.GLOB.breakpoint + '\\$\\*\\/', 'ig')

--
Gitblit v1.8.0