From 2394bc38a8247987736fbeead4903ecc40a4cf48 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Fri, 13 Sep 2024 18:32:36 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/store/index.js | 14 +++---
src/store/modules/workbench.js | 45 ++++++++++++++++++
.../workbench/components/workbenchTemp.vue | 47 ++++++++++++++++++-
src/views/workbench/index.vue | 2 +-
4 files changed, 100 insertions(+), 8 deletions(-)
create mode 100644 src/store/modules/workbench.js
diff --git a/src/store/index.js b/src/store/index.js
index 76c332b..b394ce8 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,13 +1,15 @@
-import user from './modules/user';
-import addProject from './modules/addProject';
+import user from './modules/user'
+import addProject from './modules/addProject'
+import workbench from './modules/workbench'
-import Vue from 'vue';
-import Vuex from 'vuex';
+import Vue from 'vue'
+import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user,
- addProject
- }
+ addProject,
+ workbench,
+ },
})
diff --git a/src/store/modules/workbench.js b/src/store/modules/workbench.js
new file mode 100644
index 0000000..7b4e565
--- /dev/null
+++ b/src/store/modules/workbench.js
@@ -0,0 +1,45 @@
+// 状态
+const state = {
+ tempList1: [],
+ tempList2: [],
+ tempList3: [],
+ tempList4: [],
+ tempList5: [],
+ tempList6: [],
+ tempList7: [],
+ tempList8: [],
+}
+
+// 修改
+const mutations = {
+ SET_TEMP_LIST_1(state, list) {
+ state.tempList1 = list
+ },
+ SET_TEMP_LIST_2(state, list) {
+ state.tempList2 = list
+ },
+ SET_TEMP_LIST_3(state, list) {
+ state.tempList3 = list
+ },
+ SET_TEMP_LIST_4(state, list) {
+ state.tempList4 = list
+ },
+ SET_TEMP_LIST_5(state, list) {
+ state.tempList5 = list
+ },
+ SET_TEMP_LIST_6(state, list) {
+ state.tempList6 = list
+ },
+ SET_TEMP_LIST_7(state, list) {
+ state.tempList7 = list
+ },
+ SET_TEMP_LIST_8(state, list) {
+ state.tempList8 = list
+ },
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+}
diff --git a/src/views/workbench/components/workbenchTemp.vue b/src/views/workbench/components/workbenchTemp.vue
index 827e240..85e0590 100644
--- a/src/views/workbench/components/workbenchTemp.vue
+++ b/src/views/workbench/components/workbenchTemp.vue
@@ -404,7 +404,6 @@ export default {
},
{ id: 13, name: '预警管理', componentName: 'ThirteenModel' },
],
- tempList: [],
tempList1: [],
tempList2: [],
tempList3: [],
@@ -422,6 +421,36 @@ export default {
}
},
+ mounted() {
+ const store = this.$store.state.workbench
+
+ console.log(store, '保存的信息')
+ if (store.tempList1.length > 0) {
+ this.tempList1 = store.tempList1
+ }
+ if (store.tempList2.length > 0) {
+ this.tempList2 = store.tempList2
+ }
+ if (store.tempList3.length > 0) {
+ this.tempList3 = store.tempList3
+ }
+ if (store.tempList4.length > 0) {
+ this.tempList4 = store.tempList4
+ }
+ if (store.tempList5.length > 0) {
+ this.tempList5 = store.tempList5
+ }
+ if (store.tempList6.length > 0) {
+ this.tempList6 = store.tempList6
+ }
+ if (store.tempList7.length > 0) {
+ this.tempList7 = store.tempList7
+ }
+ if (store.tempList8.length > 0) {
+ this.tempList8 = store.tempList8
+ }
+ },
+
methods: {
onStart() {},
onEnd(e) {
@@ -491,6 +520,7 @@ export default {
if (newValue.length > 1) {
this.tempList1 = this.tempList1.splice(this.tempList1.length - 1, 1)
this.completeList.push(newValue)
+ // console.log('----')
}
// if(newValue === 0 )
@@ -565,6 +595,21 @@ export default {
},
deep: true,
},
+ isSave: {
+ handler(newValue) {
+ if (newValue) {
+ this.$store.commit('workbench/SET_TEMP_LIST_1', this.tempList1)
+ this.$store.commit('workbench/SET_TEMP_LIST_2', this.tempList2)
+ this.$store.commit('workbench/SET_TEMP_LIST_3', this.tempList3)
+ this.$store.commit('workbench/SET_TEMP_LIST_4', this.tempList4)
+ this.$store.commit('workbench/SET_TEMP_LIST_5', this.tempList5)
+ this.$store.commit('workbench/SET_TEMP_LIST_6', this.tempList6)
+ this.$store.commit('workbench/SET_TEMP_LIST_7', this.tempList7)
+ this.$store.commit('workbench/SET_TEMP_LIST_8', this.tempList8)
+ }
+ },
+ deep: true,
+ },
},
}
diff --git a/src/views/workbench/index.vue b/src/views/workbench/index.vue
index 76f12e4..841ce13 100644
--- a/src/views/workbench/index.vue
+++ b/src/views/workbench/index.vue
@@ -12,7 +12,7 @@
@handleExitEdit="handleExitEdit"
@handleSubmit="handleSubmit"
/>
-
+