From 9715101faf2fa230a4f1a1345339f2c19c52a1e0 Mon Sep 17 00:00:00 2001 From: lixiaolong <702156524@qq.com> Date: Tue, 4 Aug 2026 10:54:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(flow):=20=E6=B7=BB=E5=8A=A0=E6=9C=BA?= =?UTF-8?q?=E6=A2=B0=E8=87=82=E5=85=B3=E8=8A=82=E8=BF=90=E5=8A=A8=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在BasicNodeParams.vue中为ARM_MOVE_TO_J操作添加按钮显示逻辑 - 从设备API导入getArmJointState方法用于获取机械臂关节状态 - 实现ARM_MOVE_TO_J操作的表单验证和位置获取逻辑 - 在config.js中添加booleanOptions选项配置 - 添加机械臂关节运动节点配置,包括参数定义和属性设置 --- src/api/device/flow.js | 10 ++++++- .../components/params/BasicNodeParams.vue | 30 +++++++++++++++++-- src/views/flow/config.js | 23 ++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/api/device/flow.js b/src/api/device/flow.js index 5985597..4886120 100644 --- a/src/api/device/flow.js +++ b/src/api/device/flow.js @@ -76,4 +76,12 @@ export function getAgvStatus(params) { method: 'get', params: params }) -} \ No newline at end of file +} + +export function getArmJointState(params) { + return request({ + url: '/api/arm/getJointState', + method: 'get', + params: params + }) +} diff --git a/src/views/flow/components/params/BasicNodeParams.vue b/src/views/flow/components/params/BasicNodeParams.vue index cbdc827..f4174bb 100644 --- a/src/views/flow/components/params/BasicNodeParams.vue +++ b/src/views/flow/components/params/BasicNodeParams.vue @@ -11,7 +11,7 @@
- 获取位置 + 获取位置
@@ -106,7 +106,7 @@ import { Plus, Minus } from '@element-plus/icons-vue' import FormItemRecursive from '../FormItemRecursive.vue' import { getInput } from '@/utils/flow' import { useQuote } from './useQuote.js' -import { getArmStatus, getAgvStatus } from '@/api/device/flow' +import { getArmStatus, getArmJointState, getAgvStatus } from '@/api/device/flow' import { de } from 'element-plus/es/locale/index.mjs' const props = defineProps({ @@ -298,6 +298,30 @@ const submitRobotForm = () => { } } }) + } else if (robotFormAction.value === 'ARM_MOVE_TO_J') { + robotFormRef.value.validate(async (valid) => { + if (valid) { + try { + const response = await getArmJointState({ + deviceId: robotForm.deviceId, + terminalId: robotForm.terminalId + }) + if (response && response.data) { + const target = response.data.position || response.data.positions + if (!Array.isArray(target) || target.length === 0) { + throw new Error('机械臂未返回有效的关节位置') + } + dialogVisible.value = false + const targetParam = formData.nodeParams.find(param => param.name === 'target') + const deviceParam = formData.nodeParams.find(param => param.name === 'deviceId') + if (targetParam) targetParam.input = JSON.stringify(target) + if (deviceParam) deviceParam.input = robotForm.deviceId + } + } catch (error) { + console.error('获取机械臂关节位置失败:', error) + } + } + }) } } @@ -383,4 +407,4 @@ defineExpose({ validateAndSave }) cursor: pointer; } } - \ No newline at end of file + diff --git a/src/views/flow/config.js b/src/views/flow/config.js index a82eafe..3684e9a 100644 --- a/src/views/flow/config.js +++ b/src/views/flow/config.js @@ -37,6 +37,11 @@ const audioOptions = () => { }] } +const booleanOptions = () => [ + { value: false, label: '否' }, + { value: true, label: '是' } +] + const httpMethodOptions = () => { return [{ value: 'POST', @@ -360,6 +365,24 @@ function handler(params) { ], outputType: 'json' }, + { + icon: videoSvg, + name: "机械臂关节运动", + type: "serviceNode", + desc: "通过关节空间插值运动到目标关节位置", + action: 'ARM_MOVE_TO_J', + nodeType: 'EDGE', + nodeParams: [ + { name: "deviceId", type: "input", input: "", disabled: true }, + { name: "target", type: "input", input: "[0, 0, 0, 0, 0, 0]", disabled: true }, + { name: "velocity", type: "input", componentType: 'number', max: 5, step: 0.1, input: 0.5, disabled: true }, + { name: "acceleration", type: "input", componentType: 'number', max: 5, step: 0.1, input: 1, disabled: true }, + { name: "blendRadius", type: "input", componentType: 'number', max: 5, step: 0.01, input: 0, required: false, disabled: true }, + { name: "jointVelocityLimits", type: "input", input: "", required: false, disabled: true }, + { name: "asynchronous", type: "input", input: false, componentType: 'select', selectOptions: booleanOptions(), required: false, disabled: true } + ], + outputType: 'json' + }, { icon: cameraSvg, name: "开始监听报警事件",