feat: 增加触控交互场景
This commit is contained in:
parent
05a48c4c14
commit
dd02d8b483
@ -31,3 +31,26 @@ export const getProjectList = (params) => {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const deleteProject = (projectIds) => {
|
||||||
|
return request({
|
||||||
|
url: '/ti/project/' + projectIds,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getExecuteRunParams = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/ti/project/queryExecuteRunParams',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const projectExecute = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/ti/project/execute',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
165
src/views/is/project/evaluate/Run.vue
Normal file
165
src/views/is/project/evaluate/Run.vue
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer v-model="props.drawer" title="执行" :before-close="handleClose">
|
||||||
|
<el-form
|
||||||
|
ref="ruleFormRef"
|
||||||
|
style="max-width: 600px"
|
||||||
|
:model="{ formData }"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="auto"
|
||||||
|
>
|
||||||
|
<el-form-item label="机器人IP" prop="formData.terminalId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
|
||||||
|
<el-select v-model="formData.terminalId" style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in terminalIdOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-table
|
||||||
|
:data="formData.tableData"
|
||||||
|
:border="parentBorder"
|
||||||
|
:preserve-expanded-content="preserveExpanded"
|
||||||
|
default-expand-all
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template #default="{ row: pRow, $index: pIndex }">
|
||||||
|
<el-table
|
||||||
|
v-if="pRow.config.length > 0"
|
||||||
|
:data="pRow.config"
|
||||||
|
style="width: 100%"
|
||||||
|
row-key="name"
|
||||||
|
default-expand-all
|
||||||
|
>
|
||||||
|
<el-table-column prop="name" label="入参名称">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ row.name }}</span>
|
||||||
|
<span v-if="row.required" style="color: #f56c6c; margin-left: 8px;">*</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="type" label="入参类型">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag>{{ row.type }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="value" label="入参值">
|
||||||
|
<template #default="{ row, column, $index }">
|
||||||
|
<el-form-item v-if="row.type !== 'object' && !row.type.includes('array')" label="" :prop="`formData.tableData.${pIndex}.config${row.propPath}value`" :rules="row.required ? [{ required: true, message: '请输入', trigger: 'blur' }] : []">
|
||||||
|
<el-input v-if="row.type === 'string'" v-model="row.value" :disabled="row.name === 'schemeId'" />
|
||||||
|
<el-input-number v-if="row.type === 'number'" :controls="false" v-model="row.value" />
|
||||||
|
<el-switch v-if="row.type === 'boolean'" v-model="row.value" />
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="方案名称" prop="itemName" />
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="handleClose">关闭</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { addValueProperty, formatTableData } from "@/utils/flow";
|
||||||
|
import { listTerminal } from "@/api/device/terminal.js";
|
||||||
|
import { getExecuteRunParams, projectExecute } from "@/api/is/project/index.js";
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
drawer: Boolean,
|
||||||
|
projectId: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(["close"]);
|
||||||
|
|
||||||
|
const ruleFormRef = ref();
|
||||||
|
const rules = ref({});
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
terminalId: '',
|
||||||
|
tableData: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const terminalIdOptions = ref([]);
|
||||||
|
|
||||||
|
/** 获取设备终端列表 */
|
||||||
|
const handleGetTerminalGroup = async (row) => {
|
||||||
|
const res = await listTerminal({ pageNum: 1, pageSize: 1000 });
|
||||||
|
if (res.code === 200) {
|
||||||
|
terminalIdOptions.value = res.rows?.map((item) => {
|
||||||
|
return {
|
||||||
|
label: `${item.name}(${item.host}:${item.port})`,
|
||||||
|
value: item.id,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getProjectParams = async () => {
|
||||||
|
const res = await getExecuteRunParams({ projectId: props.projectId });
|
||||||
|
if (res.code === 200) {
|
||||||
|
const data = parseConfig(res.data)
|
||||||
|
console.log('data', data)
|
||||||
|
formData.value.tableData = data
|
||||||
|
handleGetTerminalGroup();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseConfig = (arr) => {
|
||||||
|
arr.forEach(item => {
|
||||||
|
if (item.config) {
|
||||||
|
item.config = addValueProperty(JSON.parse(item.config), item.schemeId)
|
||||||
|
} else {
|
||||||
|
item.config = []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirm = () => {
|
||||||
|
ruleFormRef.value
|
||||||
|
.validate()
|
||||||
|
.then(async () => {
|
||||||
|
const runParams = {}
|
||||||
|
formData.value.tableData.forEach(item => {
|
||||||
|
const data = formatTableData(item.config)
|
||||||
|
runParams[item.itemId] = data
|
||||||
|
})
|
||||||
|
const res = await projectExecute({ runParams, projectId: props.projectId, terminalId: formData.value.terminalId })
|
||||||
|
if (res.code === 200) {
|
||||||
|
ruleFormRef.value.resetFields();
|
||||||
|
ElMessage.success('执行成功')
|
||||||
|
emits("close");
|
||||||
|
} else {
|
||||||
|
ElMessage.success(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
ruleFormRef.value.resetFields();
|
||||||
|
emits("close");
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.drawer,
|
||||||
|
(newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
getProjectParams()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@ -118,6 +118,13 @@
|
|||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
v-if="row.status == 1"
|
||||||
|
@click="handleExecute(row)"
|
||||||
|
>执行
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@ -312,6 +319,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Run
|
||||||
|
:drawer="executeOpen"
|
||||||
|
@close="executeOpen = false"
|
||||||
|
:projectId="executeProjectId"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -321,7 +334,8 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|||||||
import { getTreeDataApi } from '@/api/is/func/index'
|
import { getTreeDataApi } from '@/api/is/func/index'
|
||||||
import { getChildrenByParentIdWithLevelLimitApi } from "@/api/evaluate/indicator.js";
|
import { getChildrenByParentIdWithLevelLimitApi } from "@/api/evaluate/indicator.js";
|
||||||
import { getFunction } from "@/api/is/func/index.js";
|
import { getFunction } from "@/api/is/func/index.js";
|
||||||
import { addProject, getProjectList, updateProject } from "@/api/is/project/index.js";
|
import { addProject, getProjectList, updateProject, deleteProject } from "@/api/is/project/index.js";
|
||||||
|
import Run from "@/views/is/project/evaluate/Run.vue";
|
||||||
|
|
||||||
const topContainerRef = ref();
|
const topContainerRef = ref();
|
||||||
const containerHeight = useContainerHeight(topContainerRef);
|
const containerHeight = useContainerHeight(topContainerRef);
|
||||||
@ -503,9 +517,12 @@ const handleDelete = (row) => {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
projectList.value = projectList.value.filter(
|
deleteProject(row.projectId).then((res) => {
|
||||||
(item) => item.projectId !== row.projectId
|
if (res.code === 200) {
|
||||||
);
|
ElMessage.success("删除成功");
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -536,6 +553,13 @@ const vehicleConfigChange = (value) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const executeOpen = ref(false);
|
||||||
|
const executeProjectId = ref(null);
|
||||||
|
const handleExecute = (row) => {
|
||||||
|
executeOpen.value = true;
|
||||||
|
executeProjectId.value = row.projectId;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
getTreeData();
|
getTreeData();
|
||||||
|
|||||||
@ -304,6 +304,9 @@ const sceneList = [{
|
|||||||
},{
|
},{
|
||||||
label: '语音交互-连续对话场景',
|
label: '语音交互-连续对话场景',
|
||||||
value: 'VI_CONTINUOUS_CORPUS'
|
value: 'VI_CONTINUOUS_CORPUS'
|
||||||
|
},{
|
||||||
|
label: '触控交互',
|
||||||
|
value: 'TI_TOUCH'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user