feat: change robot register

This commit is contained in:
chndfang 2025-06-04 18:43:50 +08:00
parent f34d722780
commit 37d5dfa7de
13 changed files with 71 additions and 27 deletions

View File

@ -83,7 +83,7 @@ GroupSceneDetail
{ {
"id": "mock-robot-1", "id": "mock-robot-1",
"label": "模拟机器人A", "label": "模拟机器人A",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.1.1", "ip": "127.0.1.1",
"isConnected": true, "isConnected": true,
@ -95,7 +95,7 @@ GroupSceneDetail
{ {
"id": "mock-robot-2", "id": "mock-robot-2",
"label": "模拟机器人B", "label": "模拟机器人B",
"brand": "模拟品牌A", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.1.2" "ip": "127.0.1.2"
} }
@ -128,7 +128,7 @@ RobotRealtimeInfo [JSON]
{ {
"id": "mock-robot-1", "id": "mock-robot-1",
"label": "模拟机器人A", "label": "模拟机器人A",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.1.1", "ip": "127.0.1.1",
"isConnected": true, "isConnected": true,
@ -169,42 +169,42 @@ Array<RobotInfo>
{ {
"id": "mock-robot-1", "id": "mock-robot-1",
"label": "模拟机器人A", "label": "模拟机器人A",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.1.1" "ip": "127.0.1.1"
}, },
{ {
"id": "mock-robot-2", "id": "mock-robot-2",
"label": "模拟机器人B", "label": "模拟机器人B",
"brand": "模拟品牌A", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.1.2" "ip": "127.0.1.2"
}, },
{ {
"id": "mock-robot-3", "id": "mock-robot-3",
"label": "模拟机器人C", "label": "模拟机器人C",
"brand": "模拟品牌A", "brand": 1,
"type": 3, "type": 3,
"ip": "127.0.1.3" "ip": "127.0.1.3"
}, },
{ {
"id": "mock-robot-4", "id": "mock-robot-4",
"label": "模拟机器人D", "label": "模拟机器人D",
"brand": "模拟品牌B", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.2.1" "ip": "127.0.2.1"
}, },
{ {
"id": "mock-robot-5", "id": "mock-robot-5",
"label": "模拟机器人E", "label": "模拟机器人E",
"brand": "模拟品牌B", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.2.2" "ip": "127.0.2.2"
}, },
{ {
"id": "mock-robot-6", "id": "mock-robot-6",
"label": "模拟机器人F", "label": "模拟机器人F",
"brand": "模拟品牌B", "brand": 1,
"type": 3, "type": 3,
"ip": "127.0.2.3" "ip": "127.0.2.3"
} }
@ -250,7 +250,7 @@ RobotInfo
"data": { "data": {
"id": "mock-robot-0", "id": "mock-robot-0",
"label": "模拟机器人-注册", "label": "模拟机器人-注册",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.0.0" "ip": "127.0.0.0"
}, },
@ -372,7 +372,7 @@ interface RobotInfo {
label: string; // 机器人名称 label: string; // 机器人名称
brand: RobotBrand; // 机器人品牌 brand: RobotBrand; // 机器人品牌
type: RobotType; // 机器人类型 type: RobotType; // 机器人类型
ip: string; // 机器人ip ip?: string; // 机器人ip(仅真实机器人)
battery?: number; // 机器人电量 battery?: number; // 机器人电量
isConnected?: boolean; // 机器人连接状态 isConnected?: boolean; // 机器人连接状态
state?: RobotState; // 机器人状态 state?: RobotState; // 机器人状态
@ -387,6 +387,8 @@ export interface RobotDetail extends RobotInfo {
chargeBattery?: number; // 充电电量 chargeBattery?: number; // 充电电量
taskBattery?: number; // 任务电量 taskBattery?: number; // 任务电量
swapBattery?: number; // 交换电量 swapBattery?: number; // 交换电量
length?: number; // 空载长(仅仿真机器人)
width?: number; // 空载宽(仅仿真机器人)
} }
export interface RobotRealtimeInfo extends RobotInfo { export interface RobotRealtimeInfo extends RobotInfo {
x: number; // 坐标x x: number; // 坐标x
@ -397,7 +399,7 @@ export interface RobotRealtimeInfo extends RobotInfo {
} }
enum RobotBrand { enum RobotBrand {
'先工' = 1, 仙工 = 1,
} }
enum RobotType { enum RobotType {
叉车机器人 = 1, 叉车机器人 = 1,

View File

@ -5,42 +5,42 @@
{ {
"id": "mock-robot-1", "id": "mock-robot-1",
"label": "模拟机器人A", "label": "模拟机器人A",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.1.1" "ip": "127.0.1.1"
}, },
{ {
"id": "mock-robot-2", "id": "mock-robot-2",
"label": "模拟机器人B", "label": "模拟机器人B",
"brand": "模拟品牌A", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.1.2" "ip": "127.0.1.2"
}, },
{ {
"id": "mock-robot-3", "id": "mock-robot-3",
"label": "模拟机器人C", "label": "模拟机器人C",
"brand": "模拟品牌A", "brand": 1,
"type": 3, "type": 3,
"ip": "127.0.1.3" "ip": "127.0.1.3"
}, },
{ {
"id": "mock-robot-4", "id": "mock-robot-4",
"label": "模拟机器人D", "label": "模拟机器人D",
"brand": "模拟品牌B", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.2.1" "ip": "127.0.2.1"
}, },
{ {
"id": "mock-robot-5", "id": "mock-robot-5",
"label": "模拟机器人E", "label": "模拟机器人E",
"brand": "模拟品牌B", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.2.2" "ip": "127.0.2.2"
}, },
{ {
"id": "mock-robot-6", "id": "mock-robot-6",
"label": "模拟机器人F", "label": "模拟机器人F",
"brand": "模拟品牌B", "brand": 1,
"type": 3, "type": 3,
"ip": "127.0.2.3" "ip": "127.0.2.3"
} }

View File

@ -4,7 +4,7 @@
"data": { "data": {
"id": "mock-robot-0", "id": "mock-robot-0",
"label": "模拟机器人-注册", "label": "模拟机器人-注册",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.0.0" "ip": "127.0.0.0"
}, },

View File

@ -17,7 +17,7 @@
{ {
"id": "mock-robot-1", "id": "mock-robot-1",
"label": "模拟机器人A", "label": "模拟机器人A",
"brand": "模拟品牌A", "brand": 1,
"type": 1, "type": 1,
"ip": "127.0.1.1", "ip": "127.0.1.1",
"isConnected": true, "isConnected": true,
@ -29,7 +29,7 @@
{ {
"id": "mock-robot-2", "id": "mock-robot-2",
"label": "模拟机器人B", "label": "模拟机器人B",
"brand": "模拟品牌A", "brand": 1,
"type": 2, "type": 2,
"ip": "127.0.1.2" "ip": "127.0.1.2"
} }

View File

@ -371,6 +371,23 @@
} }
} }
.ant-input-number-group-wrapper {
width: 100%;
& > .ant-input-number-wrapper {
& > .ant-input-number {
border-radius: 2px 0 0 2px;
}
& > .ant-input-number-group-addon {
color: get-color(text1);
background-color: get-color(fill3);
border-color: get-color(neutral5);
border-radius: 0 2px 2px 0;
}
}
}
.ant-layout { .ant-layout {
background-color: get-color(page_bg); background-color: get-color(page_bg);

View File

@ -1,7 +1,7 @@
import { isNumber } from 'lodash-es'; import { isNumber } from 'lodash-es';
export enum RobotBrand { export enum RobotBrand {
'先工' = 1, = 1,
} }
export const ROBOT_BRAND_OPTIONS = <Array<[string, RobotBrand]>>( export const ROBOT_BRAND_OPTIONS = <Array<[string, RobotBrand]>>(
Object.entries(RobotBrand).filter(([, v]) => isNumber(v)) Object.entries(RobotBrand).filter(([, v]) => isNumber(v))

View File

@ -13,7 +13,7 @@ export interface RobotInfo {
label: string; // 机器人名称 label: string; // 机器人名称
brand: RobotBrand; // 机器人品牌 brand: RobotBrand; // 机器人品牌
type: RobotType; // 机器人类型 type: RobotType; // 机器人类型
ip?: string; // 机器人ip ip?: string; // 机器人ip(仅真实机器人)
battery?: number; // 机器人电量 battery?: number; // 机器人电量
isConnected?: boolean; // 机器人连接状态 isConnected?: boolean; // 机器人连接状态
state?: RobotState; // 机器人状态 state?: RobotState; // 机器人状态
@ -29,8 +29,8 @@ export interface RobotDetail extends RobotInfo {
chargeBattery?: number; // 充电电量 chargeBattery?: number; // 充电电量
taskBattery?: number; // 任务电量 taskBattery?: number; // 任务电量
swapBattery?: number; // 交换电量 swapBattery?: number; // 交换电量
length?: number; // 空载长 length?: number; // 空载长(仅仿真机器人)
width?: number; // 空载宽 width?: number; // 空载宽(仅仿真机器人)
} }
export interface RobotRealtimeInfo extends RobotInfo { export interface RobotRealtimeInfo extends RobotInfo {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 596 B

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { getAllRobots, type RobotInfo, RobotType } from '@api/robot'; import { getAllRobots, RobotBrand, type RobotInfo, RobotType } from '@api/robot';
import type { EditorService } from '@core/editor.service'; import type { EditorService } from '@core/editor.service';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { isError, isNil } from 'lodash-es'; import { isError, isNil } from 'lodash-es';
@ -75,7 +75,11 @@ const submit = () => {
bordered bordered
> >
<a-table-column dataIndex="label" :title="$t('机器人')" /> <a-table-column dataIndex="label" :title="$t('机器人')" />
<a-table-column dataIndex="brand" :title="$t('品牌')" /> <a-table-column dataIndex="brand" :title="$t('品牌')">
<template #default="{ text }">
{{ $t(RobotBrand[text]) }}
</template>
</a-table-column>
<a-table-column dataIndex="type" :title="$t('机器人类型')"> <a-table-column dataIndex="type" :title="$t('机器人类型')">
<template #default="{ text }"> <template #default="{ text }">
{{ $t(RobotType[text]) }} {{ $t(RobotType[text]) }}

View File

@ -74,12 +74,33 @@ const submit = async () => {
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
v-if="!data.isSimulative"
:label="$t('输入属性IP')" :label="$t('输入属性IP')"
name="ip" name="ip"
:rules="[{ required: true }, { pattern: IP_REGEX, message: '' }]" :rules="[{ required: true }, { pattern: IP_REGEX, message: '' }]"
> >
<a-input :placeholder="$t('请输入')" :maxlength="16" v-model:value="data.ip" /> <a-input :placeholder="$t('请输入')" :maxlength="16" v-model:value="data.ip" />
</a-form-item> </a-form-item>
<a-form-item v-if="data.isSimulative" :label="$t('空载长')" name="length" :rules="[{ required: true }]">
<a-input-number
:placeholder="$t('请输入')"
addon-after="m"
:min="0"
:precision="2"
v-model:value="data.length"
:controls="false"
/>
</a-form-item>
<a-form-item v-if="data.isSimulative" :label="$t('空载宽')" name="width" :rules="[{ required: true }]">
<a-input-number
:placeholder="$t('请输入')"
addon-after="m"
:min="0"
:precision="2"
v-model:value="data.width"
:controls="false"
/>
</a-form-item>
<a-form-item :label="$t('最小电量')" name="minBattery"> <a-form-item :label="$t('最小电量')" name="minBattery">
<a-input-number <a-input-number
:placeholder="$t('请输入')" :placeholder="$t('请输入')"