diff --git a/src/App.vue b/src/App.vue
index ea346eb..d090084 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,10 +1,63 @@
-
+
-
+
+
+
diff --git a/src/components/Home.vue b/src/components/Home.vue
index 51027c4..0b3d945 100644
--- a/src/components/Home.vue
+++ b/src/components/Home.vue
@@ -1,11 +1,15 @@
@@ -13,13 +17,19 @@
+
+
diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue
index 8ea5b1c..30607fe 100644
--- a/src/components/Sidebar.vue
+++ b/src/components/Sidebar.vue
@@ -106,10 +106,10 @@ export default {
index: "/devicePhotoSchedule",
title: "拍照时间表设置",
},
- {
- index: "/deviceReport",
- title: "装置报表",
- },
+ // {
+ // index: "/deviceReport",
+ // title: "装置报表",
+ // },
{
index: "/waterMark",
title: "水印下发",
diff --git a/src/router/index.js b/src/router/index.js
index 11a62df..be6169b 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,135 +8,116 @@ const routes = [
{
path: "/stritl",
component: () => import("../components/Home.vue"),
- meta: { title: "首页" },
children: [
{
- path: "/stritl",
- component: () =>
- import(
- /* webpackChunkName: "dashboard" */ "../views/homePage/index.vue"
- ),
+ path: "",
+ component: () => import("../views/homePage/index.vue"),
+ name: "home",
meta: {
title: "首页",
icon: "el-icon-s-home",
+ // keepAlive: true,
},
},
{
path: "/realTimeMonitor",
- component: () =>
- import(
- /* webpackChunkName: "home" */ "../views/realTimeMonitor/index.vue"
- ),
+ component: () => import("../views/realTimeMonitor/index.vue"),
+ name: "realTimeMonitor",
meta: {
title: "实时监控",
permission: true,
icon: "el-icon-camera",
+ keepAlive: true,
},
},
{
path: "/pictureRotation",
- component: () =>
- import(
- /* webpackChunkName: "home" */ "../views/pictureRotation/index.vue"
- ),
+ component: () => import("../views/pictureRotation/index.vue"),
+ name: "pictureRotation",
meta: {
title: "图片轮巡",
permission: true,
icon: "el-icon-camera",
+ keepAlive: true,
},
},
{
path: "/realTimeSearch",
- component: () =>
- import(
- /* webpackChunkName: "home" */ "../views/realTimeSearch/index.vue"
- ),
+
+ component: () => import("../views/realTimeSearch/index.vue"),
+ name: "realTimeSearch",
meta: {
title: "历史图片",
permission: true,
icon: "el-icon-camera",
+ keepAlive: true,
},
},
{
path: "/photoAlarm",
- component: () =>
- import(
- /* webpackChunkName: "home" */ "../views/alarmHandling/index.vue"
- ),
+ component: () => import("../views/alarmHandling/index.vue"),
+ name: "alarmHandling",
meta: {
title: "告警处理",
permission: true,
icon: "el-icon-camera",
+ keepAlive: true,
},
},
{
path: "/userManagement",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/system/userManagement.vue"
- ),
- meta: { title: "用户管理", icon: "el-icon-monitor" },
+ component: () => import("../views/system/userManagement.vue"),
+ name: "userManagement",
+ meta: { title: "用户管理", icon: "el-icon-monitor", keepAlive: true },
},
{
path: "/globalTools",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/system/globalTools/index.vue"
- ),
- meta: { title: "全局设置" },
+ component: () => import("../views/system/globalTools/index.vue"),
+ name: "globalTools",
+ meta: { title: "全局设置", keepAlive: true },
},
{
path: "/lineInformation",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/lineInformation/index.vue"
- ),
- meta: { title: "线路信息管理", icon: "" },
+ component: () => import("../views/lineInformation/index.vue"),
+ name: "lineInformation",
+ meta: { title: "线路信息管理", icon: "", keepAlive: true },
},
{
path: "/towerInformation",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/towerInformation/index.vue"
- ),
- meta: { title: "杆塔信息管理", icon: "" },
+ component: () => import("../views/towerInformation/index.vue"),
+ name: "towerInformation",
+ meta: { title: "杆塔信息管理", icon: "", keepAlive: true },
},
{
path: "/cameraChannel",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/cameraChannel/index.vue"
- ),
- meta: { title: "通道管理", icon: "" },
+ component: () => import("../views/cameraChannel/index.vue"),
+ name: "cameraChannel",
+ meta: { title: "通道管理", icon: "", keepAlive: true },
},
{
path: "/photographicDevice",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/photographicDevice/index.vue"
- ),
- meta: { title: "拍照装置管理", icon: "" },
+ component: () => import("../views/photographicDevice/index.vue"),
+ name: "photographicDevice",
+ meta: { title: "拍照装置管理", icon: "", keepAlive: true },
},
{
path: "/devicePhotoSchedule",
- component: () =>
- import(
- /* webpackChunkName: "tabs" */ "../views/devicePhotoSchedule/index.vue"
- ),
- meta: { title: "拍照时间表设置", icon: "" },
+ component: () => import("../views/devicePhotoSchedule/index.vue"),
+ name: "devicePhotoSchedule",
+ meta: { title: "拍照时间表设置", icon: "", keepAlive: true },
},
{
path: "/waterMark",
- component: () =>
- import(/* webpackChunkName: "tabs" */ "../views/waterMark/index.vue"),
- meta: { title: "水印下发", icon: "" },
+ component: () => import("../views/waterMark/index.vue"),
+ name: "waterMark",
+ meta: { title: "水印下发", icon: "", keepAlive: true },
},
{
path: "/echarts",
- component: () =>
- import(/* webpackChunkName: "tabs" */ "../echartsDemo.vue"),
- meta: { title: "echarts图表", icon: "" },
+ component: () => import("../echartsDemo.vue"),
+ name: "echartsDemo",
+ meta: { title: "echarts图表", icon: "", keepAlive: true },
},
],
},
diff --git a/src/store/cache.js b/src/store/cache.js
new file mode 100644
index 0000000..30f742f
--- /dev/null
+++ b/src/store/cache.js
@@ -0,0 +1,57 @@
+import Vue from "vue";
+
+export default {
+ namespaced: true,
+ state: {
+ caches: [],
+ },
+ actions: {
+ // 添加缓存的路由组件
+ addCache({ state, dispatch }, componentName) {
+ if (Array.isArray(componentName)) {
+ componentName.forEach((item) => {
+ dispatch("addCache", item);
+ });
+ return;
+ }
+
+ const { caches } = state;
+ if (!componentName || caches.includes(componentName)) return;
+
+ caches.push(componentName);
+ console.log("缓存路由组件:", componentName);
+ },
+
+ // 移除缓存的路由组件
+ removeCache({ state, dispatch }, componentName) {
+ if (Array.isArray(componentName)) {
+ componentName.forEach((item) => {
+ dispatch("removeCache", item);
+ });
+ return;
+ }
+
+ const { caches } = state;
+ const index = caches.indexOf(componentName);
+ if (index > -1) {
+ console.log("清除缓存的路由组件:", componentName);
+ return caches.splice(index, 1)[0];
+ }
+ },
+ // 移除缓存的路由组件的实例
+ async removeCacheEntry({ dispatch }, componentName) {
+ const cacheRemoved = await dispatch("removeCache", componentName);
+ if (cacheRemoved) {
+ await Vue.nextTick();
+ dispatch("addCache", componentName);
+ }
+ },
+ // 清除缓存的路由组件的实例
+ clearEntry({ state, dispatch }) {
+ const { caches } = state;
+ caches.slice().forEach((key) => {
+ dispatch("removeCacheEntry", key);
+ });
+ },
+ },
+};
diff --git a/src/store/index.js b/src/store/index.js
index 46d5523..7b7c696 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,6 +1,6 @@
import Vue from "vue";
import Vuex from "vuex";
-
+import cacheModule from "./cache";
Vue.use(Vuex);
export default new Vuex.Store({
@@ -16,6 +16,7 @@ export default new Vuex.Store({
protocol: "",
cmdId: "",
channelIdList: [],
+ isRenderTab: true,
},
getters: {
token: (state) => state.token,
@@ -73,7 +74,10 @@ export default new Vuex.Store({
REMOVE_INFO(state) {
localStorage.clear();
},
+ setIsRenderTab(state, data) {
+ state.isRenderTab = data;
+ },
},
actions: {},
- modules: {},
+ modules: { cache: cacheModule },
});
diff --git a/src/utils/event-bus.js b/src/utils/event-bus.js
new file mode 100644
index 0000000..8e25695
--- /dev/null
+++ b/src/utils/event-bus.js
@@ -0,0 +1,4 @@
+import Vue from 'vue'
+
+const EventBus = new Vue()
+export default EventBus
\ No newline at end of file
diff --git a/src/views/alarmHandling/index.vue b/src/views/alarmHandling/index.vue
index fb2980a..a69386a 100644
--- a/src/views/alarmHandling/index.vue
+++ b/src/views/alarmHandling/index.vue
@@ -364,6 +364,7 @@ import {
import morePicPreveiw from "../realTimeMonitor/components/morePicPreveiw";
import moment from "moment";
export default {
+ name: "alarmHandling",
components: {
morePicPreveiw,
},
diff --git a/src/views/cameraChannel/index.vue b/src/views/cameraChannel/index.vue
index 226a174..7e52140 100644
--- a/src/views/cameraChannel/index.vue
+++ b/src/views/cameraChannel/index.vue
@@ -100,6 +100,7 @@ import addChannelDialog from "./components/addChannelDialog.vue";
import { getChannelListapi, deleteChannelapi } from "@/utils/api/index";
export default {
+ name: "cameraChannel",
components: {
addChannelDialog,
},
diff --git a/src/views/devicePhotoSchedule/index.vue b/src/views/devicePhotoSchedule/index.vue
index 43362c9..7b686b5 100644
--- a/src/views/devicePhotoSchedule/index.vue
+++ b/src/views/devicePhotoSchedule/index.vue
@@ -96,6 +96,7 @@ import adddeviceDialog from "./components/adddeviceDialog.vue";
import bdSchedule from "./components/bdSchedule.vue";
export default {
+ name: "devicePhotoSchedule",
components: {
adddeviceDialog,
bdSchedule,
diff --git a/src/views/homePage/index.vue b/src/views/homePage/index.vue
index 5372873..3b0aa52 100644
--- a/src/views/homePage/index.vue
+++ b/src/views/homePage/index.vue
@@ -126,7 +126,7 @@ import {
getOnlineTerminalListExcel,
} from "@/utils/api/index";
export default {
- name: "",
+ name: "home",
data() {
return {
termDataNum: "", //总数
@@ -477,11 +477,11 @@ export default {