浏览代码

feat(draw): model save

gemercheung 1 年之前
父节点
当前提交
b51d545406

+ 12 - 1
src/core/Scene.js

@@ -2,6 +2,7 @@ import * as THREE from "three";
 import Stats from "three/examples/jsm/libs/stats.module.js";
 import Player from "./player/Player.js";
 import BoxManager from "./box/BoxManager.js";
+import mitt from "mitt";
 
 const stats = new Stats();
 
@@ -12,13 +13,14 @@ export default class Scene {
     this.renderer = null;
     this.orthCamera = null;
     this.player = null;
-
+    this.mitt = null;
     this.width = 0;
     this.height = 0;
     this.inited = false;
 
     this.init = () => {
       this.scene = new THREE.Scene();
+      this.mitt = new mitt();
       this.scene.background = new THREE.Color(0xf0f2f5);
       this.renderer = new THREE.WebGLRenderer({
         canvas: this.domElement,
@@ -47,6 +49,7 @@ export default class Scene {
       this.orthCamera.lookAt(0, 0, 0);
       // this.orthCamera.setViewOffset(this.width, this.height, 0, 0);
       this.orthCamera.updateProjectionMatrix();
+  
       //player
       this.player = new Player(this);
 
@@ -93,6 +96,14 @@ export default class Scene {
 
   toVertical = () => {};
 
+  lockView(open) {
+    if (open) {
+      this.player.floorplanControls.enablePan = true;
+    } else {
+      this.player.floorplanControls.enablePan = false;
+    }
+  }
+
   onResize = (width, height) => {
     this.width = width !== undefined ? width : this.domElement.clientWidth;
     this.height = height !== undefined ? height : this.domElement.clientHeight;

+ 18 - 0
src/core/box/HorizontalBox.js

@@ -18,7 +18,15 @@ export default class HorizontalBox extends THREE.Group {
     this.height = (2 * 710) / 500;
     this.color = 0xffffff;
   }
+  cover(texture, aspect) {
+    var imageAspect = texture.image.width / texture.image.height;
 
+    if (aspect < imageAspect) {
+      texture.matrix.setUvTransform(0, 0, aspect / imageAspect, 1, 0, 0.5, 0.5);
+    } else {
+      texture.matrix.setUvTransform(0, 0, 1, imageAspect / aspect, 0, 0.5, 0.5);
+    }
+  }
   load(data, index) {
     //box
 
@@ -50,8 +58,18 @@ export default class HorizontalBox extends THREE.Group {
       //img
       let img;
       this.manager.loader.load(i.imgUrl, (texture) => {
+        let imgRatio = texture.image.width / texture.image.height;
+
+        let planeRatio = 1.5 /  0.85;
+        let ratio = planeRatio / imgRatio;
+
+        texture.repeat.x = ratio;
+        texture.offset.x = 0.5 * (1 - ratio);
+        
+        // console.log("texture", texture);
         texture.colorSpace = THREE.SRGBColorSpace;
         img = new ImgLabel(texture, matLine);
+
         img.userData = i.id;
         img.position.y += 1;
         if (j === 0) {

+ 7 - 0
src/core/box/VerticalBox.js

@@ -49,6 +49,13 @@ export default class VerticalBox extends THREE.Group {
       //img
       let img;
       this.manager.loader.load(i.imgUrl, (texture) => {
+        let imgRatio = texture.image.width / texture.image.height;
+        let planeRatio = 1.5 / 2;
+        let ratio = planeRatio / imgRatio;
+
+        texture.repeat.x = ratio;
+        texture.offset.x = 0.5 * (1 - ratio);
+
         texture.colorSpace = THREE.SRGBColorSpace;
         img = new ImgLabel(texture, matLine, false);
         img.position.y += 1;

+ 2 - 0
src/core/box/object/ImgLabel.js

@@ -1,6 +1,8 @@
 import * as THREE from "three";
 import TouchEdge from "./TouchEdge";
 
+
+
 export default class ImgLabel extends THREE.Mesh {
   constructor(texture, matLine, isHorizontal = true) {
     let width, height, p;

+ 1 - 1
src/core/controls/FloorplanControls.js

@@ -285,7 +285,7 @@ export default class FloorplanControls {
     }
   };
   onMouseWheel = (event) => {
-    console.log("this", this);
+    // console.log("this", this);
     if (this.locked) return;
     if (this.enableZoom === false) return;
     event.preventDefault();

+ 16 - 6
src/core/player/Player.js

@@ -42,27 +42,38 @@ export default class Player {
 
   init = () => {
     // //floorplanControls
-    // this.floorplanControls = new FloorplanControls(this.orthCamera, this.scene.domElement, this);
+    // this.floorplanControls = new FloorplanControls(
+    //   this.orthCamera,
+    //   this.scene.domElement,
+    //   this
+    // );
     this.floorplanControls = new OrbitControls(
       this.orthCamera,
       this.scene.domElement
     );
 
     this.floorplanControls.enablePan = true;
-    // this.floorplanControls.target.set(0, 1, 0);
+    this.floorplanControls.target.set(0, 1, 0);
     // this.floorplanControls.rotateSpeed = 0.5;
     // this.floorplanControls.panSpeed = 0.75
-    // this.floorplanControls.maxDistance = 100
-    // this.floorplanControls.minDistance = 3.5
+
+    this.floorplanControls.maxDistance = 100;
+    this.floorplanControls.minDistance = 3.5;
     this.floorplanControls.maxZoom = 500;
     this.floorplanControls.minZoom = 100;
 
+    // this.floorplanControls.mouseButtons = {
+    //   LEFT: THREE.MOUSE.PAN,
+    //   MIDDLE: THREE.MOUSE.DOLLY,
+    //   RIGHT: THREE.MOUSE.PAN
+    // }
+
     this.floorplanControls.enableRotate = false;
     this.raycaster = new THREE.Raycaster();
     this.onBindEvent();
     this.inited = true;
 
-    console.log("this.floorplanControls", this.floorplanControls);
+    console.log("this.floorplanControls", this.scene.mitt);
 
     this.matLine = new LineMaterial({
       color: this.lineColor,
@@ -254,7 +265,6 @@ export default class Player {
           });
         }
       });
-    
     }
   }
 

+ 5 - 0
src/core/save.json

@@ -0,0 +1,5 @@
+{
+    hor_lines:[],
+    activeEdges:[],
+    vir_lines:[],
+}

+ 2 - 0
src/request/urls.ts

@@ -191,6 +191,8 @@ export const caseExtractDetail = "/fusion-xj/caseExtractDetail/info";
 export const caseExtractDetailOpt = "/fusion-xj/caseExtractDetail/saveOrUpdate";
 export const caseExtractDetailExport = "/fusion-xj/caseExtractDetail/downDocx";
 
+//标注
+export const saveCaseImgTag = "/fusion-xj/caseImgTag/saveOrUpdate";
 
 // 火调链接地址设置密码
 export const setCasePsw = "/fusion-xj/web/fireProject/updateRandomCode";

+ 7 - 1
src/store/case.ts

@@ -16,7 +16,8 @@ import {
   caseInquestExport,
   caseExtractDetail,
   caseExtractDetailOpt,
-  caseExtractDetailExport
+  caseExtractDetailExport,
+  saveCaseImgTag
 } from "@/request";
 import { ModelScene, QuoteScene, Scene, SceneType } from "./scene";
 import { CaseFile } from "./caseFile";
@@ -121,3 +122,8 @@ export const saveCaseDetailInfo = (caseId: number, data) =>
 
 export const exportCaseDetailInfo = (caseId: number) =>
   axios.get(caseExtractDetailExport, { params: { caseId, ingoreRes: true }, responseType: 'blob' });
+
+// 
+
+export const saveCaseImgTagData = (caseId: number, data) =>
+  axios.post(saveCaseImgTag, { caseId, ...data });

+ 56 - 37
src/view/case/photos/index.vue

@@ -2,17 +2,29 @@
   <div class="photo">
     <div class="left">
       <div class="upload">
-        <el-button type="primary" @click="addCaseFileHandler"> 上传照片 </el-button>
-        <el-button type="primary" @click="sortType = !sortType" :icon="sortType ? FullScreen : Menu">{{ sortType ? "横排"
-          : "竖排" }}</el-button>
+        <el-button type="primary" @click="addCaseFileHandler">
+          上传照片
+        </el-button>
+        <el-button
+          type="primary"
+          @click="sortType = !sortType"
+          :icon="sortType ? FullScreen : Menu"
+          >{{ sortType ? "横排" : "竖排" }}</el-button
+        >
       </div>
-      <draggable ref="childRef" :caseId="caseId" :sortType="sortType" @changeList="changeList"
-        @handleItem="handleItem" />
+      <draggable
+        ref="childRef"
+        :caseId="caseId"
+        :sortType="sortType"
+        @changeList="changeList"
+        @handleItem="handleItem"
+      />
     </div>
     <div class="right">
       <div class="tools">
-        <el-button>标注方向</el-button>
-        <!-- <el-button>退出标注</el-button> -->
+        <el-button @click="handleMark">标注方向</el-button>
+        <el-button @click="handleMark">标注连线</el-button>
+        <el-button @click="handleMark">保存</el-button>
       </div>
       <swiper
         class="swiper"
@@ -24,7 +36,11 @@
         style="height: 100%"
         @slideChange="onSlideChange"
       >
-        <swiper-slide class="swiperItem" v-for="(item, index) in newlist" :key="index">
+        <swiper-slide
+          class="swiperItem"
+          v-for="(item, index) in newlist"
+          :key="index"
+        >
           <div class="swiperList">
             <div
               class="itemper"
@@ -32,11 +48,7 @@
               v-for="eleItem in item"
               :key="eleItem"
             >
-              <img
-                class="itemImg"
-                :src="eleItem.imgUrl"
-                alt=""
-              />
+              <img class="itemImg" :src="eleItem.imgUrl" alt="" />
               <div class="text">{{ eleItem.imgInfo }}</div>
             </div>
             <div class="page">
@@ -58,8 +70,9 @@ import { Swiper, SwiperSlide } from "swiper/vue";
 import "swiper/css";
 // import { addCaseFile } from "@/store/caseFile";
 import { addCaseImgFile } from "../quisk";
-import Scene from '@/core/Scene.js'
-import draggable from './draggable.vue';
+import { saveCaseImgTagData } from "@/store/case";
+import Scene from "@/core/Scene.js";
+import draggable from "./draggable.vue";
 const props = defineProps({ caseId: Number });
 const newlist = ref([]);
 const swiperRef = ref(null);
@@ -68,22 +81,22 @@ const caseId = ref(props.caseId);
 const sortType = ref(false);
 let scene = null;
 
-
 const addCaseFileHandler = async () => {
   await addCaseImgFile({
-    caseId: caseId.value, data: {
-      imgUrl: '',
-      imgInfo: '',
-      id: '',
-      sort: '',
-    }
+    caseId: caseId.value,
+    data: {
+      imgUrl: "",
+      imgInfo: "",
+      id: "",
+      sort: "",
+    },
   });
   refresh();
 };
 function refresh() {
   console.log("changeList", childRef.value);
   if (childRef.value) {
-    childRef.value.getList()
+    childRef.value.getList();
   }
 }
 const changeList = (list) => {
@@ -99,24 +112,23 @@ const changeList = (list) => {
     }
   });
   newlist.value = newList;
-  const arr = []
-  newList.map(i => arr.push(JSON.parse(JSON.stringify(i))))
-  const type = sortType.value ? 2 : 1
+  const arr = [];
+  newList.map((i) => arr.push(JSON.parse(JSON.stringify(i))));
+  const type = sortType.value ? 2 : 1;
   if (scene) {
-    scene.load(arr, type)
+    scene.load(arr, type);
     console.log("changeList", arr, type);
   }
-
 };
 const renderCanvas = () => {
-  const canvas = document.getElementById('canvas')
+  const canvas = document.getElementById("canvas");
   // console.log(canvas)
-  scene = new Scene(canvas)
-  scene.init()
-  window.scene = scene
-}
+  scene = new Scene(canvas);
+  scene.init();
+  window.scene = scene;
+};
 const onSwiper = (swiper) => {
-  console.log('onSwiper')
+  console.log("onSwiper");
   swiperRef.value = swiper;
 };
 const onSlideChange = (swiper) => {
@@ -128,15 +140,21 @@ const handleItem = (item) => {
   console.log("handleItem", item, active);
 };
 const handleDetele = async (item) => {
-  if (await confirm("删除该场景,将同时从案件和融合模型中移除,确定要删除吗?")) {
+  if (
+    await confirm("删除该场景,将同时从案件和融合模型中移除,确定要删除吗?")
+  ) {
     const scenes = getCaseScenes(list.value.filter((item) => item !== scene));
     await replaceCaseScenes(props.caseId, scenes);
     refresh();
   }
 };
+const handleMark = () => {
+  if (window.scene) {
+  }
+};
 onMounted(() => {
   renderCanvas();
-})
+});
 </script>
 <style lang="scss" scoped>
 #canvas {
@@ -216,7 +234,8 @@ onMounted(() => {
         .oneItemper {
           height: calc(100% - 120px);
 
-          .itemImg {}
+          .itemImg {
+          }
         }
       }
     }

+ 297 - 147
src/view/case/records/index.vue

@@ -3,102 +3,226 @@
   <div class="records">
     <div class="header">
       <el-button type="primary" @click="handleSave">保存</el-button>
-      <el-button @click="handleExport">导出</el-button>
+      <el-button :disabled="isDisableExport" @click="handleExport"
+        >导出</el-button
+      >
     </div>
     <h3 class="title">基本信息</h3>
     <div class="content">
-
       <div class="line">
         <span>勘验次数:</span>
         <span>第</span>
-        <el-input class="input" v-model="data.count" placeholder="" style="width: 80px;" />
+        <el-input
+          class="input"
+          v-model="data.count"
+          placeholder=""
+          style="width: 80px"
+        />
         <span>次勘验</span>
       </div>
 
       <div class="line">
         <span>勘验时间:</span>
         <div>
-          <el-input class="input" :maxlength="4" type="text" v-model="data.startTime.year" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="4"
+            type="text"
+            v-model="data.startTime.year"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>年</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.startTime.month" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.startTime.month"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>月</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.startTime.day" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.startTime.day"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>日</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.startTime.hour" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.startTime.hour"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>时</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.startTime.min" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.startTime.min"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>分</span>
         </div>
-        <span style="width: 60px;text-align: center">至</span>
+        <span style="width: 60px; text-align: center">至</span>
         <div>
-          <el-input class="input" :maxlength="4" v-model="data.endTime.year" placeholder="" style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="4"
+            v-model="data.endTime.year"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>年</span>
-          <el-input class="input" :maxlength="2" v-model="data.endTime.month" placeholder="" style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            v-model="data.endTime.month"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>月</span>
-          <el-input class="input" :maxlength="2" v-model="data.endTime.day" placeholder="" style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            v-model="data.endTime.day"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>日</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.endTime.hour" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.endTime.hour"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>时</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.endTime.min" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.endTime.min"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>分</span>
         </div>
       </div>
 
       <div class="line">
         <span>勘验地点:</span>
-        <el-input class="input" type="tel" v-model="data.address" placeholder="" style="width: 100%;" />
+        <el-input
+          class="input"
+          type="tel"
+          v-model="data.address"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
       <div class="line">
         <span>勘验人员姓名、单位、职务(含技术职务):</span>
-        <el-input class="input" type="tel" v-model="data.userInfo" placeholder="" style="width: 100%;" />
-
+        <el-input
+          class="input"
+          type="tel"
+          v-model="data.userInfo"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="line">
         <span>勘验气象条件(天气、风力、温度):</span>
-        <el-input class="input" type="tel" v-model="data.weather" placeholder="" style="width: 100%;" />
+        <el-input
+          class="input"
+          type="tel"
+          v-model="data.weather"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>勘验情况:</span>
-        <el-input type="textarea" :rows="4" v-model="data.situation" placeholder="" style="width: 100%;" />
-
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="data.situation"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
       <div class="textarea">
         <span>一、环境勘验</span>
-        <el-input type="textarea" :rows="4" v-model="data.environment" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="data.environment"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>二、初步勘验</span>
-        <el-input type="textarea" :rows="4" v-model="data.firstInquest" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="data.firstInquest"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>三、细项勘验</span>
-        <el-input type="textarea" :rows="4" v-model="data.carefulInquest" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="data.carefulInquest"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>四、专项勘验</span>
-        <el-input type="textarea" :rows="6" v-model="data.specialInquest" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="6"
+          v-model="data.specialInquest"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>提取物品描述:</span>
-        <el-input type="textarea" :rows="6" v-model="data.itemDescription" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="6"
+          v-model="data.itemDescription"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="textarea">
         <span>现场拍照制图描述:</span>
-        <el-input type="textarea" :rows="6" v-model="data.imgDescription" placeholder="" style="width: 100%;" />
+        <el-input
+          type="textarea"
+          :rows="6"
+          v-model="data.imgDescription"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="info">
@@ -128,51 +252,78 @@
           <span class="sub-tit">证人信息:</span>
           <div class="line">
             <span>证人或当事人:</span>
-            <el-input class="input" v-model="item.name" placeholder="" style="width: 180px;" />
+            <el-input
+              class="input"
+              v-model="item.name"
+              placeholder=""
+              style="width: 180px"
+            />
             <div>
-              <el-input class="input" v-model="item.year" placeholder="" style="width: 80px;" />
+              <el-input
+                class="input"
+                v-model="item.year"
+                placeholder=""
+                style="width: 80px"
+              />
               <span>年</span>
-              <el-input class="input" v-model="item.month" placeholder="" style="width: 80px;" />
+              <el-input
+                class="input"
+                v-model="item.month"
+                placeholder=""
+                style="width: 80px"
+              />
               <span>月</span>
-              <el-input class="input" v-model="item.day" placeholder="" style="width: 80px;" />
+              <el-input
+                class="input"
+                v-model="item.day"
+                placeholder=""
+                style="width: 80px"
+              />
               <span>日</span>
             </div>
 
-            <span style="margin-left:50px">身份证件号码:</span>
-            <el-input class="input" v-model="item.id" placeholder="" style="width: 280px;" />
+            <span style="margin-left: 50px">身份证件号码:</span>
+            <el-input
+              class="input"
+              v-model="item.id"
+              placeholder=""
+              style="width: 280px"
+            />
           </div>
           <div class="line">
             <span>单位或住址:</span>
-            <el-input class="input" v-model="item.address" placeholder="" style="width: 100%;" />
+            <el-input
+              class="input"
+              v-model="item.address"
+              placeholder=""
+              style="width: 100%"
+            />
           </div>
         </div>
-
       </template>
 
       <div class="btn-container">
         <el-button class="btn" @click="addwitnessInfo">+新增</el-button>
       </div>
 
-      <div>
-      </div>
+      <div></div>
     </div>
   </div>
-
 </template>
 <script setup>
-import { onMounted, ref, watch } from 'vue';
-import { reactive } from 'vue'
+import { onMounted, ref, watch } from "vue";
+import { reactive } from "vue";
 import {
   getCaseInquestInfo,
   saveCaseInquestInfo,
-  exportCaseInquestInfo
+  exportCaseInquestInfo,
 } from "@/store/case";
-import { ElMessage } from 'element-plus'
+import { ElMessage } from "element-plus";
 import saveAs from "@/util/file-serve";
-const props = defineProps({ caseId: Number })
-
-console.log(props)
+const props = defineProps({ caseId: Number });
 
+console.log(props);
+const isDisableExport = ref(false);
 const data = reactive({
   count: "",
   startTime: {
@@ -180,96 +331,102 @@ const data = reactive({
     month: "",
     day: "",
     hour: "",
-    min: ""
+    min: "",
   },
   endTime: {
     year: "",
     month: "",
     day: "",
     hour: "",
-    min: ""
+    min: "",
   },
-  address: '',
-  userInfo: '',
-  weather: '',
-  situation: '',
-  environment: '',  //环境勘验
-  firstInquest: '', //初步勘验
-  carefulInquest: '', //细项勘验
-  specialInquest: '', //专项勘验
-  itemDescription: '',
-  imgDescription: '',
-  leader: '',
-  recorder: '',
-  inspector: '',
-  witnessInfo: [{
-    name: "",
-    year: "",
-    month: "",
-    day: "",
-    id: "",
-    address: ""
-  }, {
-    name: "",
-    year: "",
-    month: "",
-    day: "",
-    id: "",
-    address: ""
-  }]
-})
-
-watch(data, newValue => {
-  // data.userName = newValue.userName.replace(/[^0-9]/g, '');
-  const sMonth = newValue.startTime.month.replace(/[^0-9]/g, '');
-  const sDay = newValue.startTime.day.replace(/[^0-9]/g, '');
-  const sHour = newValue.startTime.hour.replace(/[^0-9]/g, '');
-  const sMin = newValue.startTime.min.replace(/[^0-9]/g, '');
-
-  const eMonth = newValue.endTime.month.replace(/[^0-9]/g, '');
-  const eDay = newValue.endTime.day.replace(/[^0-9]/g, '');
-  const eHour = newValue.endTime.hour.replace(/[^0-9]/g, '');
-  const eMin = newValue.endTime.min.replace(/[^0-9]/g, '');
-
-
-  data.startTime.year = newValue.startTime.year.replace(/[^0-9]/g, '');
-  data.startTime.month = Number(sMonth) > 12 ? '12' : sMonth;
-  data.startTime.day = Number(sDay) > 31 ? '31' : sDay;
-  data.startTime.hour = Number(sDay) > 24 ? '24' : sHour;
-  data.startTime.min = Number(sMin) > 60 ? '0' : sMin;
-
-  data.endTime.year = newValue.endTime.year.replace(/[^0-9]/g, '');
-  data.endTime.month = Number(eMonth) > 12 ? '12' : eMonth;
-  data.endTime.day = Number(eDay) > 31 ? '31' : eDay;
-  data.endTime.hour = Number(eHour) > 24 ? '24' : eHour;
-  data.endTime.min = Number(eMin) > 60 ? '0' : eMin;
-
-
-  newValue.witnessInfo.forEach((item, key) => {
-    const year = newValue.witnessInfo[key].year.replace(/[^0-9]/g, '');
-    const month = newValue.witnessInfo[key].month.replace(/[^0-9]/g, '');
-    const day = newValue.witnessInfo[key].day.replace(/[^0-9]/g, '');
-    data.witnessInfo[key].year = year;
-    data.witnessInfo[key].month = Number(month) > 12 ? '12' : month;
-    data.witnessInfo[key].day = Number(day) > 31 ? '31' : day;
-  })
-
-}, {
-  immediate: true,
-  deep: true
-})
+  address: "",
+  userInfo: "",
+  weather: "",
+  situation: "",
+  environment: "", //环境勘验
+  firstInquest: "", //初步勘验
+  carefulInquest: "", //细项勘验
+  specialInquest: "", //专项勘验
+  itemDescription: "",
+  imgDescription: "",
+  leader: "",
+  recorder: "",
+  inspector: "",
+  witnessInfo: [
+    {
+      name: "",
+      year: "",
+      month: "",
+      day: "",
+      id: "",
+      address: "",
+    },
+    {
+      name: "",
+      year: "",
+      month: "",
+      day: "",
+      id: "",
+      address: "",
+    },
+  ],
+});
+
+watch(
+  data,
+  (newValue) => {
+    // data.userName = newValue.userName.replace(/[^0-9]/g, '');
+    const sMonth = newValue.startTime.month.replace(/[^0-9]/g, "");
+    const sDay = newValue.startTime.day.replace(/[^0-9]/g, "");
+    const sHour = newValue.startTime.hour.replace(/[^0-9]/g, "");
+    const sMin = newValue.startTime.min.replace(/[^0-9]/g, "");
+
+    const eMonth = newValue.endTime.month.replace(/[^0-9]/g, "");
+    const eDay = newValue.endTime.day.replace(/[^0-9]/g, "");
+    const eHour = newValue.endTime.hour.replace(/[^0-9]/g, "");
+    const eMin = newValue.endTime.min.replace(/[^0-9]/g, "");
+
+    data.startTime.year = newValue.startTime.year.replace(/[^0-9]/g, "");
+    data.startTime.month = Number(sMonth) > 12 ? "12" : sMonth;
+    data.startTime.day = Number(sDay) > 31 ? "31" : sDay;
+    data.startTime.hour = Number(sDay) > 24 ? "24" : sHour;
+    data.startTime.min = Number(sMin) > 60 ? "0" : sMin;
+
+    data.endTime.year = newValue.endTime.year.replace(/[^0-9]/g, "");
+    data.endTime.month = Number(eMonth) > 12 ? "12" : eMonth;
+    data.endTime.day = Number(eDay) > 31 ? "31" : eDay;
+    data.endTime.hour = Number(eHour) > 24 ? "24" : eHour;
+    data.endTime.min = Number(eMin) > 60 ? "0" : eMin;
+
+    newValue.witnessInfo.forEach((item, key) => {
+      const year = newValue.witnessInfo[key].year.replace(/[^0-9]/g, "");
+      const month = newValue.witnessInfo[key].month.replace(/[^0-9]/g, "");
+      const day = newValue.witnessInfo[key].day.replace(/[^0-9]/g, "");
+      data.witnessInfo[key].year = year;
+      data.witnessInfo[key].month = Number(month) > 12 ? "12" : month;
+      data.witnessInfo[key].day = Number(day) > 31 ? "31" : day;
+    });
+  },
+  {
+    immediate: true,
+    deep: true,
+  }
+);
 
 onMounted(async () => {
   const res = await getCaseInquestInfo(props.caseId);
-  console.log('res', res)
+  console.log("res", res);
+  if (!res.data) {
+    isDisableExport.value = true;
+  }
   for (var k in data) {
     if (res.data && res.data.hasOwnProperty(k)) {
-      console.log("Key is " + k)
-      data[k] = res.data[k]
+      console.log("Key is " + k);
+      data[k] = res.data[k];
     }
   }
-
-})
+});
 
 const addwitnessInfo = () => {
   // witnessInfoes.value += 1
@@ -278,23 +435,22 @@ const addwitnessInfo = () => {
     year: "",
     month: "",
     day: "",
-    id: ""
-  })
-}
+    id: "",
+  });
+};
 
 const handleSave = async () => {
-  console.log('data', data)
+  console.log("data", data);
   const res = await saveCaseInquestInfo(props.caseId, data);
   if (res.code === 0) {
-    ElMessage.success('保存成功!')
+    ElMessage.success("保存成功!");
   }
-}
+};
 const handleExport = async () => {
   const res = await exportCaseInquestInfo(props.caseId);
-  console.log('res', res)
-  saveAs(res, `勘验笔录-${props.caseId}.docx`)
-}
-
+  console.log("res", res);
+  saveAs(res, `勘验笔录-${props.caseId}.docx`);
+};
 </script>
 
 <style lang="scss">
@@ -352,8 +508,6 @@ const handleExport = async () => {
 .info {
   display: block;
 
-
-
   .inner {
     display: flex;
     flex-direction: row;
@@ -369,15 +523,11 @@ const handleExport = async () => {
       align-items: center;
       justify-content: center;
     }
-
-
   }
-
-
 }
 
 .witnessInfo {
-  background: #F5F5F5;
+  background: #f5f5f5;
   padding: 15px;
   margin-top: 20px;
   margin-right: 8px;
@@ -391,13 +541,13 @@ const handleExport = async () => {
   padding: 20px 0;
 
   .btn {
-    color: #26559B;
+    color: #26559b;
     width: 100%;
 
     &:hover {
-      background: #F5F5F5;
+      background: #f5f5f5;
       border-color: #dcdfe6;
     }
   }
 }
-</style>
+</style>