From 8a30a763f0d0a64c10495b7118f15d3b06c746c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?=
<1262327911@qq.com>
Date: Mon, 11 Apr 2022 17:06:41 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=8E=86=E5=8F=B2?=
=?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E6=9C=80=E5=A4=A7=E5=80=BC=E7=9A=84?=
=?UTF-8?q?=E8=AE=BE=E5=AE=9A=E4=BD=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/settings/designSetting.ts | 5 ++++-
src/settings/systemSetting.ts | 2 +-
src/store/modules/chartHistoryStore/chartHistoryStore.ts | 3 ++-
src/views/chart/ContentEdit/components/EditHistory/index.vue | 3 ++-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/settings/designSetting.ts b/src/settings/designSetting.ts
index f81db879..343e326a 100644
--- a/src/settings/designSetting.ts
+++ b/src/settings/designSetting.ts
@@ -38,4 +38,7 @@ export const carouselInterval = 4000
export const backgroundImageSize = 5
// 数据请求间隔
-export const requestInterval = 30
\ No newline at end of file
+export const requestInterval = 30
+
+// 工作区域历史记录存储最大数量
+export const editHistoryMax = 100
\ No newline at end of file
diff --git a/src/settings/systemSetting.ts b/src/settings/systemSetting.ts
index ac362868..65ccc4b2 100644
--- a/src/settings/systemSetting.ts
+++ b/src/settings/systemSetting.ts
@@ -1,6 +1,6 @@
import { SettingStoreEnums, ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
-// * 系统全局设置
+// * 用户配置项
export const systemSetting = {
// 侧边栏折叠是否隐藏全部
[SettingStoreEnums.ASIDE_ALL_COLLAPSED]: true,
diff --git a/src/store/modules/chartHistoryStore/chartHistoryStore.ts b/src/store/modules/chartHistoryStore/chartHistoryStore.ts
index 1355cd75..9d29fbbe 100644
--- a/src/store/modules/chartHistoryStore/chartHistoryStore.ts
+++ b/src/store/modules/chartHistoryStore/chartHistoryStore.ts
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
import { CreateComponentType } from '@/packages/index.d'
import { EditCanvasType } from '@/store/modules/chartEditStore/chartEditStore.d'
import { loadingStart, loadingFinish, loadingError } from '@/utils'
+import { editHistoryMax } from '@/settings/designSetting'
import {
HistoryStackItemEnum,
HistoryActionTypeEnum,
@@ -61,7 +62,7 @@ export const useChartHistoryStore = defineStore({
): void {
if (item instanceof Array) this.backStack = [...this.backStack, ...item]
else this.backStack.push(item)
- this.backStack.splice(0, this.backStack.length - 20)
+ this.backStack.splice(0, this.backStack.length - editHistoryMax)
// 新动作需清空前进栈
if (notClear) return
this.clearForwardStack()
diff --git a/src/views/chart/ContentEdit/components/EditHistory/index.vue b/src/views/chart/ContentEdit/components/EditHistory/index.vue
index 737cfb3e..0cb59501 100644
--- a/src/views/chart/ContentEdit/components/EditHistory/index.vue
+++ b/src/views/chart/ContentEdit/components/EditHistory/index.vue
@@ -25,7 +25,7 @@
- 最多只保留 20 条记录
+ 最多只保留{{ editHistoryMax }}条记录
@@ -37,6 +37,7 @@ import { renderIcon } from '@/utils'
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
import { historyActionTypeName } from '@/store/modules/chartHistoryStore/chartHistoryDefine'
import { CreateComponentType } from '@/packages/index.d'
+import { editHistoryMax } from '@/settings/designSetting'
import {
HistoryItemType,
HistoryTargetTypeEnum,