diff --git a/mocks/scene/getById b/mocks/scene/getById index a579637..36ebf3c 100644 --- a/mocks/scene/getById +++ b/mocks/scene/getById @@ -4,7 +4,7 @@ "data": { "id": "mock-scene-1", "label": "模拟场景A", - "json": "{\"x\":0,\"y\":0,\"scale\":1,\"pens\":[{\"height\":0,\"lineName\":\"line\",\"lineWidth\":2,\"name\":\"line\",\"type\":1,\"width\":100,\"x\":100,\"y\":100,\"anchors\":[{\"x\":0,\"y\":0,\"id\":\"c\",\"start\":true,\"lineLength\":100,\"connectTo\":\"21b74c90\"},{\"x\":1,\"y\":0,\"id\":\"5e82ddd8\",\"connectTo\":\"00f32a0\"}],\"id\":\"57e55945\",\"fontSize\":14,\"lineHeight\":1.5,\"length\":100,\"ex\":200,\"ey\":100,\"rotate\":0,\"tags\":[\"route\"],\"route\":{\"type\":\"line\"},\"label\":\"undefined → undefined\"},{\"id\":\"3afaff2\",\"name\":\"area\",\"tags\":[\"area\",\"area-12\"],\"label\":\"A3afaff2\",\"x\":254,\"y\":52,\"width\":183,\"height\":195,\"lineWidth\":1,\"area\":{\"type\":12,\"points\":[\"a6667c8\",\"702ccfa\",\"9fc0ba3\",\"984da11\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"id\":\"8b37b4f\",\"name\":\"area\",\"tags\":[\"area\",\"area-11\"],\"label\":\"A8b37b4f\",\"x\":44,\"y\":49,\"width\":193,\"height\":195,\"lineWidth\":1,\"area\":{\"type\":11,\"points\":[\"21b74c90\",\"00f32a0\",\"7f201a25\",\"8de717e\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"id\":\"5d96dd3d\",\"name\":\"area\",\"tags\":[\"area\",\"area-1\"],\"label\":\"A5d96dd3d\",\"x\":451,\"y\":126,\"width\":196,\"height\":125,\"lineWidth\":1,\"area\":{\"type\":1,\"points\":[\"5170c043\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"x\":88,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"21b74c90\",\"name\":\"point\",\"tags\":[\"point\",\"point-1\"],\"label\":\"P21b74c90\",\"point\":{\"type\":1},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"21b74c90\",\"id\":\"c\"}],\"rotate\":0,\"connectedLines\":[{\"lineId\":\"57e55945\",\"lineAnchor\":\"4d6a84f\"}]},{\"x\":188,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"00f32a0\",\"name\":\"point\",\"tags\":[\"point\",\"point-2\"],\"label\":\"P00f32a0\",\"point\":{\"type\":2},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"00f32a0\",\"id\":\"c\"}],\"rotate\":0,\"connectedLines\":[{\"lineId\":\"57e55945\",\"lineAnchor\":\"5e82ddd8\"}]},{\"x\":288,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"a6667c8\",\"name\":\"point\",\"tags\":[\"point\",\"point-3\"],\"label\":\"Pa6667c8\",\"point\":{\"type\":3},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"a6667c8\",\"id\":\"c\"}],\"rotate\":0},{\"x\":388,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"702ccfa\",\"name\":\"point\",\"tags\":[\"point\",\"point-4\"],\"label\":\"P702ccfa\",\"point\":{\"type\":4},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"702ccfa\",\"id\":\"c\"}],\"rotate\":0},{\"x\":76,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/11-dark.png\",\"canvasLayer\":3,\"id\":\"7f201a25\",\"name\":\"point\",\"tags\":[\"point\",\"point-11\"],\"label\":\"P7f201a25\",\"point\":{\"type\":11},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"7f201a25\",\"id\":\"c\"}],\"rotate\":0},{\"x\":176,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/12-dark.png\",\"canvasLayer\":3,\"id\":\"8de717e\",\"name\":\"point\",\"tags\":[\"point\",\"point-12\"],\"label\":\"P8de717e\",\"point\":{\"type\":12},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"8de717e\",\"id\":\"c\"}],\"rotate\":0},{\"x\":276,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/13-dark.png\",\"canvasLayer\":3,\"id\":\"9fc0ba3\",\"name\":\"point\",\"tags\":[\"point\",\"point-13\"],\"label\":\"P9fc0ba3\",\"point\":{\"type\":13},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"9fc0ba3\",\"id\":\"c\"}],\"rotate\":0},{\"x\":376,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/14-dark.png\",\"canvasLayer\":3,\"id\":\"984da11\",\"name\":\"point\",\"tags\":[\"point\",\"point-14\"],\"label\":\"P984da11\",\"point\":{\"type\":14},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"984da11\",\"id\":\"c\"}],\"rotate\":0},{\"x\":476,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/15-dark.png\",\"canvasLayer\":3,\"id\":\"5170c043\",\"name\":\"point\",\"tags\":[\"point\",\"point-15\"],\"label\":\"P5170c043\",\"point\":{\"type\":15},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"5170c043\",\"id\":\"c\"}],\"rotate\":0},{\"x\":576,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/16-dark.png\",\"canvasLayer\":3,\"id\":\"d292734\",\"name\":\"point\",\"tags\":[\"point\",\"point-16\"],\"label\":\"Pd292734\",\"point\":{\"type\":16},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"d292734\",\"id\":\"c\"}],\"rotate\":0}],\"origin\":{\"x\":0,\"y\":0},\"center\":{\"x\":0,\"y\":0},\"paths\":{},\"template\":\"4c2a10f\",\"theme\":\"dark\",\"background\":\"#1e2430\",\"color\":\"#bdc7db\",\"locked\":4,\"version\":\"1.0.78\",\"dataPoints\":[],\"robotGroups\":[{\"id\":\"mock-robot-group-1\",\"label\":\"模拟机器人组A\",\"robots\":[\"mock-robot-1\",\"mock-robot-2\",\"mock-robot-3\"]},{\"sid\":\"mock-scene-1\",\"id\":\"mock-robot-group-2\",\"label\":\"模拟机器人组B\",\"robots\":[\"mock-robot-4\"]}],\"robots\":[{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-1\",\"label\":\"模拟机器人A\",\"brand\":\"模拟品牌A\",\"type\":1,\"ip\":\"127.0.1.1\"},{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-2\",\"label\":\"模拟机器人B\",\"brand\":\"模拟品牌A\",\"type\":2,\"ip\":\"127.0.1.2\"},{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-3\",\"label\":\"模拟机器人C\",\"brand\":\"模拟品牌A\",\"type\":3,\"ip\":\"127.0.1.3\"},{\"gid\":\"mock-robot-group-2\",\"id\":\"mock-robot-4\",\"label\":\"模拟机器人D\",\"brand\":\"模拟品牌B\",\"type\":1,\"ip\":\"127.0.2.1\"}]}" + "json": "{\"x\":0,\"y\":0,\"scale\":1,\"pens\":[{\"id\":\"81d7368\",\"name\":\"area\",\"tags\":[\"area\",\"area-11\"],\"label\":\"A81d7368\",\"x\":52,\"y\":47,\"width\":192,\"height\":205,\"lineWidth\":1,\"area\":{\"type\":11,\"points\":[\"21b74c90\",\"00f32a0\",\"7f201a25\",\"8de717e\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"id\":\"3afaff2\",\"name\":\"area\",\"tags\":[\"area\",\"area-12\"],\"label\":\"A3afaff2\",\"x\":254,\"y\":52,\"width\":183,\"height\":195,\"lineWidth\":1,\"area\":{\"type\":12,\"points\":[\"a6667c8\",\"702ccfa\",\"9fc0ba3\",\"984da11\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"id\":\"5d96dd3d\",\"name\":\"area\",\"tags\":[\"area\",\"area-1\"],\"label\":\"A5d96dd3d\",\"x\":451,\"y\":126,\"width\":196,\"height\":125,\"lineWidth\":1,\"area\":{\"type\":1,\"points\":[\"5170c043\"],\"routes\":[]},\"locked\":4,\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[],\"rotate\":0},{\"x\":88,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"21b74c90\",\"name\":\"point\",\"tags\":[\"point\",\"point-1\"],\"label\":\"P21b74c90\",\"point\":{\"type\":1},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"21b74c90\",\"id\":\"c\"}],\"rotate\":0,\"connectedLines\":[{\"lineId\":\"57e55945\",\"lineAnchor\":\"4d6a84f\"}]},{\"x\":188,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"00f32a0\",\"name\":\"point\",\"tags\":[\"point\",\"point-2\"],\"label\":\"P00f32a0\",\"point\":{\"type\":2},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"00f32a0\",\"id\":\"c\"}],\"rotate\":0,\"connectedLines\":[{\"lineId\":\"57e55945\",\"lineAnchor\":\"5e82ddd8\"}]},{\"x\":288,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"a6667c8\",\"name\":\"point\",\"tags\":[\"point\",\"point-3\"],\"label\":\"Pa6667c8\",\"point\":{\"type\":3},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"a6667c8\",\"id\":\"c\"}],\"rotate\":0},{\"x\":388,\"y\":88,\"width\":24,\"height\":24,\"lineWidth\":2,\"iconSize\":4,\"image\":\"\",\"canvasLayer\":3,\"id\":\"702ccfa\",\"name\":\"point\",\"tags\":[\"point\",\"point-4\"],\"label\":\"P702ccfa\",\"point\":{\"type\":4},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"702ccfa\",\"id\":\"c\"}],\"rotate\":0},{\"x\":76,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/11-dark.png\",\"canvasLayer\":3,\"id\":\"7f201a25\",\"name\":\"point\",\"tags\":[\"point\",\"point-11\"],\"label\":\"P7f201a25\",\"point\":{\"type\":11},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"7f201a25\",\"id\":\"c\"}],\"rotate\":0},{\"x\":176,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/12-dark.png\",\"canvasLayer\":3,\"id\":\"8de717e\",\"name\":\"point\",\"tags\":[\"point\",\"point-12\"],\"label\":\"P8de717e\",\"point\":{\"type\":12},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"8de717e\",\"id\":\"c\"}],\"rotate\":0},{\"x\":276,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/13-dark.png\",\"canvasLayer\":3,\"id\":\"9fc0ba3\",\"name\":\"point\",\"tags\":[\"point\",\"point-13\"],\"label\":\"P9fc0ba3\",\"point\":{\"type\":13},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"9fc0ba3\",\"id\":\"c\"}],\"rotate\":0},{\"x\":376,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/14-dark.png\",\"canvasLayer\":3,\"id\":\"984da11\",\"name\":\"point\",\"tags\":[\"point\",\"point-14\"],\"label\":\"P984da11\",\"point\":{\"type\":14},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"984da11\",\"id\":\"c\"}],\"rotate\":0},{\"x\":476,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/15-dark.png\",\"canvasLayer\":3,\"id\":\"5170c043\",\"name\":\"point\",\"tags\":[\"point\",\"point-15\"],\"label\":\"P5170c043\",\"point\":{\"type\":15},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"5170c043\",\"id\":\"c\"}],\"rotate\":0},{\"x\":576,\"y\":170,\"width\":48,\"height\":60,\"lineWidth\":3,\"iconSize\":10,\"image\":\"/point/16-dark.png\",\"canvasLayer\":3,\"id\":\"d292734\",\"name\":\"point\",\"tags\":[\"point\",\"point-16\"],\"label\":\"Pd292734\",\"point\":{\"type\":16},\"fontSize\":14,\"lineHeight\":1.5,\"anchors\":[{\"x\":0.5,\"y\":0.5,\"penId\":\"d292734\",\"id\":\"c\"}],\"rotate\":0}],\"origin\":{\"x\":0,\"y\":0},\"center\":{\"x\":0,\"y\":0},\"paths\":{},\"template\":\"4c2a10f\",\"theme\":\"dark\",\"background\":\"#1e2430\",\"color\":\"#bdc7db\",\"locked\":4,\"version\":\"1.0.79\",\"dataPoints\":[],\"robotGroups\":[{\"id\":\"mock-robot-group-1\",\"label\":\"模拟机器人组A\",\"robots\":[\"mock-robot-1\",\"mock-robot-2\",\"mock-robot-3\"]},{\"sid\":\"mock-scene-1\",\"id\":\"mock-robot-group-2\",\"label\":\"模拟机器人组B\",\"robots\":[\"mock-robot-4\"]}],\"robots\":[{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-1\",\"label\":\"模拟机器人A\",\"brand\":\"模拟品牌A\",\"type\":1,\"ip\":\"127.0.1.1\"},{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-2\",\"label\":\"模拟机器人B\",\"brand\":\"模拟品牌A\",\"type\":2,\"ip\":\"127.0.1.2\"},{\"gid\":\"mock-robot-group-1\",\"id\":\"mock-robot-3\",\"label\":\"模拟机器人C\",\"brand\":\"模拟品牌A\",\"type\":3,\"ip\":\"127.0.1.3\"},{\"gid\":\"mock-robot-group-2\",\"id\":\"mock-robot-4\",\"label\":\"模拟机器人D\",\"brand\":\"模拟品牌B\",\"type\":1,\"ip\":\"127.0.2.1\"}]}" }, "message": "模拟提示" } diff --git a/src/_ant.scss b/src/_ant.scss index d02ef42..b7031a9 100644 --- a/src/_ant.scss +++ b/src/_ant.scss @@ -417,6 +417,7 @@ } .ant-list.block .ant-list-item { + gap: 8px; padding: 12px; background-color: get-color(fill4); border: none; diff --git a/src/apis/map/constant.ts b/src/apis/map/constant.ts index 722057a..f1f800a 100644 --- a/src/apis/map/constant.ts +++ b/src/apis/map/constant.ts @@ -36,6 +36,9 @@ export enum MapRoutePassType { 仅载货可通行, 禁行 = 10, } +export const MAP_ROUTE_PASS_TYPES = Object.freeze( + <[string, MapRoutePassType][]>Object.entries(MapRoutePassType).filter(([, v]) => typeof v === 'number'), +); //#endregion //#region 区域 diff --git a/src/components/card/area-detail-card.vue b/src/components/card/area-detail-card.vue index a78b728..cb35bb1 100644 --- a/src/components/card/area-detail-card.vue +++ b/src/components/card/area-detail-card.vue @@ -13,9 +13,9 @@ const editor = inject(props.token)!; const pen = computed(() => editor.value.getPenById(props.current)); const area = computed(() => { - const area = pen.value?.area; - if (!area?.type) return null; - return area; + const v = pen.value?.area; + if (!v?.type) return null; + return v; }); const icon = computed(() => `area${area.value?.type}-detail`); diff --git a/src/components/card/point-detail-card.vue b/src/components/card/point-detail-card.vue index a02f29a..fe7efeb 100644 --- a/src/components/card/point-detail-card.vue +++ b/src/components/card/point-detail-card.vue @@ -13,9 +13,9 @@ const editor = inject(props.token)!; const pen = computed(() => editor.value.getPenById(props.current)); const point = computed(() => { - const point = pen.value?.point; - if (!point?.type) return null; - return point; + const v = pen.value?.point; + if (!v?.type) return null; + return v; }); const bindRobot = computed( diff --git a/src/components/card/route-detail-card.vue b/src/components/card/route-detail-card.vue new file mode 100644 index 0000000..d406090 --- /dev/null +++ b/src/components/card/route-detail-card.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/components/card/route-edit-card.vue b/src/components/card/route-edit-card.vue new file mode 100644 index 0000000..6777fa0 --- /dev/null +++ b/src/components/card/route-edit-card.vue @@ -0,0 +1,163 @@ + + + diff --git a/src/pages/scene-editor.vue b/src/pages/scene-editor.vue index b764b2b..f99567d 100644 --- a/src/pages/scene-editor.vue +++ b/src/pages/scene-editor.vue @@ -47,6 +47,7 @@ const importScene = async () => { const exportScene = () => { const json = editor.value?.save(); if (!json) return; + getSceneById(json); const blob = textToBlob(json); if (!blob?.size) return; const url = URL.createObjectURL(blob); @@ -142,7 +143,8 @@ const selectRobot = (id: string) => {