From 73a5124745890650d0fc91234bdbaa66d9bcbc6a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 六月 2021 17:52:01 +0800 Subject: [PATCH] 2021-06-09 --- src/utils/utils.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index c99abbb..891d2fd 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1754,6 +1754,46 @@ } /** + * @description 鐢熸垚鏇挎崲鍑芥暟鍒楄〃 + */ +export function setGLOBFuncs () { + window.GLOB.funcs = [] + if (!window.GLOB.WebSql && !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)) + }) + } + }) + }) + } 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() + } + } + } + +} + +/** * @description 鍒涘缓瀛樺偍杩囩▼绫� */ export class FuncUtils { -- Gitblit v1.8.0