From f01086dc94827dbb15811760e5d13683977fcec9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 十一月 2022 00:40:12 +0800
Subject: [PATCH] 2022-11-10

---
 src/api/index.js |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 135d64a..3270525 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -398,7 +398,7 @@
             CacheUtils.updateWebSqlversion('1.00', curTime)
             resolve()
             return
-          } else if (!msg.createDate || reload) {
+          } else if (!msg.createDate || reload === true) {
             param.modifydate = curTime
             param.menuids = window.btoa(msg.menuids)
           } else if (msg.menuids) {
@@ -423,18 +423,25 @@
               list.push(...res.menu_del)
             }
 
+            list = list.map(mid => mid.menuid)
+
+            if (typeof(reload) === 'string' && !list.includes(reload)) {
+              list.push(reload)
+            }
+
             if (list.length > 0) {
               let clear = false
               list.forEach(mid => {
-                if (systemMenuKeys.indexOf(mid.menuid) > -1) {
+                if (systemMenuKeys.indexOf(mid) > -1) {
                   clear = true
                 }
               })
-              let keys = list.map(mid => `'${mid.menuid}'`).join(',')
               if (clear) {
-                keys = ''
+                list = ''
+              } else {
+                list = list.map(mid => `'${mid}'`).join(',')
               }
-              CacheUtils.delWebSqlConfig(keys)
+              CacheUtils.delWebSqlConfig(list)
             }
 
             CacheUtils.updateWebSqlversion(res.app_version || '1.00', curTime)
@@ -460,7 +467,7 @@
             CacheUtils.updateIndexDBversion({version: '1.00', createDate: curTime})
             resolve()
             return
-          } else if (!msg.createDate || reload) {
+          } else if (!msg.createDate || reload === true) {
             param.modifydate = curTime
             param.menuids = window.btoa(msg.menuids)
           } else if (msg.menuids) {
@@ -485,18 +492,23 @@
               list.push(...res.menu_del)
             }
 
+            list = list.map(mid => mid.menuid)
+
+            if (typeof(reload) === 'string' && !list.includes(reload)) {
+              list.push(reload)
+            }
+
             if (list.length > 0) {
               let clear = false
               list.forEach(mid => {
-                if (systemMenuKeys.indexOf(mid.menuid) > -1) {
+                if (systemMenuKeys.indexOf(mid) > -1) {
                   clear = true
                 }
               })
-              let keys = list.map(mid => mid.menuid)
               if (clear) {
-                keys = ''
+                list = ''
               }
-              CacheUtils.delIndexDBConfig(keys)
+              CacheUtils.delIndexDBConfig(list)
             }
 
             CacheUtils.updateIndexDBversion({version: res.app_version || '1.00', createDate: curTime})

--
Gitblit v1.8.0