From 3350809003b1e92cbc8852de1c2e16fe716858a8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 02 二月 2024 17:16:33 +0800
Subject: [PATCH] 2024-02-02

---
 src/utils/utils.js |  136 ++++++++++++++++++++++----------------------
 1 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index f4dc5e3..aae25f6 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1,6 +1,7 @@
 import React from 'react'
 import moment from 'moment'
 import md5 from 'md5'
+// import NodeRSA from 'node-rsa'
 
 const formatKeys = [
   { key: 'select', value: ' msltk ' },
@@ -119,10 +120,8 @@
    * @description sql鍔犲瘑
    * @return {String}   value
    */
-  static formatOptions (value) {
+  static formatOptions (value, exec_type = '') {
     if (!value) return ''
-
-    let salt = 'minKe' // 鐩愬��
 
     value = value.replace(/\n/ig, ' \n ')
     // 鏇挎崲鍏抽敭瀛�
@@ -136,13 +135,35 @@
     if (window.GLOB.externalDatabase !== null) {
       value = value.replace(/@db@/ig, window.GLOB.externalDatabase)
     }
-    // encode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛�
-    value = window.btoa(window.encodeURIComponent(value))
-    // 鎻掑叆瀛楃
-    let index = Math.floor(value.length / 2)
-    value = value.slice(0, index) + salt + value.slice(index)
-    // base64鍔犲瘑
-    value = window.btoa(value)
+
+    if (exec_type === 'x') {
+      // let publicKey = `-----BEGIN PUBLIC KEY-----
+      //   MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwGxFURiCrk5a2xfWuM3W
+      //   2lkS3ioZhUFXpkK1inMivItsA/J8MTaBB3EAVxC29xdVCU+xOzs512PuD2b1sjzX
+      //   jwO6kx433NtB2okqGiP4RkzhEJHwdyc9dPUKdjirDznUWI9R7WayAf5Z4COhMsj2
+      //   IbkyJgkb6Ivn0UgU0GSWc92HqJJmnb3Ti2gk6A2+oybz2RE3+xB/yOaNu3xav4yi
+      //   xxo6harVLNBiaU+D7aDed1W3kE20gLOnEAvcLMjpe3n/QvF5RtELsm3T+vH3TIT2
+      //   GI9+8cT20NZ2d7i41+j/AQZiPJNS3MVmc3aIhuyCOsNPLmvbZZi1KPSJIqkCwdEg
+      //   mQIDAQAB
+      //   -----END PUBLIC KEY-----`
+
+      // let pubKey = new NodeRSA(publicKey, 'pkcs8-public')
+
+      // value = window.encodeURIComponent(value)
+      // value = pubKey.encrypt(value, 'base64')
+
+      // const priKey = new NodeRSA(privateKey, 'pkcs8-private')
+      // const res = priKey.decrypt(value, 'utf8')
+    } else {
+      // encode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛�
+      value = window.btoa(window.encodeURIComponent(value))
+      // 鎻掑叆瀛楃
+      let salt = 'minKe' // 鐩愬��
+      let index = Math.floor(value.length / 2)
+      value = value.slice(0, index) + salt + value.slice(index)
+      // base64鍔犲瘑
+      value = window.btoa(value)
+    }
 
     return value
   }
@@ -169,59 +190,6 @@
 
   //   return value
   // }
-
-  /**
-   * @description sPC_TableData_InUpDe sql鍔犲瘑
-   * @return {String}  value
-   */
-  static sPCInUpDeFormatOptions (value) {
-    if (!value) return {LText: '', LText1: '', LText2: ''}
-    let salt = 'minKe' // 鐩愬��
-
-    value = value.replace(/\n/ig, ' \n ')
-    // 鏇挎崲鍏抽敭瀛�
-    formatKeys.forEach(item => {
-      let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig')
-      value = value.replace(reg, item.value)
-    })
-
-    // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛�
-    value = value.replace(/%/ig, ' mpercent ')
-    // 澶栬仈鏁版嵁搴撴浛鎹�
-    if (window.GLOB.externalDatabase !== null) {
-      value = value.replace(/@db@/ig, window.GLOB.externalDatabase)
-    }
-
-    let encodesql = (val) => {
-      if (!val) return ''
-
-      let _value = window.btoa(window.encodeURIComponent(val))
-
-      // 鎻掑叆瀛楃
-      let index = Math.floor(_value.length / 2)
-      _value = _value.slice(0, index) + salt + _value.slice(index)
-
-      // base64鍔犲瘑
-      return window.btoa(_value)
-    }
-
-    let len = value.length
-    // 娉細LText 涓� LText1 椤哄簭棰犲��
-    if (len > 1000) {
-      let limit = Math.floor(len / 3)
-      return {
-        LText1: encodesql(value.substring(0, limit)),
-        LText: encodesql(value.substring(limit, limit * 2)),
-        LText2: encodesql(value.substring(limit * 2))
-      }
-    } else {
-      return {
-        LText1: '',
-        LText: encodesql(value),
-        LText2: ''
-      }
-    }
-  }
 
   /**
    * @description 鍒濆鍖栨悳绱㈡潯浠跺垵濮嬪��
@@ -264,7 +232,38 @@
         item.initval = item.initval ? moment().subtract(item.initval, 'days').format(format) : ''
       } else if (item.type === 'datemonth') {
         item.format = 'YYYY-MM'
-        item.initval = item.initval ? moment().subtract(item.initval, 'month').format('YYYY-MM') : ''
+
+        if (item.initval) {
+          if (!item.dateShift) {
+            item.initval = moment().subtract(item.initval, 'month').format('YYYY-MM')
+          } else {
+            item.$initval = item.initval
+            item.$supId = config.$pageId
+            if (config.setting && config.setting.supModule) {
+              item.$supId = config.setting.supModule
+
+              config.checkBid = true
+              config.setting.checkBid = true
+              item.checkShift = true
+            }
+
+            item.initval = ''
+
+            let d = ''
+            if (window.GLOB.CacheData.has(item.$supId)) {
+              d = window.GLOB.CacheData.get(item.$supId)
+              d = d[item.dateShift] || ''
+              if (d) {
+                d = moment(d).format('YYYY-MM-DD')
+                d = d === 'Invalid date' ? '' : d
+              }
+            }
+
+            if (d) {
+              item.initval = moment(d).subtract(item.initval, 'month').format('YYYY-MM')
+            }
+          }
+        }
       } else if (item.type === 'dateweek') {
         item.format = 'YYYY-MM-DD'
         item.initval = item.initval ? moment().subtract(item.initval * 7, 'days').format('YYYY-MM-DD') : ''
@@ -304,11 +303,12 @@
             item.$supId = config.$pageId
             if (config.setting && config.setting.supModule) {
               item.$supId = config.setting.supModule
+
+              config.checkBid = true
+              config.setting.checkBid = true
+              item.checkShift = true
             }
 
-            config.checkBid = true
-            config.setting.checkBid = true
-            item.checkShift = true
             item.initval = ''
 
             let d = ''
@@ -2342,7 +2342,7 @@
       z_debug_end: select @ErrorCode='E',@retmsg='debug_end' goto aaa`
   }
 
-  if (retmsg) {
+  if (retmsg || btn.returnValue === 'true') {
     _sql += `
       aaa: if @ErrorCode!=''
       insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@`

--
Gitblit v1.8.0