From 08cce3334a2dc81d690b518136b0aaea64e48b0b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 14 六月 2023 09:55:50 +0800
Subject: [PATCH] 2023-06-14

---
 src/utils/utils.js |   49 +++++++++++++++----------------------------------
 1 files changed, 15 insertions(+), 34 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index f09195e..5f9d942 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -808,6 +808,8 @@
     }
     if (['select', 'radio', 'link', 'checkcard'].includes(item.type) && item.linkSubField && item.linkSubField.length > 0) {
       arrfield.push(...item.linkSubField)
+    } else if (item.type === 'text' && item.editType === 'select' && item.linkSubField && item.linkSubField.length > 0) { // 鍙紪杈戣〃
+      arrfield.push(...item.linkSubField)
     }
     if (item.disableField) {
       arrfield.push(item.disableField)
@@ -958,9 +960,7 @@
       let _position = (_topline + lindex + 1) + '琛� ' + _colindex + '鍒� '
 
       if (/^Nvarchar/ig.test(col.type)) {
-        if (typeof(val) === 'number') {
-          val = val.toString()
-        }
+        val = val + ''
 
         if (/'/.test(val)) {
           val = val.replace(/'/ig, '"')
@@ -980,38 +980,15 @@
             }
           })
         }
-      } else if (/^int/ig.test(col.type)) {
+      } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) {
         if (!val && val !== 0) {
           errors.push(_position + '鍐呭涓嶅彲涓虹┖')
-        } else {
-          let _val = val + ''
-
-          if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) {               // 妫�楠屾槸鍚︿负鏁存暟
-            errors.push(_position + '鍐呭搴斾负鏁存暟')
-          } else if ((col.min || col.min === 0) && val < col.min) {          // 鏈�灏忓�兼楠�
-            errors.push(_position + '灏忎簬鏈�灏忓��')
-          } else if ((col.max || col.max === 0) && val > col.max) {          // 鏈�澶у�兼楠�
-            errors.push(_position + '澶т簬鏈�澶у��')
-          }
-        }
-      } else if (/^Decimal/ig.test(col.type)) {
-        if (!val && val !== 0) {
-          errors.push(_position + '鍐呭涓嶅彲涓虹┖')
-        } else {
-          let _val = val + ''
-          let _vals = _val.split('.')
-
-          if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) {                           // 妫�楠屾槸鍚︿负娴偣鏁�
-            errors.push(_position + '鍐呭搴斾负娴偣鏁�')
-          } else if (_vals[0].length > 18) {                          // 妫�楠屾暣鏁颁綅
-            errors.push(_position + '鏁存暟浣嶈秴鍑鸿寖鍥�')
-          } else if (_vals[1] && _vals[1].length > col.limit) {       // 鏈�灏忓�兼楠�
-            errors.push(_position + '灏忔暟浣嶈秴鍑鸿寖鍥�')
-          } else if ((col.min || col.min === 0) && val < col.min) {   // 鏈�灏忓�兼楠�
-            errors.push(_position + '灏忎簬鏈�灏忓��')
-          } else if ((col.max || col.max === 0) && val > col.max) {   // 鏈�澶у�兼楠�
-            errors.push(_position + '澶т簬鏈�澶у��')
-          }
+        } else if (isNaN(val)) {                                  // 妫�楠屾槸鍚︿负鏁板��
+          errors.push(_position + '鍐呭搴斾负鏁板��')
+        } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠�
+          errors.push(_position + '灏忎簬鏈�灏忓��')
+        } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠�
+          errors.push(_position + '澶т簬鏈�澶у��')
         }
       } else if (col.type === 'date') {
         if (typeof(val) === 'number') {
@@ -1486,7 +1463,11 @@
         if (/'/.test(val)) {
           val = val.replace(/'/ig, '"')
         }
-        _initFormfields.push(`@${_key}='${val}'`)
+        if (form.isconst) {
+          _initFormfields.push(`@${_key}=N'${val}'`)
+        } else {
+          _initFormfields.push(`@${_key}='${val}'`)
+        }
       }
     }
     

--
Gitblit v1.8.0