jinx 1 year ago
parent
commit
da29f90393

+ 1 - 1
src/graphic/Constant.js

@@ -28,7 +28,7 @@ const Constant = {
   minAdsorbPix: 25, //最小吸附像素
   minRealDis: 20,
   defaultRoadWidth: 100, //默认公路宽度
-  roadSideWidth: 20, //默认路缘宽度
+  roadSideWidth: 0.2, //默认路缘宽度
   roadWidthTipsDistance: 100, //路宽提示距离
   ratio: 1,
   minAngle: 10,

+ 3 - 0
src/graphic/Controls/UIControl.js

@@ -341,6 +341,9 @@ export default class UIControl {
     } else if (selectUI == VectorEvents.AddBranchRoad) {
     } else if (selectUI == VectorEvents.AddNarrowRoad) {
     } else if (selectUI == VectorEvents.UnLock) {
+      if (Settings.selectSVGType == RoadStructure.ZebraCrossing) {
+        uiService.setSelectSVGType(null);
+      }
       let road = dataService.getRoad(focusItem.vectorId);
       let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
       let rightEdge = dataService.getRoadEdge(road.rightEdgeId);

+ 1 - 1
src/graphic/Renderer/Draw.js

@@ -1203,7 +1203,7 @@ export default class Draw {
         return;
       }
 
-      console.log(line);
+      // console.log(line);
       if (line.category !== "ZebraCrossing") {
         const [stylea, attr] = help.getVectorStyle(line, line.category);
         style = {

+ 0 - 1
src/graphic/Util/MathUtil.js

@@ -146,7 +146,6 @@ export default class MathUtil {
       line2.b = b - db;
     }
 
-    console.log(line, line1, line2, distance);
     return { line1: line1, line2: line2 };
   }
 

+ 21 - 45
src/utils/index.ts

@@ -27,10 +27,7 @@ export const debounce = <T extends (...args: any) => any>(fn: T, delay: number =
 const place = /(?:\/:([^/]*))/g;
 // 匹配 /:id 是否匹配某个url
 export const equalUrl = (tempUrl: string, url: string) => {
-  const urlRgStr =
-    "^" +
-    tempUrl.replace(/\/([^:])/g, (_, d) => `\\/${d}`).replace(place, () => `(?:/[^/]*)`) +
-    "$";
+  const urlRgStr = "^" + tempUrl.replace(/\/([^:])/g, (_, d) => `\\/${d}`).replace(place, () => `(?:/[^/]*)`) + "$";
   return new RegExp(urlRgStr).test(url);
 };
 
@@ -48,8 +45,7 @@ export const gendUrl = (tempUrl: string, params: { [key: string]: any }) => {
 };
 
 // 匹配一组数组是否是path链接
-export const includesUrl = (tempUrls: Array<string> | readonly string[], url: string) =>
-  tempUrls.some((tempUrl) => equalUrl(tempUrl, url));
+export const includesUrl = (tempUrls: Array<string> | readonly string[], url: string) => tempUrls.some((tempUrl) => equalUrl(tempUrl, url));
 
 // 字符串转params对象
 export const strToParams = (str: string) => {
@@ -85,17 +81,10 @@ export const toRawType = (value: unknown): string => {
   return toTypeString(value).slice(8, -1);
 };
 
-export const isString = <T>(value: T): T extends string ? true : false =>
-  (toRawType(value) === "String") as any;
+export const isString = <T>(value: T): T extends string ? true : false => (toRawType(value) === "String") as any;
 
 // 递归复制
-export const recursionCopy = <
-  T extends object | Array<any>,
-  R extends object | Array<any>
->(
-  from: R,
-  to: T
-): T & R => {
+export const recursionCopy = <T extends object | Array<any>, R extends object | Array<any>>(from: R, to: T): T & R => {
   if (toRawType(from) !== toRawType(to)) {
     return to as T & R;
   }
@@ -115,10 +104,7 @@ export const recursionCopy = <
         const fromItemType = toRawType(fromItem);
         const toItemType = toRawType(toItem);
 
-        if (
-          fromItemType === toItemType &&
-          (fromItemType === "Object" || fromItemType === "Array")
-        ) {
+        if (fromItemType === toItemType && (fromItemType === "Object" || fromItemType === "Array")) {
           (result as any)[fromKey] = recursionCopy(fromItem, toItem);
         } else {
           (result as any)[fromKey] = toItem;
@@ -161,10 +147,7 @@ export const formatDate = (date: Date, fmt: string = "yyyy-MM-dd hh:mm") => {
   (Object.keys(map) as Array<keyof typeof map>).forEach((k) => {
     if (new RegExp("(" + k + ")").test(fmt)) {
       const val = map[k].toString();
-      fmt = fmt.replace(
-        RegExp.$1,
-        RegExp.$1.length === 1 ? val : ("00" + val).substr(val.length)
-      );
+      fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? val : ("00" + val).substr(val.length));
     }
   });
 
@@ -172,10 +155,7 @@ export const formatDate = (date: Date, fmt: string = "yyyy-MM-dd hh:mm") => {
 };
 
 // 函数调用拦截
-export const funIntercept = <T extends (...args: any) => any>(
-  originFun: T,
-  proxyFun: (args: Parameters<T>, result: ReturnType<T>) => void
-): T =>
+export const funIntercept = <T extends (...args: any) => any>(originFun: T, proxyFun: (args: Parameters<T>, result: ReturnType<T>) => void): T =>
   function (...args: Parameters<T>) {
     const result = originFun.apply(this, args);
     proxyFun(args, result);
@@ -189,8 +169,7 @@ export const round = (num: number, index: number = 2) => {
 };
 
 // setTimeout转promise
-export const asyncTimeout = (mis: number = 0) =>
-  new Promise((resolve) => setTimeout(resolve, mis));
+export const asyncTimeout = (mis: number = 0) => new Promise((resolve) => setTimeout(resolve, mis));
 
 // 持续检查直到通过
 export const checkPromise = <T = any>(check: () => T) => {
@@ -296,26 +275,17 @@ const _inRevise = (raw1, raw2, readly: Set<[any, any]>) => {
   readly.add([raw1, raw2]);
 
   if (rawType1 === "Array") {
-    return (
-      raw1.length !== raw2.length ||
-      raw1.some((item1, i) => _inRevise(item1, raw2[i], readly))
-    );
+    return raw1.length !== raw2.length || raw1.some((item1, i) => _inRevise(item1, raw2[i], readly));
   } else if (rawType1 === "Object") {
     const rawKeys1 = Object.keys(raw1).sort();
     const rawKeys2 = Object.keys(raw2).sort();
 
-    return (
-      _inRevise(rawKeys1, rawKeys2, readly) ||
-      rawKeys1.some((key) => _inRevise(raw1[key], raw2[key], readly))
-    );
+    return _inRevise(rawKeys1, rawKeys2, readly) || rawKeys1.some((key) => _inRevise(raw1[key], raw2[key], readly));
   } else if (rawType1 === "Map") {
     const rawKeys1 = Array.from(raw1.keys()).sort();
     const rawKeys2 = Array.from(raw2.keys()).sort();
 
-    return (
-      _inRevise(rawKeys1, rawKeys2, readly) ||
-      rawKeys1.some((key) => _inRevise(raw1.get(key), raw2.get(key), readly))
-    );
+    return _inRevise(rawKeys1, rawKeys2, readly) || rawKeys1.some((key) => _inRevise(raw1.get(key), raw2.get(key), readly));
   } else if (rawType1 === "Set") {
     return inRevise(Array.from(raw1.values()), Array.from(raw2.values()));
   } else {
@@ -493,10 +463,7 @@ export const toDigital = (dms: string, retain = 6) => {
   }
 };
 
-export const addImmobilityClick = (
-  dom: HTMLElement,
-  handler: (ev?: MouseEvent) => any
-) => {
+export const addImmobilityClick = (dom: HTMLElement, handler: (ev?: MouseEvent) => any) => {
   const mousedownHandler = (ev: MouseEvent) => {
     const dx = ev.offsetX;
     const dy = ev.offsetY;
@@ -560,3 +527,12 @@ export const blobToBase64 = (blob: Blob) => {
 export const getId = () => {
   return new Date().getTime().toString() + Math.ceil(Math.random() * 1000).toString();
 };
+
+export const getQueryString = (name) => {
+  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+  var r = decodeURIComponent(window.location.search.substr(1)).match(reg);
+  if (r != null) {
+    return unescape(r[2]);
+  }
+  return null;
+};

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

@@ -4,7 +4,7 @@
       <div class="photos-header">
         <div class="left">
           <ui-icon class="back-icon" type="return" ctrl style="margin-right: 10px" @click="back" />
-          <span> 案件 </span>
+          <span> {{ sceneTitle }} </span>
         </div>
       </div>
     </template>
@@ -92,7 +92,7 @@ import { currentView } from "./currentScene";
 import { router, writeRouteName } from "@/router";
 import { roadPhotos } from "@/store/roadPhotos";
 import { types, accidentPhotos } from "@/store/accidentPhotos";
-import { debounce } from "@/utils";
+import { debounce, getQueryString } from "@/utils";
 import { tables } from "@/store/tables";
 const layoutRef = ref(null);
 const activeMenuKeys = ref<string[]>([]);
@@ -112,6 +112,8 @@ const enum TypeEnum {
 const currentType = ref(TypeEnum.Draw);
 const sceneSortPhotos = computed(() => roadPhotos.value);
 
+const sceneTitle = ref(getQueryString("title") ? decodeURIComponent(getQueryString("title")) : "案件");
+
 const loaded = ref(false);
 const childPage = ref(false);
 const stopReg = watchEffect(() => {
@@ -186,6 +188,7 @@ const list = ref([
     type: "law",
   },
 ]);
+
 onMounted(() => {
   var screenHeight = document.body.clientHeight;
   layoutRef.value.style.height = screenHeight + "px";
@@ -199,7 +202,6 @@ onMounted(() => {
     sceneCanvas.addEventListener("touchstart", () => {
       setBlur();
     });
-
   });
 });
 const setBlur = () => {