jinx 1 年之前
父节点
当前提交
fabaea0263

+ 2 - 1
src/graphic/History/HistoryUtil.js

@@ -150,7 +150,8 @@ export default class HistoryUtil {
       road1.endId == road2.endId &&
       road1.leftEdgeId == road2.leftEdgeId &&
       road1.rightEdgeId == road2.rightEdgeId &&
-      road1.way == road2.way
+      road1.way == road2.way &&
+      road1.roadWidthTipsPos == road2.roadWidthTipsPos 
     ) {
       if (road1.way == Constant.oneWay) {
         if (

+ 79 - 299
src/graphic/Layer.js

@@ -159,11 +159,7 @@ export default class Layer {
         stateService.setEventName(LayerEvents.MovePoint);
         const newPoint = addPoint.buildPoint(position);
         if (newPoint) {
-          stateService.setSelectItem(
-            newPoint.vectorId,
-            VectorType.Point,
-            SelectState.Select
-          );
+          stateService.setSelectItem(newPoint.vectorId, VectorType.Point, SelectState.Select);
           this.renderer.autoRedraw();
         }
         break;
@@ -175,11 +171,7 @@ export default class Layer {
       case LayerEvents.AddText:
         stateService.setEventName(LayerEvents.MoveText);
         addText.buildText(position);
-        stateService.setSelectItem(
-          addText.newText.vectorId,
-          VectorType.Text,
-          SelectState.Select
-        );
+        stateService.setSelectItem(addText.newText.vectorId, VectorType.Text, SelectState.Select);
         addText.clear();
         break;
       case LayerEvents.AddSVG:
@@ -193,11 +185,7 @@ export default class Layer {
       case LayerEvents.AddMagnifier:
         stateService.setEventName(LayerEvents.MoveMagnifier);
         addMagnifier.buildMagnifier(position);
-        stateService.setSelectItem(
-          addMagnifier.newMagnifier.vectorId,
-          VectorType.Magnifier,
-          SelectState.Select
-        );
+        stateService.setSelectItem(addMagnifier.newMagnifier.vectorId, VectorType.Magnifier, SelectState.Select);
         addMagnifier.clear();
         break;
       case VectorEvents.AddLane:
@@ -208,17 +196,9 @@ export default class Layer {
             selectAddLaneFlag = true;
             let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
-              roadService.updateForAddSubtractLanesCount(
-                road.vectorId,
-                roadLanCount + 1,
-                selectItem.dir
-              );
+              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
             } else {
-              roadService.updateForAddSubtractLanesCount(
-                road.vectorId,
-                roadLanCount + 1,
-                selectItem.dir
-              );
+              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
             }
             roadService.initRoadWidthTipsPos(road);
 
@@ -236,17 +216,9 @@ export default class Layer {
               selectAddLaneFlag = true;
               let curveRoadLanCount = road.getLanesCount(selectItem.dir);
               if (selectItem.dir == "left") {
-                curveRoadService.updateForAddSubtractLanesCount(
-                  road.vectorId,
-                  curveRoadLanCount + 1,
-                  selectItem.dir
-                );
+                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
               } else {
-                curveRoadService.updateForAddSubtractLanesCount(
-                  road.vectorId,
-                  curveRoadLanCount + 1,
-                  selectItem.dir
-                );
+                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
               }
               let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
@@ -274,17 +246,9 @@ export default class Layer {
             selectDelLaneFlag = true;
             let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
-              roadService.updateForAddSubtractLanesCount(
-                road.vectorId,
-                roadLanCount - 1,
-                selectItem.dir
-              );
+              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
             } else {
-              roadService.updateForAddSubtractLanesCount(
-                road.vectorId,
-                roadLanCount - 1,
-                selectItem.dir
-              );
+              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
             }
             let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
             let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
@@ -300,17 +264,9 @@ export default class Layer {
               selectDelLaneFlag = true;
               let curveRoadLanCount = road.getLanesCount(selectItem.dir);
               if (selectItem.dir == "left") {
-                curveRoadService.updateForAddSubtractLanesCount(
-                  road.vectorId,
-                  curveRoadLanCount - 1,
-                  selectItem.dir
-                );
+                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
               } else {
-                curveRoadService.updateForAddSubtractLanesCount(
-                  road.vectorId,
-                  curveRoadLanCount - 1,
-                  selectItem.dir
-                );
+                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
               }
               let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
@@ -334,18 +290,12 @@ export default class Layer {
         if (focusItem && focusItem.vectorId) {
           if (focusItem.type == VectorType.CurveRoad) {
             const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
-            let index = mathUtil.getIndexForCurvesPoints(
-              position,
-              curveRoad.points
-            );
+            let index = mathUtil.getIndexForCurvesPoints(position, curveRoad.points);
             if (index != -1) {
               curveRoadService.addCPoint(curveRoad, position, index);
             } else {
               const dis1 = mathUtil.getDistance(curveRoad.points[0], position);
-              const dis2 = mathUtil.getDistance(
-                curveRoad.points[curveRoad.points.length - 1],
-                position
-              );
+              const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], position);
               if (dis1 > dis2) {
                 index = curveRoad.points.length - 2;
               } else {
@@ -372,18 +322,12 @@ export default class Layer {
             curveLine.setStyle(style);
           } else if (focusItem.type == VectorType.CurveLine) {
             let curveLine = dataService.getCurveLine(focusItem.vectorId);
-            let index = mathUtil.getIndexForCurvesPoints(
-              position,
-              curveLine.points
-            );
+            let index = mathUtil.getIndexForCurvesPoints(position, curveLine.points);
             if (index != -1) {
               lineService.addCPoint(position, index, focusItem.vectorId);
             } else {
               const dis1 = mathUtil.getDistance(curveLine.points[0], position);
-              const dis2 = mathUtil.getDistance(
-                curveLine.points[curveLine.points.length - 1],
-                position
-              );
+              const dis2 = mathUtil.getDistance(curveLine.points[curveLine.points.length - 1], position);
               if (dis1 > dis2) {
                 index = curveLine.points.length - 2;
               } else {
@@ -417,11 +361,7 @@ export default class Layer {
     selectItem = stateService.getSelectItem();
     stateService.setDraggingItem(selectItem);
     stateService.clearFocusItem();
-    if (
-      selectItem &&
-      this.uiControl.focusVector &&
-      selectItem.vectorId == this.uiControl.focusVector.vectorId
-    ) {
+    if (selectItem && this.uiControl.focusVector && selectItem.vectorId == this.uiControl.focusVector.vectorId) {
     } else {
       this.uiControl.clearFocusVector();
     }
@@ -486,24 +426,14 @@ export default class Layer {
       y: position.y,
     };
     const eventName = stateService.getEventName();
-    if (
-      !this.dragging &&
-      Math.abs(X - this.startX) < minDragDis &&
-      Math.abs(Y - this.startY) < minDragDis
-    ) {
+    if (!this.dragging && Math.abs(X - this.startX) < minDragDis && Math.abs(Y - this.startY) < minDragDis) {
       return;
     }
     this.dragging = true;
-    if (
-      Math.abs(X - this.startX) > minDragDis ||
-      Math.abs(Y - this.startY) > minDragDis
-    ) {
+    if (Math.abs(X - this.startX) > minDragDis || Math.abs(Y - this.startY) > minDragDis) {
       // 是否拖拽了
       if (eventName != null) {
-        if (
-          eventName == LayerEvents.MoveMagnifier &&
-          stateService.getSelectItem().state != 0
-        ) {
+        if (eventName == LayerEvents.MoveMagnifier && stateService.getSelectItem().state != 0) {
         } else {
           stateService.clearFocusItem();
           this.uiControl.clearFocusVector();
@@ -530,10 +460,8 @@ export default class Layer {
       case LayerEvents.PanBackGround:
         stateService.clearItems();
         let center = {};
-        center.x =
-          coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
-        center.y =
-          coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
+        center.x = coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
+        center.y = coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
         let tempCenter = {};
         mathUtil.clonePoint(tempCenter, coordinate.center);
         mathUtil.clonePoint(coordinate.center, center);
@@ -548,10 +476,7 @@ export default class Layer {
       case LayerEvents.AddRoad:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -566,10 +491,7 @@ export default class Layer {
       case LayerEvents.AddLine:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -583,10 +505,7 @@ export default class Layer {
       case LayerEvents.AddCurveLine:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -600,10 +519,7 @@ export default class Layer {
       case LayerEvents.AddCircle:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -625,10 +541,7 @@ export default class Layer {
         //   addRoad.startInfo.linkedRoadPointId
         // });
 
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -670,10 +583,7 @@ export default class Layer {
           exceptLineIds: exceptLineId,
           exceptPointId: exceptPointId,
         });
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -703,10 +613,7 @@ export default class Layer {
           exceptCurveLineId: exceptCurveLineId,
           exceptCurvePointId: exceptCurvePointId,
         });
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -731,10 +638,7 @@ export default class Layer {
           exceptCircleId = addCircle.newCircle.vectorId;
         }
         listenLayer.start(position, { exceptCircleId: exceptCircleId });
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -756,16 +660,9 @@ export default class Layer {
         let road = dataService.getRoad(draggingItem.vectorId);
         let start = dataService.getRoadPoint(road.startId);
         let end = dataService.getRoadPoint(road.endId);
-        if (
-          Object.keys(start.getParent()).length == 1 &&
-          Object.keys(end.getParent()).length == 1
-        ) {
+        if (Object.keys(start.getParent()).length == 1 && Object.keys(end.getParent()).length == 1) {
           //拖拽的路只有一条
-          moveRoad.moveRoad(
-            draggingItem.vectorId,
-            (dx * coordinate.defaultZoom) / coordinate.zoom,
-            (dy * coordinate.defaultZoom) / coordinate.zoom
-          );
+          moveRoad.moveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
         }
         break;
       case LayerEvents.MoveRoadPoint:
@@ -790,11 +687,7 @@ export default class Layer {
           listenLayer.modifyPoint = null;
         }
 
-        let flag = moveRoad.moveingRoadPoint(
-          draggingItem.vectorId,
-          position,
-          listenLayer.modifyPoint
-        );
+        let flag = moveRoad.moveingRoadPoint(draggingItem.vectorId, position, listenLayer.modifyPoint);
         if (!flag) {
           elementService.hideAll();
         } else {
@@ -805,10 +698,7 @@ export default class Layer {
       case LayerEvents.AddCurveRoad:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -822,10 +712,7 @@ export default class Layer {
       case LayerEvents.AddingCurveRoad:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.hasOwnProperty("x")
-        ) {
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -848,11 +735,7 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveRoad:
         needAutoRedraw = true;
-        moveRoad.moveCurveRoad(
-          draggingItem.vectorId,
-          (dx * coordinate.defaultZoom) / coordinate.zoom,
-          (dy * coordinate.defaultZoom) / coordinate.zoom
-        );
+        moveRoad.moveCurveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
         break;
       case LayerEvents.MoveCurveRoadPoint:
         if (!draggingItem || !draggingItem.vectorId) {
@@ -896,21 +779,13 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveEdge:
         if (listenLayer.modifyPoint) {
-          moveRoad.moveCurveEdge(
-            draggingItem.vectorId,
-            listenLayer.modifyPoint.selectIndex,
-            position
-          );
+          moveRoad.moveCurveEdge(draggingItem.vectorId, listenLayer.modifyPoint.selectIndex, position);
         }
         needAutoRedraw = true;
         break;
       case LayerEvents.MoveLine:
         if (draggingItem != null) {
-          let flag = moveLine.moveLine(
-            draggingItem.vectorId,
-            (dx * coordinate.defaultZoom) / coordinate.zoom,
-            (dy * coordinate.defaultZoom) / coordinate.zoom
-          );
+          let flag = moveLine.moveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
           if (!flag) {
             this.lastX = this.lastX - dx / coordinate.ratio;
             this.lastY = this.lastY - dy / coordinate.ratio;
@@ -926,20 +801,13 @@ export default class Layer {
             exceptLineIds: point.parent,
           });
 
-          if (
-            listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.x &&
-            listenLayer.modifyPoint.y
-          ) {
+          if (listenLayer.modifyPoint && listenLayer.modifyPoint.x && listenLayer.modifyPoint.y) {
             position = {
               x: listenLayer.modifyPoint.x,
               y: listenLayer.modifyPoint.y,
             };
           }
-          let movePointFlag = movePoint.movePoint(
-            position,
-            draggingItem.vectorId
-          );
+          let movePointFlag = movePoint.movePoint(position, draggingItem.vectorId);
           needAutoRedraw = true;
           if (!point) {
             stateService.clearEventName();
@@ -955,10 +823,7 @@ export default class Layer {
             exceptCurvePointId: draggingItem.vectorId,
             exceptCurveLineId: curvePoint.parent,
           });
-          if (
-            listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.hasOwnProperty("x")
-          ) {
+          if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
             position = {
               x: listenLayer.modifyPoint.x,
               y: listenLayer.modifyPoint.y,
@@ -973,33 +838,16 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveLine:
         if (draggingItem != null) {
-          moveLine.moveCurveLine(
-            draggingItem.vectorId,
-            (dx * coordinate.defaultZoom) / coordinate.zoom,
-            (dy * coordinate.defaultZoom) / coordinate.zoom
-          );
+          moveLine.moveCurveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
           needAutoRedraw = true;
         }
         break;
       case LayerEvents.MoveCircle:
         if (draggingItem != null) {
           if (draggingItem.state == -1) {
-            moveCircle.moveFull(
-              draggingItem.vectorId,
-              (dx * coordinate.defaultZoom) / coordinate.zoom,
-              (dy * coordinate.defaultZoom) / coordinate.zoom
-            );
-          } else if (
-            draggingItem.state == 0 ||
-            draggingItem.state == 1 ||
-            draggingItem.state == 2 ||
-            draggingItem.state == 3
-          ) {
-            moveCircle.movePoint(
-              position,
-              draggingItem.vectorId,
-              draggingItem.state
-            );
+            moveCircle.moveFull(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          } else if (draggingItem.state == 0 || draggingItem.state == 1 || draggingItem.state == 2 || draggingItem.state == 3) {
+            moveCircle.movePoint(position, draggingItem.vectorId, draggingItem.state);
           } else {
             debugger;
           }
@@ -1023,22 +871,14 @@ export default class Layer {
           if (draggingItem.state == -1) {
             moveSVG.moveFullSVG(position, draggingItem.vectorId);
           } else {
-            moveSVG.movePoint(
-              position,
-              draggingItem.vectorId,
-              draggingItem.state
-            );
+            moveSVG.movePoint(position, draggingItem.vectorId, draggingItem.state);
           }
         }
         break;
       case LayerEvents.MoveMagnifier:
         needAutoRedraw = true;
         if (draggingItem != null) {
-          moveMagnifier.moveFullMagnifier(
-            position,
-            draggingItem.vectorId,
-            draggingItem.state
-          );
+          moveMagnifier.moveFullMagnifier(position, draggingItem.vectorId, draggingItem.state);
         }
         break;
     }
@@ -1133,6 +973,13 @@ export default class Layer {
           addRoad.buildRoad();
           elementService.hideAll();
         }
+        let roadEdges = dataService.getRoadEdges();
+        for (let roadEdgeId in roadEdges) {
+          let roadEdge = dataService.getRoadEdge(roadEdgeId);
+          if (roadEdge.roadSide) {
+            roadEdge.initRoadSide();
+          }
+        }
         this.uiControl.confirmEntry(); //不能连续创建道路
         break;
       case LayerEvents.AddingLine:
@@ -1140,10 +987,7 @@ export default class Layer {
         addLine.finish(position);
         this.updateForLocation();
         //绘制的是基准线
-        if (
-          addLine.newLine &&
-          Settings.baseLineId == addLine.newLine.vectorId
-        ) {
+        if (addLine.newLine && Settings.baseLineId == addLine.newLine.vectorId) {
           stateService.clearEventName();
           this.history.save();
         }
@@ -1205,24 +1049,11 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveRoadPoint:
         needAutoRedraw = true;
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.linkedCurveRoadPointId
-        ) {
-          let curveRoadPoint1 = dataService.getCurveRoadPoint(
-            listenLayer.modifyPoint.linkedCurveRoadPointId
-          );
-          let curveRoadPoint2 = dataService.getCurveRoadPoint(
-            draggingItem.vectorId
-          );
-          if (
-            listenLayer.modifyPoint.linkedCurveRoadPointId !=
-              draggingItem.vectorId &&
-            curveRoadPoint1.getParent() == curveRoadPoint2.getParent()
-          ) {
-            curveRoadPointService.deleteCurveRoadPoint(
-              listenLayer.modifyPoint.linkedCurveRoadPointId
-            );
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointId) {
+          let curveRoadPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurveRoadPointId);
+          let curveRoadPoint2 = dataService.getCurveRoadPoint(draggingItem.vectorId);
+          if (listenLayer.modifyPoint.linkedCurveRoadPointId != draggingItem.vectorId && curveRoadPoint1.getParent() == curveRoadPoint2.getParent()) {
+            curveRoadPointService.deleteCurveRoadPoint(listenLayer.modifyPoint.linkedCurveRoadPointId);
           }
         }
         this.history.save();
@@ -1254,23 +1085,11 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurvePoint:
         needAutoRedraw = true;
-        if (
-          listenLayer.modifyPoint &&
-          listenLayer.modifyPoint.linkedCurvePointId
-        ) {
-          let curvePoint1 = dataService.getCurvePoint(
-            listenLayer.modifyPoint.linkedCurvePointId
-          );
+        if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointId) {
+          let curvePoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointId);
           let curvePoint2 = dataService.getCurvePoint(draggingItem.vectorId);
-          if (
-            listenLayer.modifyPoint.linkedCurvePointId !=
-              draggingItem.vectorId &&
-            curvePoint1.getParent() == curvePoint2.getParent()
-          ) {
-            lineService.deleteCrossPointForCurveLine(
-              listenLayer.modifyPoint.linkedCurvePointId,
-              curvePoint1.getParent()
-            );
+          if (listenLayer.modifyPoint.linkedCurvePointId != draggingItem.vectorId && curvePoint1.getParent() == curvePoint2.getParent()) {
+            lineService.deleteCrossPointForCurveLine(listenLayer.modifyPoint.linkedCurvePointId, curvePoint1.getParent());
           }
         }
         elementService.hideAll();
@@ -1315,9 +1134,7 @@ export default class Layer {
     const type = e.type;
     if (type == "DOMMouseScroll" || type == "mousewheel") {
       // 当在canvas用滚轮滚动时
-      const delta = e.wheelDelta
-        ? (e.wheelDelta / 120) * 20
-        : (-(e.detail || 0) / 3) * 20;
+      const delta = e.wheelDelta ? (e.wheelDelta / 120) * 20 : (-(e.detail || 0) / 3) * 20;
       const zoom = coordinate.zoom + delta;
       let X = e.offsetX || e.layerX;
       let Y = e.offsetY || e.layerY;
@@ -1421,10 +1238,7 @@ export default class Layer {
 
   stopAddVector() {
     let eventName = stateService.getEventName();
-    if (
-      eventName != LayerEvents.AddingRoad &&
-      eventName != LayerEvents.AddingLine
-    ) {
+    if (eventName != LayerEvents.AddingRoad && eventName != LayerEvents.AddingLine) {
       stateService.clearEventName();
     } else if (eventName == LayerEvents.AddingRoad) {
       stateService.setEventName(LayerEvents.AddRoad);
@@ -1562,57 +1376,23 @@ export default class Layer {
     let otherPoint1 = null;
     let otherPoint2 = null;
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdX) {
-      otherPoint1 = dataService.getRoadPoint(
-        listenLayer.modifyPoint.linkedRoadPointIdX
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedCurveRoadPointIdX
-    ) {
-      otherPoint1 = dataService.getCurveRoadPoint(
-        listenLayer.modifyPoint.linkedCurvePointIdX
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedPointIdX
-    ) {
-      otherPoint1 = dataService.getPoint(
-        listenLayer.modifyPoint.linkedPointIdX
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedCurvePointIdX
-    ) {
-      otherPoint1 = dataService.getCurvePoint(
-        listenLayer.modifyPoint.linkedCurvePointIdX
-      );
+      otherPoint1 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdX);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointIdX) {
+      otherPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdX);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdX) {
+      otherPoint1 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdX);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdX) {
+      otherPoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdX);
     }
 
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdY) {
-      otherPoint2 = dataService.getRoadPoint(
-        listenLayer.modifyPoint.linkedRoadPointIdY
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedCurvePointIdY
-    ) {
-      otherPoint2 = dataService.getCurveRoadPoint(
-        listenLayer.modifyPoint.linkedCurvePointIdY
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedPointIdY
-    ) {
-      otherPoint2 = dataService.getPoint(
-        listenLayer.modifyPoint.linkedPointIdY
-      );
-    } else if (
-      listenLayer.modifyPoint &&
-      listenLayer.modifyPoint.linkedCurvePointIdY
-    ) {
-      otherPoint2 = dataService.getCurvePoint(
-        listenLayer.modifyPoint.linkedCurvePointIdY
-      );
+      otherPoint2 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdY);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
+      otherPoint2 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdY);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdY) {
+      otherPoint2 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdY);
+    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
+      otherPoint2 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdY);
     }
 
     let otherPoint = {};

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

@@ -47,7 +47,8 @@
           </div>
           <div class="info-btn">
             <div class="right-btn" @click="router.push('/roads?back=1')">现场绘图({{ sceneSortPhotos.length }})</div>
-            <div class="right-btn" @click="router.push('/accidents?back=1')">事故照片({{ accodentSortPhotos.length }})</div>
+            <!-- <div class="right-btn" @click="router.push('/accidents?back=1')">事故照片({{ accodentSortPhotos.length }})</div> -->
+            <div class="right-btn" @click="router.push('/accidents?back=1')">事故照片({{ sortPhotos.length }})</div>
           </div>
         </div>
       </div>
@@ -90,7 +91,11 @@ const accodentSortPhotos = computed(() => {
   const photos = [...accidentPhotos.value];
   return photos.sort((a, b) => types.indexOf(a.type) - types.indexOf(b.type));
 });
-
+const sortPhotos = computed(() =>
+  roadPhotos.value
+    // .filter((item) => (currentType.value === TypeEnum.Draw ? !item.table : !!item.table))
+    .reverse()
+);
 const enum TypeEnum {
   Draw,
   Table,
@@ -115,7 +120,6 @@ const sceneInfo = ref({
   accidentDesc: "",
 });
 const inputHandler = debounce(() => {
-  console.error(1);
   tables.value["sceneInfo"] = sceneInfo.value;
 }, 300);
 const viewStatus = ref(false);

+ 28 - 5
src/views/tables/explorate-four.vue

@@ -1,6 +1,6 @@
 <!--  -->
 <template>
-  <div class="explorate" v-if="data">
+  <div class="explorate" v-if="data" :class="{downMode:downMode}">
     <div>
       <h2 class="title">道路交通事故现场勘查笔录(续页)</h2>
 
@@ -21,7 +21,10 @@
 
             <tr v-for="(i, index) in data.driversInfoList">
               <td v-for="(j, j_index) in i">
-                <div><input type="text" /></div>
+                <div>
+                  <div class="content-box">{{ data.driversInfoList[index][j_index] }}</div>
+                  <input type="text" v-model="data.driversInfoList[index][j_index]" />
+                </div>
               </td>
               <!-- <td><div contenteditable></div></td>
               <td><div contenteditable></div></td>
@@ -87,7 +90,10 @@
             </tr>
             <tr v-for="(i, index) in data.carsInfoList">
               <td v-for="(j, j_index) in i">
-                <div><input type="text" /></div>
+                <div>
+                  <div class="content-box" v-html="data.carsInfoList[index][j_index]"></div>
+                  <input type="text" v-model="data.carsInfoList[index][j_index]" />
+                </div>
               </td>
               <!-- <td><div contenteditable></div></td>
               <td><div contenteditable></div></td>
@@ -200,13 +206,30 @@ onMounted(() => {
 });
 </script>
 <style lang="scss" scoped>
+.content-box {
+  width: 100%;
+  height: 100%;
+  display: none;
+  align-items: center;
+  justify-content: center;
+  &.left {
+    justify-content: flex-start;
+  }
+}
 .explorate {
   color: #000;
   width: 100%;
   height: 100%;
 
   font-family: sr, st;
-
+  &.downMode {
+    input {
+      display: none;
+    }
+    .content-box {
+      display: flex;
+    }
+  }
   .title {
     text-align: center;
     margin-bottom: 10px;
@@ -237,7 +260,7 @@ onMounted(() => {
           padding: 0 5px;
           box-sizing: border-box;
           text-align: center;
-          max-width: 11%;
+          // max-width: 11%;
           height: 40px;
           border-right: 1px solid #000;
           border-bottom: 1px solid #000;

+ 8 - 8
src/views/tables/explorate-one.vue

@@ -51,7 +51,7 @@
                         <div class="item-info-name">技术等级</div>
                         <div class="item-info-box">
                           <div class="item" v-for="(i, index) in technicalLevel.options" @click="checkLevel(technicalLevel, index)">
-                            <ui-icon :type="technicalLevel.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
+                            <ui-icon :type="data.technicalLevel == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
                             <span>{{ i.title }}</span>
                           </div>
                         </div>
@@ -60,7 +60,7 @@
                         <div class="item-info-name">行政等级</div>
                         <div class="item-info-box">
                           <div class="item" v-for="(i, index) in administrativeLevel.options" @click="checkLevel(administrativeLevel, index)">
-                            <ui-icon :type="administrativeLevel.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
+                            <ui-icon :type="data.administrativeLevel.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
                             <span>{{ i.title }}</span>
                             <div class="input-box" style="flex: 1" v-if="i.id == 5">
                               <input type="text" v-model="data.administrativeLevel.value" />
@@ -76,7 +76,7 @@
                       <div class="item-info">
                         <div class="item-info-box" style="flex-flow: row wrap">
                           <div class="item" v-for="(i, index) in cityRoadList.options" @click="checkLevel(cityRoadList, index)">
-                            <ui-icon :type="cityRoadList.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
+                            <ui-icon :type="data.cityRoad == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
                             <span>{{ i.title }}</span>
                           </div>
                         </div>
@@ -92,7 +92,7 @@
                     <div class="type-item-name">路口</div>
                     <div class="item-msg intersection" style="min-height: 48px; flex-flow: row wrap">
                       <div class="item" v-for="(i, index) in roadSideList.options" @click="checkLevel(roadSideList, index)">
-                        <ui-icon :type="roadSideList.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
+                        <ui-icon :type="data.roadSide == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
                         <span>{{ i.title }}</span>
                       </div>
                     </div>
@@ -101,7 +101,7 @@
                     <div class="type-item-name">路段</div>
                     <div class="item-msg intersection" style="min-height: 60px; flex-flow: row wrap">
                       <div class="item" v-for="(i, index) in roadPartList.options" @click="checkLevel(roadPartList, index)">
-                        <ui-icon :type="roadPartList.check == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
+                        <ui-icon :type="data.roadPart == i.id ? 'rb_y' : 'rb_n'"></ui-icon>
                         <span>{{ i.title }}</span>
                       </div>
                     </div>
@@ -173,11 +173,11 @@
                     <div class="check-item" :style="j_index == i.options.length - 1 ? 'flex:1;' : ''" v-for="(j, j_index) in i.options" @click="checkEnvironItem(j, index, j_index)">
                       <ui-icon :type="i.check == j.id ? 'rb_y' : 'rb_n'"></ui-icon>
                       <span>{{ j.name }}</span>
-                      <div class="input-box" v-if="j_index == i.options.length - 1">
+                      <div class="input-box" v-if="j_index == i.options.length - 1 && i.id != 9">
                         <input type="text" v-model="data.environments[index].value" />
                       </div>
                     </div>
-                    <div class="input-box" v-if="!i.options.length">
+                    <div class="input-box" style="flex: none; width: 80%" v-if="!i.options.length">
                       <input type="text" v-model="data.environments[index].value" />
                     </div>
                   </div>
@@ -509,7 +509,7 @@ const environments = ref([
   },
   {
     id: 10,
-    title: "照明情况:",
+    title: "其他需要记录的情况:",
     value: "",
     check: 0,
     options: [],

+ 13 - 4
src/views/tables/explorate-two.vue

@@ -36,18 +36,22 @@
           <div class="item">
             <span>受伤:(</span>
             <div style="min-width: 10px">
-              <input style="width: 30px" type="text" />
-              <div class="content-box"></div>
+              <input style="width: 30px" type="text" v-model="data.hurtNum" />
+              <div class="content-box">{{ data.hurtNum }}</div>
             </div>
             <span>)人。</span>
           </div>
           <div class="item column">
             <span>伤亡人员去向:</span>
-            <div style="height: 60px; width: 100%" contenteditable></div>
+            <div style="height: 60px; width: 100%">
+              <textarea v-model="data.hurtDieGo" name="" id="" cols="30" rows="10"></textarea>
+            </div>
           </div>
           <div class="item column">
             <span>其他需求说明的情况:</span>
-            <div style="height: 60px; width: 100%" contenteditable></div>
+            <div style="height: 60px; width: 100%">
+              <textarea v-model="data.desc" name="" id="" cols="30" rows="10"></textarea>
+            </div>
           </div>
           <p>(二)救援简要情况:</p>
 
@@ -352,6 +356,11 @@ div[contenteditable] {
           > div {
             outline: none;
             height: 100%;
+            textarea {
+              height: 100%;
+              width: 100%;
+              resize: none;
+            }
           }
         }
         > div {

+ 2 - 1
src/views/tables/index.vue

@@ -176,11 +176,12 @@ const getLayoutImage = async () => {
     eleList.value.forEach(async (element, index) => {
       let ele = document.getElementById(`layoutRef${index}`);
       const canvas = await html2canvas(ele);
-      Message.success({ msg: "已保存至相册", time: 2000 });
+
       const blob = await new Promise<Blob>((resolve) => {
         return canvas.toBlob(resolve, "image/jpeg", 0.95);
       });
       await downloadImage(blob, `tables_${index}.jpg`);
+      Message.success({ msg: "已保存至相册", time: 2000 });
       num++;
 
       if (num == eleList.value.length) {