浏览代码

首页数据保存

jinx 1 年之前
父节点
当前提交
5b8e7898ef
共有 1 个文件被更改,包括 20 次插入5 次删除
  1. 20 5
      src/views/scene/index.vue

+ 20 - 5
src/views/scene/index.vue

@@ -31,19 +31,19 @@
         <div class="info-top-right" :class="{ full: viewStatus }">
         <div class="info-top-right" :class="{ full: viewStatus }">
           <div class="input-item">
           <div class="input-item">
             <p>事故时间:</p>
             <p>事故时间:</p>
-            <input type="text" />
+            <input type="text" v-model="sceneInfo.accidentTime" @input="inputHandler" />
           </div>
           </div>
           <div class="input-item">
           <div class="input-item">
             <p>天气:</p>
             <p>天气:</p>
-            <input type="text" />
+            <input type="text" v-model="sceneInfo.weather" @input="inputHandler" />
           </div>
           </div>
           <div class="input-item">
           <div class="input-item">
             <p>地点:</p>
             <p>地点:</p>
-            <input type="text" />
+            <input type="text" v-model="sceneInfo.address" @input="inputHandler" />
           </div>
           </div>
           <div class="text-item">
           <div class="text-item">
             <p>事故描述:</p>
             <p>事故描述:</p>
-            <textarea class="info-textarea"></textarea>
+            <textarea class="info-textarea" v-model="sceneInfo.accidentDesc" @input="inputHandler"></textarea>
           </div>
           </div>
           <div class="info-btn">
           <div class="info-btn">
             <div class="right-btn" @click="router.push('/roads?back=1')">现场绘图({{ sceneSortPhotos.length }})</div>
             <div class="right-btn" @click="router.push('/roads?back=1')">现场绘图({{ sceneSortPhotos.length }})</div>
@@ -82,7 +82,8 @@ import { currentView } from "./currentScene";
 import { router } from "@/router";
 import { router } from "@/router";
 import { roadPhotos } from "@/store/roadPhotos";
 import { roadPhotos } from "@/store/roadPhotos";
 import { types, accidentPhotos } from "@/store/accidentPhotos";
 import { types, accidentPhotos } from "@/store/accidentPhotos";
-
+import { debounce } from "@/utils";
+import { tables } from "@/store/tables";
 const layoutRef = ref(null);
 const layoutRef = ref(null);
 const activeMenuKeys = ref<string[]>([]);
 const activeMenuKeys = ref<string[]>([]);
 const accodentSortPhotos = computed(() => {
 const accodentSortPhotos = computed(() => {
@@ -107,6 +108,16 @@ const stopReg = watchEffect(() => {
     disabledMap.measure = false;
     disabledMap.measure = false;
   }
   }
 });
 });
+const sceneInfo = ref({
+  accidentTime: "",
+  weather: "",
+  address: "",
+  accidentDesc: "",
+});
+const inputHandler = debounce(() => {
+  console.error(1);
+  tables.value["sceneInfo"] = sceneInfo.value;
+}, 300);
 const viewStatus = ref(false);
 const viewStatus = ref(false);
 const onScale = () => {
 const onScale = () => {
   viewStatus.value = !viewStatus.value;
   viewStatus.value = !viewStatus.value;
@@ -166,6 +177,10 @@ onMounted(() => {
   var screenHeight = document.body.clientHeight;
   var screenHeight = document.body.clientHeight;
   layoutRef.value.style.height = screenHeight + "px";
   layoutRef.value.style.height = screenHeight + "px";
   document.body.style.height = screenHeight + "px";
   document.body.style.height = screenHeight + "px";
+
+  if (tables.value && tables.value["sceneInfo"]) {
+    sceneInfo.value = tables.value["sceneInfo"];
+  }
 });
 });
 onActivated(async () => {
 onActivated(async () => {
   await nextTick();
   await nextTick();