tangning hace 3 días
padre
commit
684f0a80df

+ 3 - 2
src/router/config.ts

@@ -3,13 +3,14 @@ import { appConstant, appRoutes } from "@/app";
 
 export { RouteName };
 export type Routes = Route[];
-export type RouteMeta = { title: string; icon?: string };
+export type RouteMeta = { title: string; icon?: string; keepAlive?: true };
 export type Route = {
   name: string;
   path: string;
   component: any;
   meta: RouteMeta;
   children?: Routes;
+  keepAlive?: true
 };
 
 export const system: Routes = [
@@ -90,7 +91,7 @@ export const routes: Routes = [
         name: RouteName.sceneImg,
         path: "sceneImg/:caseId",
         component: () => import("@/view/material/sceneImg.vue"),
-        meta: { title: "三录材料", icon: "icon-tidangan" },
+        meta: { title: "三录材料", icon: "icon-tidangan", keepAlive: true },
       },
       // {
       //   name: RouteName.other,

+ 3 - 1
src/view/case/photos/canvas-photo-editor.js

@@ -1473,6 +1473,7 @@ resizePageAndReflow(pages, pageIndex, itemValue) {
     this.history.splice(this.currentIndex + 1)
     this.history.push({
       // imageData: imageData,
+      layoutMode: this.layoutMode, // 保存当前布局模式,以便恢复时使用
       pages: JSON.stringify(this.pages), // 保存当前页码信息,以便恢复时使用
       indexingLineList: [...this.indexingLineList], // 保存标引线信息,以便恢复时使用
     });
@@ -1496,12 +1497,13 @@ resizePageAndReflow(pages, pageIndex, itemValue) {
     //   this.saveHistory()
     // };
     // let newCurrentIndex = type ? currentIndex  : (currentIndex + 1)
-    const { pages, indexingLineList } = this.history[newCurrentIndex]
+    const { pages, indexingLineList, layoutMode } = this.history[newCurrentIndex]
     console.log("saveHistory", this.history, newCurrentIndex, newCurrentIndex);
     this.indexingLineList = indexingLineList
     this.isHistory = false //回退不保存
     this.pages = JSON.parse(pages)
     this.currentIndex = newCurrentIndex
+    this._layoutMode = layoutMode
 
     // this.tempArrow.start = null
     // this.tempArrow.end = null

+ 16 - 20
src/view/layout/index.vue

@@ -11,27 +11,20 @@
         <div class="view" :class="{ full: hiddenSlide }">
           <div class="main" :class="{ fullmain: hiddenSlide }">
             <router-view v-slot="{ Component }">
-              <component :is="Component" />
+                  <keep-alive>
+                    <component
+                      :is="Component"
+                      v-if="isKeep"
+                    />
+                  </keep-alive>
+
+                  <!-- 不需要缓存的页面 -->
+                  <component
+                    :is="Component"
+                    v-if="!isKeep"
+                  />
             </router-view>
           </div>
-          <!-- <div class="app-wrap m-4" v-if="!hiddenSlide">
-            <div
-              class="app-scene"
-              ref="sceneRef"
-              :style="{
-                width: '100%',
-                height: 'calc(100% - 24px)',
-              }"
-            >
-              <iframe
-                v-if="caseId"
-                :key="qpisceneList.length"
-                :src="'https://survey.4dkankan.com' + sceneURL"
-                frameborder="0"
-                :style="{ width: '100%', height: '100%' }"
-              ></iframe>
-            </div>
-          </div> -->
         </div>
       </template>
     </div>
@@ -55,7 +48,7 @@ import {
   Extract,
 } from "@/store/case";
 import { json } from "stream/consumers";
-console.log(menuRouteNames, "menuRouteNames", router.currentRoute.value.name);
+console.log(menuRouteNames, "menuRouteNames", router.currentRoute.value.meta);
 const isSystem = computed(() => routeIsSystem());
 const caseId = computed(() => {
   const caseId = router.currentRoute.value.params.caseId;
@@ -105,6 +98,9 @@ onMounted(() => {
   // setupSDK(document.querySelector('iframe') as HTMLIFrameElement)
 });
 updateByTreeFileLists();
+const isKeep = computed(
+  () => router.currentRoute.value.meta?.keepAlive || false
+);
 const hiddenSlide = computed(
   () => !menuRouteNames.includes(router.currentRoute.value.name as string)
 );

+ 4 - 2
src/view/material/sceneImg.vue

@@ -524,7 +524,7 @@
 
 <script setup lang="ts">
 import viewImg from "@/components/viewImg/list.vue";
-import { computed, ref, reactive } from "vue";
+import { computed, ref, reactive, onActivated } from "vue";
 import { addCaseScenes, exportCasePhotos, tableModelScene } from "./quisk";
 import showpages from "./showpages.vue";
 import {
@@ -732,7 +732,9 @@ function handleSuccess(item) {
     getList(true);
   });
 }
-
+onActivated(() =>{
+  getList(true);
+})
 function getList(refresh = false) {
   //new  0 现场图 1 照片卷 2 现场照片 3 勘验笔录
   //old  0 现场照片 1 现场图 2 勘验笔录