From 7da23c8a73681703f42c4c5a4c907dc17acf8b8f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 26 三月 2024 21:22:17 +0800
Subject: [PATCH] 2024-03-26

---
 src/utils/utils.js |   78 +++++++++++++++++++++++++++++---------
 1 files changed, 59 insertions(+), 19 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index 54eec04..6d953ff 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 = ''
@@ -538,6 +551,11 @@
           newsearches[item.key] = _startval
           newsearches[item.key + '1'] = _endval
         }
+      } else if (item.type === 'range') {
+        let val = item.value.split(',')
+
+        newsearches[item.key] = val[0] || -999999
+        newsearches[item.key + '1'] = val[1] || 999999
       } else if (item.type === 'dateweek') {
         let _startval = ''
         let _endval = ''
@@ -685,7 +703,7 @@
       } else if (item.type === 'range') {
         let val = item.value.split(',')
 
-        searchText.push('(' + item.key + ' >= \'' + val[0] + '\' AND ' + item.key + ' < \'' + val[1] + '\')')
+        searchText.push('(' + item.key + ' >= ' + (val[0] || -999999) + ' AND ' + item.key + ' < ' + (val[1] || 999999) + ')')
       } else {
         searchText.push('(' + item.key + ' ' + item.match + ' \'' + item.value + '\')')
       }
@@ -721,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)) {
@@ -744,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'
@@ -756,9 +774,20 @@
           options.push(item)
           options.push(copy)
         }
+      } else if (item.type === 'range') {
+        let val = item.value.split(',')
+
+        let copy = JSON.parse(JSON.stringify(item))
+        copy.key = copy.key + '1'
+        copy.value = val[1] || 999999
+        
+        item.value = val[0] || -999999
+
+        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'
@@ -769,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(',')
@@ -1140,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
@@ -1360,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
@@ -1620,6 +1649,14 @@
   _sql = `/* 绯荤粺鐢熸垚 */
       Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@mk_deleted int,@bid nvarchar(50)${_declarefields}
     `
+
+  if (btn.$process && verify.workFlow === 'true' && window.GLOB.UserCacheMap.has(btn.$flowId)) {
+    _sql += `
+      /* 宸ヤ綔娴佸彉閲忓畾涔変笌璧嬪�� */
+      Declare @works_flow_code nvarchar(50),@works_flow_name nvarchar(50),@works_flow_param nvarchar(4000),@works_flow_detail_id nvarchar(50),@status int,@statusname nvarchar(50), @work_group nvarchar(50),@work_grade int, @start_type nvarchar(50),@check_type nvarchar(50),@notice_type nvarchar(50),@check_userids nvarchar(512),@notice_userids nvarchar(512)
+      select @works_flow_code=@works_flow_code@,@works_flow_name=@works_flow_name@,@works_flow_param=@works_flow_param@,@works_flow_detail_id=@works_flow_detail_id@,@status=@status@,@statusname=@statusname@,@work_group=@work_group@,@work_grade=@work_grade@, @start_type=@start_type@,@check_type=@check_type@,@notice_type=@notice_type@,@check_userids=@check_userids@,@notice_userids=@notice_userids@
+      `
+  }
 
   let userName = sessionStorage.getItem('User_Name') || '' 
   let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -2297,6 +2334,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