Initial commit
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
<div class="ks-model-builder-left">
|
<div class="ks-model-builder-left">
|
||||||
<TressCard
|
<TressCard
|
||||||
ref="treesCardRef"
|
ref="treesCardRef"
|
||||||
|
@create-tree="handleCreateTree"
|
||||||
@select-tree="handleSelectTree"
|
@select-tree="handleSelectTree"
|
||||||
/>
|
/>
|
||||||
<NodesCard
|
<NodesCard
|
||||||
@@ -271,6 +272,30 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCreateTree = ()=> {
|
||||||
|
currentBehaviorTree.value = {
|
||||||
|
id: 0,
|
||||||
|
name: '行为树',
|
||||||
|
description: null,
|
||||||
|
englishName: null,
|
||||||
|
xmlContent: null,
|
||||||
|
createdAt: null,
|
||||||
|
graph: {
|
||||||
|
edges: [],
|
||||||
|
nodes: [],
|
||||||
|
},
|
||||||
|
updatedAt: null,
|
||||||
|
}
|
||||||
|
currentNodeGraph.value = {
|
||||||
|
edges: [],
|
||||||
|
nodes: [],
|
||||||
|
}
|
||||||
|
selectedModelNode.value = null;
|
||||||
|
selectedNodeTaskElement.value = null;
|
||||||
|
|
||||||
|
createElements();
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化X6画布
|
// 初始化X6画布
|
||||||
const initGraph = () => {
|
const initGraph = () => {
|
||||||
if (!canvas.value) {
|
if (!canvas.value) {
|
||||||
@@ -352,6 +377,14 @@ export default defineComponent({
|
|||||||
graph: graphData,
|
graph: graphData,
|
||||||
xmlContent: JSON.stringify(graphData),
|
xmlContent: JSON.stringify(graphData),
|
||||||
};
|
};
|
||||||
|
if(! newTree.name){
|
||||||
|
message.error('行为树名称不能为空.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(! newTree.englishName){
|
||||||
|
message.error('行为树英文名称不能为空.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
let res = null;
|
let res = null;
|
||||||
if (currentBehaviorTree.value.id > 0) {
|
if (currentBehaviorTree.value.id > 0) {
|
||||||
res = createTree(newTree);
|
res = createTree(newTree);
|
||||||
@@ -389,6 +422,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
treesCardRef,
|
treesCardRef,
|
||||||
|
handleCreateTree,
|
||||||
currentTreeEditing,
|
currentTreeEditing,
|
||||||
currentBehaviorTree,
|
currentBehaviorTree,
|
||||||
currentNodeGraph,
|
currentNodeGraph,
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
<a-input size="small" v-model:value="tree.name" placeholder="行为树名称" />
|
<a-input size="small" v-model:value="tree.name" placeholder="行为树名称" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="行为树英文名称">
|
||||||
|
<a-input size="small" v-model:value="tree.englishName" placeholder="行为树英文名称" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="行为树说明">
|
<a-form-item label="行为树说明">
|
||||||
<a-textarea size="small" v-model:value="tree.description" placeholder="行为树说明" />
|
<a-textarea size="small" v-model:value="tree.description" placeholder="行为树说明" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-collapse v-model:activeKey="activeKey" :accordion="false" class="ks-trees-collapse">
|
<a-collapse v-model:activeKey="activeKey" :accordion="false" class="ks-trees-collapse">
|
||||||
<a-collapse-panel key="1">
|
<a-collapse-panel key="1" style="position: relative">
|
||||||
<template #header>
|
<template #header>
|
||||||
<span class="ks-model-builder-title-icon icon-model"></span>我的行为树
|
<a-flex>
|
||||||
|
<span class="ks-model-builder-title-icon icon-model"></span>
|
||||||
|
<span style="color: #82c4e9;font-size: 16px;">我的行为树</span>
|
||||||
|
<!-- <span style="position: absolute; right: 15px;"><PlusOutlined @click="$emit('create-tree')"/></span>-->
|
||||||
|
</a-flex>
|
||||||
</template>
|
</template>
|
||||||
<div class="w-full" style="padding: 5px;">
|
<div class="w-full" style="padding: 5px;">
|
||||||
<a-input-search size="small" allowClear v-model:value="behaviorTreeQuery.name" placeholder="行为树名称" @search="loadTress" />
|
<a-flex>
|
||||||
|
<a-input-search size="small" allowClear v-model:value="behaviorTreeQuery.name" placeholder="行为树名称" @search="loadTress" />
|
||||||
|
<a-button size="small" style="margin-left: 10px;"><PlusOutlined style="margin-top: 0px;display: block;" @click="$emit('create-tree')"/></a-button>
|
||||||
|
</a-flex>
|
||||||
</div>
|
</div>
|
||||||
<a-list size="small" :data-source="behaviorTrees || []" style="min-height: 25vh">
|
<a-list size="small" :data-source="behaviorTrees || []" style="min-height: 25vh">
|
||||||
|
|
||||||
|
|
||||||
<template #renderItem="{ item }">
|
<template #renderItem="{ item }">
|
||||||
<a-list-item>
|
<a-list-item>
|
||||||
<a-flex>
|
<a-flex>
|
||||||
@@ -50,7 +55,7 @@ import { deleteOneTreeById, findTreesByQuery } from './api';
|
|||||||
import { substring } from '@/utils/strings';
|
import { substring } from '@/utils/strings';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
emits: ['select-tree'],
|
emits: ['select-tree','create-tree'],
|
||||||
components: {
|
components: {
|
||||||
CheckOutlined,
|
CheckOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
|
|||||||
Reference in New Issue
Block a user