From cad4c57867b08541bb560e871b690e4e730cc1b8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 15 四月 2023 14:29:27 +0800
Subject: [PATCH] Merge branch 'develop'

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

diff --git a/src/utils/utils.js b/src/utils/utils.js
index 4431f93..119a3ee 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1504,15 +1504,16 @@
     }
   })
 
+  let _data = {}
   if (data) {
     Object.keys(data).forEach(key => {
-      data[key.toLowerCase()] = data[key]
+      _data[key.toLowerCase()] = data[key]
     })
   }
 
   // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃)
   if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) {
-    datavars = {...data, ...datavars}
+    datavars = {..._data, ...datavars}
 
     const setField = (col) => {
       if (!col.field) return
@@ -1707,7 +1708,7 @@
       /* 澶辨晥楠岃瘉 */
       select @tbid='', @ErrorCode='',@retmsg=''
       select @tbid='X' from ${datasource} right join (select ID from  dbo.SplitComma(@ID@)) sp
-      on tb.id =sp.id where tb.id is null
+      on tb.${primaryKey} =sp.id where tb.${primaryKey} is null
 
       If @tbid!=''
       Begin
@@ -1781,8 +1782,8 @@
         let _val = ''
         if (_linkKey === 'bid' && BID) { // 鏇挎崲bid
           _val = BID
-        } else if (data && data.hasOwnProperty(_linkKey)) {
-          _val = data[_linkKey]
+        } else if (_data.hasOwnProperty(_linkKey)) {
+          _val = _data[_linkKey]
         }
         _ModularDetailCode = `'${item.TypeCharOne + _val}'`
       } else {
@@ -1911,7 +1912,7 @@
     _sql += `
       /* 鍒涘缓鍑瘉 */
       exec s_BVoucher_Create
-        @Bill ='${data[_voucher.linkField.toLowerCase()]}',
+        @Bill ='${_data[_voucher.linkField.toLowerCase()]}',
         @BVoucherType ='${_voucher.BVoucherType}',
         @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
         @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
@@ -2253,36 +2254,21 @@
  */
 export function setGLOBFuncs () {
   window.GLOB.funcs = []
-  if (!window.GLOB.WebSql && !window.GLOB.IndexDB) {
+  if (!window.GLOB.IndexDB) {
     return
   }
 
-  if (window.GLOB.WebSql) {
-    window.GLOB.WebSql.transaction(tx => {
-      tx.executeSql("SELECT * FROM FUNCS", [], (tx, results) => {
-        let rows = results.rows
-        if (!rows || rows.length === 0) return
-        for (let i = 0; i < rows.length; i++) {
-          window.GLOB.funcs.push({
-            func_code: rows[i].func_code,
-            key_sql: window.decodeURIComponent(window.atob(rows[i].key_sql))
-          })
-        }
+  let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs')
+
+  objectStore.openCursor().onsuccess = (event) => {
+    let cursor = event.target.result
+
+    if (cursor) {
+      window.GLOB.funcs.push({
+        func_code: cursor.value.func_code,
+        key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql))
       })
-    })
-  } else {
-    let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs')
-
-    objectStore.openCursor().onsuccess = (event) => {
-      let cursor = event.target.result
-
-      if (cursor) {
-        window.GLOB.funcs.push({
-          func_code: cursor.value.func_code,
-          key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql))
-        })
-        cursor.continue()
-      }
+      cursor.continue()
     }
   }
 }

--
Gitblit v1.8.0