Jelajahi Sumber

feat: 修改保存

gemercheung 10 bulan lalu
induk
melakukan
7ec42f3dad

+ 1 - 1
src/constant/caseFile.ts

@@ -6,7 +6,7 @@ export const OtherFormats = [".pdf", ".jpeg", ".doc", ".docx", ".jpg", ".png"];
 export const BoardTypeDesc = {
   [BoardType.scene]: "现场图",
   [BoardType.map]: "方位图",
-  [BoardType.media]: "媒体图",
+  [BoardType.media]: "照片",
 };
 export const DrawFormatDesc = "jpg、png等格式的文件";
 export const OtherFormatDesc = "pdf、word、jpg、png等格式的文件";

+ 62 - 63
src/view/case/draw/board/editCAD/Geometry/BgImage.js

@@ -1,76 +1,75 @@
-import VectorType from '../enum/VectorType.js'
-import Geometry from './Geometry'
-import { mathUtil } from '../MathUtil.js'
-import SelectState from '../enum/SelectState.js'
-import { coordinate } from '../Coordinate.js'
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+import { mathUtil } from "../MathUtil.js";
+import SelectState from "../enum/SelectState.js";
+import { coordinate } from "../Coordinate.js";
 
 export default class BgImage extends Geometry {
-    constructor(url,center,vectorId) {
-        super()
-        this.url = url;
-        if(center){
-            this.center = center    //左上角
-        }else{
-            this.center = {
-                x:80,
-                y:150
-            }
-        }
-        
-        this.image = null;
-        this.width = 540;
-        this.height = 390;
-        this.scale = 1 //缩放比例
-        
-        this.geoType = VectorType.BgImage
-        this.setId(vectorId)
+  constructor(url, center, vectorId) {
+    super();
+    this.url = url;
+    if (center) {
+      this.center = center; //左上角
+    } else {
+      this.center = {
+        x: 80,
+        y: 150,
+      };
     }
 
-    setImageData(imgData){
-        this.image = imgData;
-    }
+    this.image = null;
+    this.width = 540;
+    this.height = 390;
+    this.scale = 1; //缩放比例
 
-    setUrl(url){
-        this.url = url;
-    }
+    this.geoType = VectorType.BgImage;
+    this.setId(vectorId);
+  }
 
-    setScale(scale){
-        this.scale = scale;
-    }
+  setImageData(imgData) {
+    this.image = imgData;
+  }
+
+  setUrl(url) {
+    this.url = url;
+  }
+
+  setScale(scale) {
+    this.scale = scale;
+  }
 
-    isContain(position) {
+  isContain(position) {
+    let p0 = {
+      x: this.center.x,
+      y: this.center.y,
+    };
 
-        let p0 = {
-            x:this.center.x,
-            y:this.center.y
-        }
+    let p1 = {
+      x: this.center.x,
+      y: this.center.y + this.height * this.scale,
+    };
 
-        let p1 = {
-            x:this.center.x,
-            y:this.center.y + this.height*this.scale
-        }
+    let p2 = {
+      x: this.center.x + this.width * this.scale,
+      y: this.center.y + this.height * this.scale,
+    };
 
-        let p2 = {
-            x:this.center.x + this.width*this.scale,
-            y:this.center.y + this.height*this.scale
-        }
+    let p3 = {
+      x: this.center.x + this.width * this.scale,
+      y: this.center.y,
+    };
 
-        let p3 = {
-            x:this.center.x + this.width*this.scale,
-            y:this.center.y
-        }
-        
-        position = coordinate.getScreenXY(position);
+    position = coordinate.getScreenXY(position);
 
-        this.points = [];
-        this.points.push(p0)
-        this.points.push(p1)
-        this.points.push(p2)
-        this.points.push(p3)
-        if(mathUtil.isPointInPoly(position, this.points)){
-            return SelectState.Select
-        }else {
-            return null
-        }
+    this.points = [];
+    this.points.push(p0);
+    this.points.push(p1);
+    this.points.push(p2);
+    this.points.push(p3);
+    if (mathUtil.isPointInPoly(position, this.points)) {
+      return SelectState.Select;
+    } else {
+      return null;
     }
-}
+  }
+}

File diff ditekan karena terlalu besar
+ 991 - 783
src/view/case/draw/board/editCAD/ListenLayer.js


+ 1 - 1
src/view/case/draw/board/editCAD/Load.js

@@ -179,7 +179,7 @@ export default class Load {
       if (floor.bgImage && floor.bgImage.url) {
         const bgImage = await bgImageService.createBgImage(
           floor.bgImage.url,
-          floor.bgImage.center
+          floor.bgImage.center,
         );
         if (floor.bgImage.hasOwnProperty("scale")) {
           bgImage.setScale(floor.bgImage.scale);

+ 1 - 2
src/view/case/draw/board/editCAD/Renderer/Render.js

@@ -140,7 +140,7 @@ export default class Render {
     if (!data) {
       return;
     }
-    let titleOpener = data.title.show;
+    let titleOpener = !data.title.noShow;
     let title = data.title;
     titleOpener && this.drawGeometry(title);
 
@@ -150,7 +150,6 @@ export default class Render {
     let compass = data.compass;
     let compassOpener = !data.compass.noShow;
     compassOpener && this.drawGeometry(compass);
-    // debugger
 
     let walls = data.walls;
     for (let key in walls) {

+ 2 - 1
src/view/case/draw/edit-shape/bgImage.vue

@@ -7,8 +7,9 @@
       :step="0.01"
       :max="2"
       @change="shape.setScale(scale, true)"
-    />
+    />  
   </el-form-item>
+  
   <Del @delete="$emit('delete')" />
 </template>
 <script setup lang="ts">

+ 13 - 6
src/view/case/draw/index.vue

@@ -28,7 +28,7 @@
         />
       </div>
       <div class="df-content">
-        <div class="df-content-layout">
+        <div class="df-content-layout" :class="{ isMedia: true }">
           <div class="df-board">
             <canvas ref="dom" />
           </div>
@@ -58,15 +58,17 @@ import {
 import { uploadFile } from "@/store/system";
 import { number } from "echarts";
 
+const route = router.currentRoute.value;
+const params = route.params;
+const query = route.query;
+
+const isMedia = computed(() => query.filesTypeId);
+
 const dom = ref<HTMLCanvasElement>();
 const props = computed(() => {
-  const route = router.currentRoute.value;
   if (route.name !== RouteName.drawCaseFile || !dom.value) {
     return null;
   } else {
-    const params = route.params;
-    const query = route.query;
-
     const fileId = Number(params.id);
     return {
       caseId: Number(params.caseId),
@@ -138,7 +140,7 @@ const saveHandler = async () => {
     filesTitle:
       titleShape?.text || `${args.caseId}_${BoardTypeDesc[args.type]}`,
     content: store,
-    filesTypeId:  Number(props.value?.filesTypeId) || 1,
+    filesTypeId: Number(props.value?.filesTypeId) || 1,
   };
   args.inAdd || (body.filesId = props.value!.fileId);
 
@@ -205,6 +207,11 @@ const exportHandler = async () => {
   --padding: 0;
   --calc: 3.5;
   border: calc(var(--padding) * var(--calc)) solid #fff;
+
+  // &.isMedia {
+  //   --w: 347px;
+  //   --h: 210px;
+  // }
 }
 
 .df-board {

+ 1 - 1
src/view/case/draw/slider.vue

@@ -104,7 +104,7 @@ const props = defineProps<{
 const fileDesc = {
   [BoardType.scene]: "户型图",
   [BoardType.map]: "方位图",
-  [BoardType.media]: "媒体图",
+  [BoardType.media]: "照片",
 };
 const emit = defineEmits<{
   (e: "update:addShape", val: MetaShapeType | null, data?: any): void;

+ 8 - 8
src/view/case/editMenu.vue

@@ -85,14 +85,14 @@ const menus = computed(() => {
         );
       },
     },
-    {
-      key: "sync",
-      label: "带看",
-      onClick: async () => {
-        const href = await getSWKKSyncLink(caseId);
-        window.open(href);
-      },
-    },
+    // {
+    //   key: "sync",
+    //   label: "带看",
+    //   onClick: async () => {
+    //     const href = await getSWKKSyncLink(caseId);
+    //     window.open(href);
+    //   },
+    // },
     {
       key: "share",
       label: "分享",

+ 21 - 6
src/view/case/records/index.vue

@@ -614,14 +614,20 @@ const initInfo = async () => {
   }
   for (var k in data) {
     if (res.data && res.data.hasOwnProperty(k)) {
-      console.log("Key is " + k);
+      // console.log("Key is " + k);
       if (res.data[k]) {
         data[k] = res.data[k];
       }
     }
   }
+  setTimeout(() => {
+    initSignatureAndWitInfo();
+  }, 500);
 };
 const initSignatureAndWitInfo = () => {
+  (data.recorderInfo.length === 0 || !data.recorderInfo) &&
+    (data.recorderInfo = [...recorderInfoType, recorderInfoType[4]]);
+
   (data.signatureInfo.length === 0 || !data.signatureInfo) &&
     Array.from(new Array(signatureInfoNum)).forEach(() => {
       data.signatureInfo.push({
@@ -629,6 +635,7 @@ const initSignatureAndWitInfo = () => {
         job: "",
       });
     });
+
   (data.witnessInfo.length === 0 || !data.witnessInfo) &&
     Array.from(new Array(witnessInfoNum)).forEach(() => {
       data.witnessInfo.push({
@@ -641,7 +648,6 @@ const initSignatureAndWitInfo = () => {
 
 onMounted(() => {
   initInfo();
-  initSignatureAndWitInfo();
 });
 
 const addRecorderInfo = () => {
@@ -691,11 +697,20 @@ const removeWitnessInfo = async (index) => {
 const handleSave = async () => {
   console.log("data", data);
 
+  for (var k in data) {
+    if (data && data.hasOwnProperty(k)) {
+      // console.log("Key is " + k);
+      if (Array.isArray(data[k])) {
+        data[k] = data[k].sort((a, b) => a - b);
+      }
+    }
+  }
+  console.log("saveCaseInquestInfo", data);
   const res = await saveCaseInquestInfo(props.caseId, data);
-  // if (res.code === 0) {
-  //   ElMessage.success("保存成功!");
-  //   initInfo();
-  // }
+  if (res.code === 0) {
+    ElMessage.success("保存成功!");
+    initInfo();
+  }
 };
 const handleExport = async () => {
   await saveCaseInquestInfo(props.caseId, data);