+
该机器人没有匹配的在线设备
@@ -55,7 +55,7 @@
diff --git a/src/views/flow/components/params/BasicNodeParams.vue b/src/views/flow/components/params/BasicNodeParams.vue
index 9706696..a48213b 100644
--- a/src/views/flow/components/params/BasicNodeParams.vue
+++ b/src/views/flow/components/params/BasicNodeParams.vue
@@ -27,18 +27,36 @@
-
+
-
+
-
+
-
+
+
+
+
实测角度(°)
+
+
+ {{ dexHandAxisLabels[axis.id] }} {{ axis.degrees.toFixed(2) }}°
+
+
+
+
+
取消
- 确认
+ {{ isDexHandReadback(robotFormAction) ? '读取并回填' : '确认' }}
@@ -124,16 +143,18 @@ import { computed, ref, reactive, watch } from 'vue'
import { Plus, Minus } from '@element-plus/icons-vue'
import FormItemRecursive from '../FormItemRecursive.vue'
import RobotExecutionTarget from './RobotExecutionTarget.vue'
+import VehicleVersionSelect from './VehicleVersionSelect.vue'
import { useQuote } from './useQuote.js'
-import { getArmStatus, getArmJointState, getAgvStatus, getAgvStations } from '@/api/flow/flow'
+import { flowAction, getArmStatus, getArmJointState, getAgvStatus, getAgvStations } from '@/api/flow/flow'
import { getRobotList, getRobotDevicesByRobotId } from '@/api/resource/robot'
import { ElMessage } from 'element-plus'
-import { deviceMatchesSlot, getDeviceKindForAction, getRequiredDeviceIdForAction, toDeviceOptions } from '@/utils/robotDevice'
+import { dexHandAngleSnapshot, dexHandAxisLabels, dexHandPositionTargets, deviceMatchesSlot, getDeviceKindForAction, getRequiredDeviceIdForAction, toDeviceOptions } from '@/utils/robotDevice'
import { actionRequiresDevice } from '@/utils/flowResources'
const props = defineProps({
data: Object
})
+const isVehicleVersionField = (param) => props.data.properties?.action === 'TI_PATH_SEARCH' && param.name === 'vehicleConfigId'
const emit = defineEmits(['save-success', 'save-error'])
@@ -151,6 +172,10 @@ const activeNames = ref(['1', '2'])
// 使用共享的 quote 逻辑
const { quoteOptions, cascaderRefs, handleTypeChange, cascaderChange, visibleChange } = useQuote(props.data.id)
+const changeParamType = (property) => {
+ delete property.measuredAngles
+ handleTypeChange(property)
+}
// 添加表单项
/**
@@ -310,6 +335,9 @@ const loadRobotDevices = async (robotId) => {
* @param {*} property 参数属性
*/
const testRule = (property) => {
+ if (isVehicleVersionField(property)) {
+ return [{ required: true, message: '请选择车机版本', trigger: 'change' }]
+ }
if (property?.name === 'stationId' && props.data.properties.action === 'AGV_MOVE_TO_STATION') {
return [
{ required: true, message: '请从站点列表中选择站点', trigger: 'change' },
@@ -354,21 +382,27 @@ const testRule = (property) => {
const robotFormAction = ref()
const robotFormLoading = ref(false)
const NECK_MOVE_ACTION = 'ARM_NECK_MOVE_J'
+const DEX_HAND_POSITION_ACTION = 'DEX_HAND_SET_POSITION'
+const DEX_HAND_ANGLE_ACTION = 'DEX_HAND_SET_ANGLE'
+const isDexHandReadback = (action) => [DEX_HAND_POSITION_ACTION, DEX_HAND_ANGLE_ACTION].includes(action)
const XIAOZHAO_NECK_JOINTS = ['neck-joint1', 'neck-joint2', 'neck-joint3']
const POSITION_ACTIONS = ['AGV_MOVE_TO_POINT', 'ARM_MOVE_TO_POINT', 'ARM_MOVE_TO_J', NECK_MOVE_ACTION]
const isRobotNode = computed(() => props.data.properties?.nodeType === 'EDGE')
const hasDeviceDebugAction = computed(() => (
- POSITION_ACTIONS.includes(props.data.properties.action)
+ isDexHandReadback(props.data.properties.action) || POSITION_ACTIONS.includes(props.data.properties.action)
|| props.data.properties.action === 'AGV_MOVE_TO_STATION'
))
const robotActionButtonText = computed(() => {
if (props.data.properties.action === 'AGV_MOVE_TO_STATION') return '选择机器人并加载站点'
- if (props.data.properties.action === NECK_MOVE_ACTION) return '获取当前位置'
+ if (props.data.properties.action === DEX_HAND_ANGLE_ACTION) return '获取当前角度'
+ if ([DEX_HAND_POSITION_ACTION, NECK_MOVE_ACTION].includes(props.data.properties.action)) return '获取当前位置'
if (POSITION_ACTIONS.includes(props.data.properties.action)) return '选择机器人并获取位置'
return '选择机器人设备'
})
const robotDialogTitle = computed(() => {
if (robotFormAction.value === 'AGV_MOVE_TO_STATION') return '选择AGV并加载站点'
+ if (robotFormAction.value === DEX_HAND_ANGLE_ACTION) return '读取灵巧手当前角度'
+ if (robotFormAction.value === DEX_HAND_POSITION_ACTION) return '读取灵巧手当前位置'
if (robotFormAction.value === NECK_MOVE_ACTION) return '读取颈部当前位置'
if (POSITION_ACTIONS.includes(robotFormAction.value)) return '选择机器人并读取当前位置'
return '选择机器人设备'
@@ -378,7 +412,47 @@ const robotDialogTitle = computed(() => {
* 处理 submitRobotForm 对应的数据或交互;作用范围仅限当前组件或模块。
*/
const submitRobotForm = () => {
- if (robotFormAction.value === 'AGV_MOVE_TO_POINT') {
+ const action = robotFormAction.value
+ if (isDexHandReadback(action)) {
+ const captureAngle = action === DEX_HAND_ANGLE_ACTION
+ const captureKind = captureAngle ? '角度' : '位置'
+ robotFormRef.value.validate(async (valid) => {
+ if (!valid) return
+ const { robotId, deviceId } = robotForm
+ const nodeId = props.data.id
+ robotFormLoading.value = true
+ try {
+ const { data } = await flowAction({
+ action: 'DEX_HAND_GET_STATE',
+ payload: { robotId, deviceId },
+ })
+ if (!dialogVisible.value || props.data.id !== nodeId || props.data.properties.action !== action
+ || robotForm.robotId !== robotId || robotForm.deviceId !== deviceId) return
+
+ const state = typeof data === 'string' ? JSON.parse(data) : data
+ const snapshot = captureAngle ? dexHandAngleSnapshot(state) : { values: dexHandPositionTargets(state) }
+ let batchParam = formData.nodeParams.find(param => param.name === 'values')
+ if (!batchParam) {
+ formData.nodeParams.push({ name: 'values', displayName: '多自由度参数', disabled: true, required: false })
+ batchParam = formData.nodeParams.at(-1)
+ }
+ for (const param of formData.nodeParams) {
+ if (!['id', 'value', 'values'].includes(param.name)) continue
+ param.type = 'input'
+ param.quote = []
+ delete param.quoteType
+ param.input = param === batchParam ? JSON.stringify(snapshot.values) : null
+ }
+ if (captureAngle) batchParam.measuredAngles = snapshot.angles
+ dialogVisible.value = false
+ ElMessage.success(`已回填 ${snapshot.values.length} 个自由度的${captureKind}目标,请保存节点`)
+ } catch (error) {
+ ElMessage.error(error?.message || `读取灵巧手当前${captureKind}失败`)
+ } finally {
+ robotFormLoading.value = false
+ }
+ })
+ } else if (robotFormAction.value === 'AGV_MOVE_TO_POINT') {
robotFormRef.value.validate(async (valid) => {
if (valid) {
try {
@@ -565,6 +639,23 @@ defineExpose({ validateAndSave })
width: 160px;
}
+ .dex-hand-values {
+ width: 280px;
+ max-width: 100%;
+ }
+
+ .measured-angles {
+ margin-top: 8px;
+ color: var(--el-text-color-secondary);
+ line-height: 1.6;
+ }
+
+ .measured-angle-list {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 4px 12px;
+ }
+
}
diff --git a/src/views/flow/components/params/MediaAnalysisParams.vue b/src/views/flow/components/params/MediaAnalysisParams.vue
index b4fd83e..5736ef0 100644
--- a/src/views/flow/components/params/MediaAnalysisParams.vue
+++ b/src/views/flow/components/params/MediaAnalysisParams.vue
@@ -86,18 +86,32 @@
开启后分析在后台并行执行,流程结束前统一等待分析结果。
-
-
-
+
+
+
+
+
+
+
+
+
+
未观察到完整证据或置信度不足时,结果按未通过处理。
-
+
@@ -203,7 +217,9 @@ const formData = reactive({
mediaQuote: [],
mediaQuoteType: 'output',
mediaUrl: '',
+ instructionMode: 'input',
instruction: '',
+ instructionQuote: [],
analysisMode: 'AUTO',
detailedOutput: false,
asynchronous: false,
@@ -228,6 +244,10 @@ const mediaModes = [
{ label: '引用节点输出', value: 'quote' },
{ label: '直接输入地址', value: 'input' },
]
+const instructionModes = [
+ { label: '手动输入', value: 'input' },
+ { label: '引用节点参数', value: 'quote' },
+]
const analysisModes = [
{ label: '快速', value: 'FAST' },
{ label: '均衡', value: 'AUTO' },
@@ -313,11 +333,18 @@ const rules = {
trigger: 'blur',
}],
instruction: [{
- validator: (_, value) => !isVideo.value || String(value || '').trim()
+ validator: (_, value) => String(value || '').trim()
? Promise.resolve()
- : Promise.reject(new Error('请输入明确的通过标准')),
+ : Promise.reject(new Error('请输入评判标准')),
trigger: 'blur',
}],
+ instructionQuote: [{
+ validator: (_, value) => Array.isArray(value) && value.length >= 3
+ && ['input', 'output'].includes(value[1])
+ ? Promise.resolve()
+ : Promise.reject(new Error('请选择评判标准引用的字段')),
+ trigger: 'change',
+ }],
}
// 使用 Object.assign 保留 analysisTuning 的响应式引用,只覆盖当前模式定义的预设字段。
@@ -415,7 +442,9 @@ const initData = () => {
formData.mediaQuote = Array.isArray(media?.quote) ? [...media.quote] : []
formData.mediaQuoteType = media?.quoteType || 'output'
formData.mediaUrl = media?.input || ''
- formData.instruction = instruction?.input || ''
+ formData.instructionMode = instruction?.type === 'quote' ? 'quote' : 'input'
+ formData.instruction = typeof instruction?.input === 'string' ? instruction.input : ''
+ formData.instructionQuote = Array.isArray(instruction?.quote) ? [...instruction.quote] : []
formData.analysisMode = analysisPresets[analysisMode?.input] ? analysisMode.input : 'AUTO'
// 兼容旧流程或外部写入的字符串值,表单内部统一使用布尔值驱动开关。
formData.detailedOutput = detailedOutput?.input === true || detailedOutput?.input === 'true'
@@ -496,8 +525,11 @@ const validateAndSave = async () => {
if (isVideo.value) {
nodeParams.push({
name: 'instruction',
- type: 'input',
- input: formData.instruction.trim(),
+ displayName: '评判标准',
+ type: formData.instructionMode,
+ ...(formData.instructionMode === 'quote'
+ ? { quote: [...formData.instructionQuote], quoteType: formData.instructionQuote[1] }
+ : { input: formData.instruction.trim() }),
required: true,
disabled: true,
})
diff --git a/src/views/flow/components/params/StartParams.vue b/src/views/flow/components/params/StartParams.vue
index c9a0013..67a2618 100644
--- a/src/views/flow/components/params/StartParams.vue
+++ b/src/views/flow/components/params/StartParams.vue
@@ -37,6 +37,7 @@
输入参数
+ 添加触控项目参数
addFormItem(event, 'inputParams')">
@@ -69,6 +70,7 @@ import { Delete, Minus, Plus } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import FormItemRecursive from '../FormItemRecursive.vue'
import { DEVICE_KIND, NECK_DEVICE_ID } from '@/utils/robotDevice'
+import { touchProjectInputs } from '@/utils/touchFlow'
import {
createDefaultRobotRole,
createDeviceSlot,
@@ -85,6 +87,7 @@ const deviceKinds = [
{ label: '机械臂', value: 2 },
{ label: '仿生头', value: 4 },
{ label: '摄像头', value: 5 },
+ { label: '灵巧手', value: DEVICE_KIND.DEX_HAND },
{ label: '麦克风', value: 9 },
{ label: '机器人本体', value: 12 },
{ label: '扬声器', value: 13 },
@@ -141,6 +144,14 @@ const addFormItem = (event, type) => {
formData[type].push({ name: '', type: 'string', required: false, children: [], input: '' })
}
+const addTouchProjectInputs = () => {
+ for (const field of touchProjectInputs()) {
+ const existing = formData.inputParams.find(param => param.name === field.name)
+ if (existing) Object.assign(existing, field)
+ else formData.inputParams.push(field)
+ }
+}
+
const deleteTopLevelItem = (fullPath, propPath) => {
let currentLevel = formData[propPath]
for (let index = 0; index < fullPath.length - 1; index += 1) {
diff --git a/src/views/flow/components/params/VehicleVersionSelect.vue b/src/views/flow/components/params/VehicleVersionSelect.vue
new file mode 100644
index 0000000..27888a8
--- /dev/null
+++ b/src/views/flow/components/params/VehicleVersionSelect.vue
@@ -0,0 +1,51 @@
+
+ emit('update:modelValue', value ?? '')"
+ />
+
+
+
diff --git a/src/views/flow/config.js b/src/views/flow/config.js
index c32c011..a8fd0d9 100644
--- a/src/views/flow/config.js
+++ b/src/views/flow/config.js
@@ -15,6 +15,8 @@ import audioSvg from './icon/audio.svg'
import touchSvg from './icon/touch.svg'
import expressionSvg from './icon/expression.svg'
import { DEFAULT_CHAT_SYSTEM_PROMPT } from './chatPrompt.js'
+import { dexHandAxisLabels } from '@/utils/robotDevice'
+import { touchCoordinatesInput, touchPathSearchOutputs, touchPathStepOutputs, touchRetryInput, touchRetryOutput } from '@/utils/touchFlow'
const pointOutputChildren = () => [
{ name: 'x', type: 'number', desc: 'X坐标' },
@@ -124,6 +126,80 @@ const neckNodes = [
nodeParams: [], outputParams: [], ...node,
}))
+const dexHandValues = () => [
+ {
+ ...headParam('id', null), displayName: '自由度', componentType: 'select', required: false,
+ selectOptions: dexHandAxisLabels.map((label, value) => ({ value, label })),
+ },
+ {
+ ...headNumber('value'), displayName: '目标比例(0–1)', input: null, min: 0, max: 1, required: false,
+ },
+ {
+ ...headParam('values', '', '可选,填写 JSON 数组,如 [{"id":3,"value":0.5}]'),
+ displayName: '多自由度参数', required: false,
+ },
+]
+
+const dexHandNodes = [
+ {
+ name: '查询灵巧手状态', action: 'DEX_HAND_GET_STATE', desc: '读取设备型号、初始化状态和各自由度反馈',
+ outputParams: [
+ ...[
+ ['initialized', 'boolean', '是否已初始化'], ['model', 'string', '设备型号'],
+ ['hasTactileFeedback', 'boolean', '设备是否上报触觉反馈能力'],
+ ].map(headOutput),
+ {
+ ...headOutput(['hands', 'array
-
+
本次执行安排
- 运行参数
+ 车机版本和功能顺序取自触控项目的配置。
+ 其他运行参数
field.name), 'projectId'])
const clearSelection = () => {
preparedItem.value = null
@@ -130,7 +134,9 @@ const loadSelection = async (itemId) => {
const graph = normalizeFlowResourceSchema(JSON.parse(version.flowData))
const validation = validateFlowResources(graph)
if (validation.errors.length) throw new Error(validation.errors[0].message)
- const config = version.config ? addValueProperty(JSON.parse(version.config)) : []
+ const config = version.config
+ ? addValueProperty(JSON.parse(version.config).filter(field => !projectInputNames.has(field.name)))
+ : []
roles.value = getResourceRoles(validation.graph)
formData.value.tableData = [{ ...item, config }]
preparedItem.value = item
@@ -200,4 +206,5 @@ watch(
diff --git a/src/views/is/project/index.vue b/src/views/is/project/index.vue
index d1fd0ee..769b133 100644
--- a/src/views/is/project/index.vue
+++ b/src/views/is/project/index.vue
@@ -166,32 +166,16 @@
-
-
-
-
-
-
+
+
+
@@ -266,7 +250,6 @@
import TableSearch from "@/components/TableSearch/index.vue";
import { useContainerHeight } from "@/hooks/tableHeight";
import { ElMessage, ElMessageBox } from "element-plus";
-import { getTreeDataApi } from '@/api/is/func/index'
import { getFunction } from "@/api/is/func/index.js";
import {
addProject,
@@ -277,6 +260,8 @@ import {
queryExecuteInstId,
} from "@/api/is/project/index.js";
import Run from "@/views/is/project/evaluate/Run.vue";
+import TouchFunctionSequence from "./TouchFunctionSequence.vue";
+import VehicleVersionSelect from "@/views/flow/components/params/VehicleVersionSelect.vue";
import { appendParamsToPath } from "@/utils/fn.js";
const topContainerRef = ref();
@@ -314,20 +299,6 @@ const data = reactive({
const { queryParams, form, rules } = toRefs(data);
-const treeData = ref([])
-
-const getTreeData = async () => {
- try {
- const res = await getTreeDataApi();
- if (res) {
- treeData.value = res;
- }
- } catch (err) {
- console.error("获取树数据异常:", err);
- ElMessage.error("加载车机版本树失败");
- }
-}
-
/** 查询触控项目列表,并在存在执行中项目时定时刷新以展示最新状态。 */
function getList() {
getProjectList(queryParams.value)
@@ -463,7 +434,7 @@ const handleUpdate = (row) => {
} catch {
arr = []
} finally {
- form.value.testFuncIds = arr
+ form.value.testFuncIds = Array.isArray(arr) ? arr : []
getFuncList(form.value.vehicleConfigId)
}
};
@@ -485,14 +456,23 @@ const handleDelete = (row) => {
const { proxy } = getCurrentInstance()
const { ti_function_config } = proxy.useDict("ti_function_config")
-const funcIdOptions = ref([])
+const availableFunctions = ref([])
+const funcIdOptions = computed(() => {
+ const labels = new Map((ti_function_config.value || []).map(item => [String(item.value), item.label]))
+ return availableFunctions.value.map(item => ({
+ label: labels.get(String(item.funcKey)) || item.funcKey || `功能 ${item.id}`,
+ value: item.id,
+ }))
+})
const vehicleConfigChange = (value) => {
- form.value.testFuncIds = null
- funcIdOptions.value = []
+ form.value.testFuncIds = []
getFuncList(value)
}
+let functionListRequest = 0
const getFuncList = async (value) => {
+ const request = ++functionListRequest
+ availableFunctions.value = []
if (!value) return;
try {
const res = await getFunction({
@@ -500,20 +480,12 @@ const getFuncList = async (value) => {
pageSize: 10000,
vehicleConfigId: value
});
+ if (request !== functionListRequest) return;
if (res.code !== 200) {
ElMessage.error(res.msg || "加载功能列表失败");
return;
}
- const dictItems = ti_function_config.value || [];
- funcIdOptions.value = (res.rows || []).map(item => {
- const dictItem = dictItems.find(func => {
- return String(func.value) === String(item.funcKey)
- });
- return {
- label: dictItem?.label || item.funcKey || `功能 ${item.id}`,
- value: item.id
- };
- });
+ availableFunctions.value = res.rows || [];
} catch (err) {
console.error("加载功能列表异常:", err);
ElMessage.error("网络异常,加载功能列表失败");
@@ -584,7 +556,6 @@ const closeRun = () => {
onMounted(() => {
getList();
- getTreeData();
});