2026-02-08 15:59:14 +08:00
|
|
|
<template>
|
2026-02-08 16:01:21 +08:00
|
|
|
|
2026-02-08 15:59:14 +08:00
|
|
|
<a-collapse v-model:activeKey="activeKey" :accordion="false">
|
|
|
|
|
<a-collapse-panel key="1">
|
|
|
|
|
<template #header>
|
|
|
|
|
<span class="ks-model-builder-title-icon icon-model"></span>我的行为树
|
|
|
|
|
</template>
|
2026-02-08 16:01:21 +08:00
|
|
|
<a-list size="small" :data-source="treeModelsData.trees || []" style="min-height: 25vh">
|
2026-02-08 15:59:14 +08:00
|
|
|
<template #renderItem="{ item }">
|
|
|
|
|
<a-tooltip placement="right">
|
|
|
|
|
<template #title>
|
|
|
|
|
{{ item.description }}
|
|
|
|
|
</template>
|
|
|
|
|
<a-list-item @click="()=> handleSelect(item)">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</a-list-item>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</template>
|
2026-02-08 16:01:21 +08:00
|
|
|
<!-- <template #footer>-->
|
|
|
|
|
<!-- <div>Footer</div>-->
|
|
|
|
|
<!-- </template>-->
|
2026-02-08 15:59:14 +08:00
|
|
|
</a-list>
|
|
|
|
|
</a-collapse-panel>
|
|
|
|
|
</a-collapse>
|
2026-02-08 16:01:21 +08:00
|
|
|
<!-- <a-card class="ks-model-builder-card tress-list-card">-->
|
|
|
|
|
<!-- <template #title>-->
|
|
|
|
|
<!-- <span class="ks-model-builder-title-icon icon-model"></span>我的行为树-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!--<!– <template #extra>–>-->
|
|
|
|
|
<!--<!– <a-tooltip placement="right">–>-->
|
|
|
|
|
<!--<!– <template #title>–>-->
|
|
|
|
|
<!--<!– 创建行为树–>-->
|
|
|
|
|
<!--<!– </template>–>-->
|
|
|
|
|
<!--<!– <PlusOutlined class="create-tree-icon"></PlusOutlined>–>-->
|
|
|
|
|
<!--<!– </a-tooltip>–>-->
|
|
|
|
|
<!--<!– </template>–>-->
|
|
|
|
|
|
|
|
|
|
<!-- <a-list size="small" :data-source="treeModelsData.trees || []">-->
|
|
|
|
|
<!-- <template #renderItem="{ item }">-->
|
|
|
|
|
<!-- <a-tooltip placement="right">-->
|
|
|
|
|
<!-- <template #title>-->
|
|
|
|
|
<!-- {{ item.description }}-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- <a-list-item @click="()=> handleSelect(item)">-->
|
|
|
|
|
<!-- {{ item.name }}-->
|
|
|
|
|
<!-- </a-list-item>-->
|
|
|
|
|
<!-- </a-tooltip>-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!--<!– <template #footer>–>-->
|
|
|
|
|
<!--<!– <div>Footer</div>–>-->
|
|
|
|
|
<!--<!– </template>–>-->
|
|
|
|
|
<!-- </a-list>-->
|
|
|
|
|
|
|
|
|
|
<!-- <a-table-->
|
|
|
|
|
<!-- size="small"-->
|
|
|
|
|
<!-- :data-source="treeModelsData.trees || []"-->
|
|
|
|
|
<!-- :columns="columns"-->
|
|
|
|
|
<!-- :customRow="customRow"-->
|
|
|
|
|
<!-- :row-key="(record: any) => record.id">-->
|
|
|
|
|
<!-- <template #bodyCell="{ text }">-->
|
|
|
|
|
<!-- {{ text }}-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </a-table>-->
|
|
|
|
|
<!-- </a-card>-->
|
2026-02-08 15:59:14 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { defineComponent, onMounted, ref } from 'vue';
|
|
|
|
|
import { defaultPaginationRequest, defaultTreeModelsData } from './constants';
|
2026-02-08 16:01:21 +08:00
|
|
|
import { CheckOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
2026-02-08 15:59:14 +08:00
|
|
|
import type { ApiPaginationQuery } from '@/types';
|
|
|
|
|
import type { TreeModel, TreeModelsData } from './types';
|
|
|
|
|
import { findTreesByQuery } from './api';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
emits: ['select-tree'],
|
|
|
|
|
components: {
|
2026-02-08 16:01:21 +08:00
|
|
|
PlusOutlined
|
2026-02-08 15:59:14 +08:00
|
|
|
},
|
|
|
|
|
setup(_props, { emit }) {
|
|
|
|
|
const treeModelsData = ref<TreeModelsData>({ ...defaultTreeModelsData });
|
|
|
|
|
const treeModelsQuery = ref<ApiPaginationQuery>({ ...defaultPaginationRequest });
|
2026-02-08 16:01:21 +08:00
|
|
|
const activeKey = ref<number>(1)
|
2026-02-08 15:59:14 +08:00
|
|
|
const loadTress = () => {
|
|
|
|
|
findTreesByQuery(treeModelsQuery.value).then(r => {
|
|
|
|
|
treeModelsData.value = r.data;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: '名称',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const handleSelect = (record: TreeModel) => {
|
|
|
|
|
emit('select-tree', record);
|
2026-02-08 16:01:21 +08:00
|
|
|
}
|
2026-02-08 15:59:14 +08:00
|
|
|
|
|
|
|
|
const customRow = (record: TreeModel) => {
|
|
|
|
|
return {
|
|
|
|
|
onClick: (event: any) => {
|
|
|
|
|
emit('select-tree', record, event);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
loadTress();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
activeKey,
|
|
|
|
|
treeModelsData,
|
|
|
|
|
treeModelsQuery,
|
|
|
|
|
loadTress,
|
|
|
|
|
columns,
|
|
|
|
|
customRow,
|
|
|
|
|
handleSelect,
|
|
|
|
|
};
|
|
|
|
|
},
|
2026-02-08 16:01:21 +08:00
|
|
|
})
|
2026-02-08 15:59:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
2026-02-08 16:01:21 +08:00
|
|
|
.create-tree-icon{
|
2026-02-08 15:59:14 +08:00
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.ant-list-item {
|
|
|
|
|
padding: 5px 5px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: rgb(130 196 233);
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
background: #0d2d4e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|