From b3547d1c531e479021219fda5df153a11b9b52a3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 31 八月 2020 17:28:09 +0800
Subject: [PATCH] 2020-08-31

---
 src/utils/utils.js |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index 7808f1e..3c58522 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -689,7 +689,7 @@
     arrfield = arrfield.join(',')
 
     if (item.orderBy) {
-      sql = 'select distinct ' + arrfield + ',' + item.orderBy + ' as orderfield from ' + _datasource + ' order by orderfield ' + item.orderType
+      sql = `select ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}`
     } else {
       sql = 'select distinct ' + arrfield + ' from ' + _datasource
     }
@@ -765,11 +765,11 @@
 
           val = val.replace(/(^\s*$)|\t*|\v*/ig, '')
 
-          if (!val && col.required === 'true') { // 蹇呭~鏍¢獙
+          if (!val && col.required === 'true') {            // 蹇呭~鏍¢獙
             errors.push(_position + dict['main.excel.content.emptyerror'])
-          } else if (val.length > col.limit) {    // 闀垮害鏍¢獙
+          } else if (col.limit && val.length > col.limit) { // 闀垮害鏍¢獙
             errors.push(_position + dict['main.excel.content.maxlimit'])
-          } else {                               // 鍏抽敭瀛楁牎楠�
+          } else {                                          // 鍏抽敭瀛楁牎楠�
             keys.forEach(key => {
               let _patten = new RegExp('(^' + key + '\\s+)|(\\s+' + key + '\\s+)', 'ig')
               if (_patten.test(val)) {
@@ -948,8 +948,7 @@
         
         aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 
-      // if (window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') {
-      if (window.GLOB.systemType !== 'production') {
+      if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
         let fsql = `
         ${_sql}
         ${_sqlInsert}
@@ -1430,6 +1429,8 @@
       let values = []
 
       formdata.forEach(item => {
+        if (item.writein === false) return
+
         keys.push(item.key.toLowerCase())
         values.push('@' + item.key)
       })
@@ -1473,6 +1474,8 @@
       let _arr = []
 
       formdata.forEach(item => {
+        if (item.writein === false) return
+        
         _arr.push(item.key.toLowerCase())
         _form.push(item.key + '=@' + item.key)
       })
@@ -1582,8 +1585,7 @@
     _sql += `
         aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 
-    // if (window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') {
-    if (window.GLOB.systemType !== 'production') {
+    if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
       _sql = _sql.replace(/\n\s{8}/ig, '\n')
       console.log(_sql)
     }

--
Gitblit v1.8.0