From 8f78c97ffcde201e2a4d1ffa7ccb97a13f0f045d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 四月 2024 15:34:15 +0800
Subject: [PATCH] 2024-04-18

---
 src/utils/utils.js |   62 +++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index e6eb0cf..c46bc39 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -204,6 +204,13 @@
       values = window.GLOB.SearchBox.get(config.$searchId + 'cache')
     }
 
+    let supModule = ''
+    if (config.setting && config.setting.supModule) {
+      supModule = config.setting.supModule
+    } else if (config.wrap && config.wrap.supModule) {
+      supModule = config.wrap.supModule
+    }
+
     config.search = config.search.map(item => {
       item.hidden = item.Hide === 'true'
       item.required = !item.hidden && item.required === 'true'
@@ -234,12 +241,14 @@
           } else {
             item.$initval = item.initval
             item.$supId = config.$pageId
-            if (config.setting && config.setting.supModule) {
-              item.$supId = config.setting.supModule
+            if (supModule) {
+              item.$supId = supModule
 
               config.checkBid = true
-              config.setting.checkBid = true
               item.checkShift = true
+              if (config.setting) {
+                config.setting.checkBid = true
+              }
             }
 
             item.initval = ''
@@ -296,12 +305,14 @@
           } else {
             item.$initval = item.initval
             item.$supId = config.$pageId
-            if (config.setting && config.setting.supModule) {
-              item.$supId = config.setting.supModule
+            if (supModule) {
+              item.$supId = supModule
 
               config.checkBid = true
-              config.setting.checkBid = true
               item.checkShift = true
+              if (config.setting) {
+                config.setting.checkBid = true
+              }
             }
 
             item.initval = ''
@@ -393,10 +404,12 @@
           item.initType = ''
         }
       } else if ((item.type === 'select' || item.type === 'link') && item.resourceType === '1') {
-        if (/@BID@/ig.test(item.dataSource) && config.setting && config.setting.supModule) {
+        if (/@BID@/ig.test(item.dataSource) && supModule) {
           config.checkBid = true
-          config.setting.checkBid = true
           item.checkBid = true
+          if (config.setting) {
+            config.setting.checkBid = true
+          }
         }
         if (item.initval === '$first') {
           item.initval = ''
@@ -541,8 +554,8 @@
       } else if (item.type === 'range') {
         let val = item.value.split(',')
 
-        newsearches[item.key] = val[0] || -999999
-        newsearches[item.key + '1'] = val[1] || 999999
+        newsearches[item.key] = val[0] || -999999999
+        newsearches[item.key + '1'] = val[1] || 999999999
       } else if (item.type === 'dateweek') {
         let _startval = ''
         let _endval = ''
@@ -690,7 +703,7 @@
       } else if (item.type === 'range') {
         let val = item.value.split(',')
 
-        searchText.push('(' + item.key + ' >= ' + (val[0] || -999999) + ' AND ' + item.key + ' < ' + (val[1] || 999999) + ')')
+        searchText.push('(' + item.key + ' >= ' + (val[0] || -999999999) + ' AND ' + item.key + ' <= ' + (val[1] || 999999999) + ')')
       } else {
         searchText.push('(' + item.key + ' ' + item.match + ' \'' + item.value + '\')')
       }
@@ -726,9 +739,9 @@
       if (item.type === 'date') {
         if (!item.value) {
           if (['>=', '>'].includes(item.match)) {
-            item.value = '1970-01-01 00:00:00.000'
+            item.value = '1900-01-01 00:00:00.000'
           } else if (['<=', '<'].includes(item.match)) {
-            item.value = '2050-01-01 00:00:00.000'
+            item.value = '3000-01-01 00:00:00.000'
           }
         } else if (search.precision === 'day') {
           if (['>=', '>'].includes(item.match)) {
@@ -749,8 +762,8 @@
         if (item.match === '=') {
           options.push(item)
         } else {
-          let _startval = item.value ? moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000' : '1970-01-01 00:00:00.000'
-          let _endval = item.value ? moment(item.value, 'YYYY-MM').endOf('month').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' : '2050-01-01 00:00:00.000'
+          let _startval = item.value ? moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000' : '1900-01-01 00:00:00.000'
+          let _endval = item.value ? moment(item.value, 'YYYY-MM').endOf('month').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' : '3000-01-01 00:00:00.000'
   
           let copy = JSON.parse(JSON.stringify(item))
           copy.key = copy.key + '1'
@@ -766,15 +779,15 @@
 
         let copy = JSON.parse(JSON.stringify(item))
         copy.key = copy.key + '1'
-        copy.value = val[1] || 999999
+        copy.value = val[1] || 999999999
         
-        item.value = val[0] || -999999
+        item.value = val[0] || -999999999
 
         options.push(item)
         options.push(copy)
       } else if (item.type === 'dateweek') {
-        let _startval = item.value ? moment(item.value, 'YYYY-MM-DD').startOf('week').format('YYYY-MM-DD') + ' 00:00:00.000' : '1970-01-01 00:00:00.000'
-        let _endval = item.value ? moment(item.value, 'YYYY-MM-DD').endOf('week').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' : '2050-01-01 00:00:00.000'
+        let _startval = item.value ? moment(item.value, 'YYYY-MM-DD').startOf('week').format('YYYY-MM-DD') + ' 00:00:00.000' : '1900-01-01 00:00:00.000'
+        let _endval = item.value ? moment(item.value, 'YYYY-MM-DD').endOf('week').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' : '3000-01-01 00:00:00.000'
 
         let copy = JSON.parse(JSON.stringify(item))
         copy.key = copy.key + '1'
@@ -785,8 +798,8 @@
         options.push(item)
         options.push(copy)
       } else if (item.type === 'daterange') {
-        let _startval = '1970-01-01 00:00:00.000'
-        let _endval = '2050-01-01 00:00:00.000'
+        let _startval = '1900-01-01 00:00:00.000'
+        let _endval = '3000-01-01 00:00:00.000'
 
         if (item.value) {
           let val = item.value.split(',')
@@ -1156,7 +1169,7 @@
       end
       
       ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid=''
-      Select top 1 @tbid=${_afields.join('+\' \'+')} from  #${sheet} a Inner join ${sheet} b on ${_fields_}
+      Select top 1 @tbid=${_afields.join('+\' \'+')} from  #${sheet} a Inner join ${database}${sheet} b on ${_fields_}
       
       If @tbid!=''
       Begin
@@ -1376,7 +1389,7 @@
       end
       
       ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid=''
-      Select top 1 @tbid=${_afields.join('+\' \'+')} from  #${sheet} a Inner join ${sheet} b on ${_fields_}
+      Select top 1 @tbid=${_afields.join('+\' \'+')} from  #${sheet} a Inner join ${database}${sheet} b on ${_fields_}
       
       If @tbid!=''
       Begin
@@ -2313,6 +2326,9 @@
         _sql = _sql.replace(/@check_userids@/ig, `''`)
         _sql = _sql.replace(/@notice_userids@/ig, `''`)
       }
+    } else {
+      _sql = _sql.replace(/@check_userids@/ig, `''`)
+      _sql = _sql.replace(/@notice_userids@/ig, `''`)
     }
 
     _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`)

--
Gitblit v1.8.0