添加行为树复制功能

This commit is contained in:
2026-04-13 14:25:50 +08:00
parent 5179ab785c
commit 3946bc561a

View File

@@ -29,6 +29,12 @@
</a-tooltip>
<a-flex class="ks-tree-actions">
<!-- <span style="margin-right: 10px"><EditFilled /></span>-->
<a-popconfirm
title="确定复制?"
@confirm="()=> handleCopy(item)"
>
<span class="ks-tree-action ks-tree-action-copy" @click.stop style="margin-right: 10px"><CopyOutlined /></span>
</a-popconfirm>
<a-popconfirm
title="确定删除?"
@confirm="()=> handleDelete(item)"
@@ -51,15 +57,16 @@
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { CheckOutlined, DeleteOutlined, EditFilled, PlusOutlined } from '@ant-design/icons-vue';
import { CheckOutlined, CopyOutlined, DeleteOutlined, EditFilled, PlusOutlined } from '@ant-design/icons-vue';
import type { BehaviorTree, BehaviorTreeRequest } from './tree';
import { deleteOneTreeById, findTreesByQuery } from './api';
import { copyTree, deleteOneTreeById, findTreesByQuery } from './api';
import { substring } from '@/utils/strings';
export default defineComponent({
emits: ['select-tree', 'create-tree'],
components: {
CheckOutlined,
CopyOutlined,
PlusOutlined,
DeleteOutlined,
EditFilled,
@@ -95,6 +102,14 @@ export default defineComponent({
});
};
const handleCopy = (item: BehaviorTree) => {
copyTree({ id: item.id }).then(r => {
if (r.code === 200) {
loadTress();
}
});
};
const columns = [
{
title: '名称',
@@ -133,6 +148,7 @@ export default defineComponent({
handleSelect,
handleChange,
handleDelete,
handleCopy,
};
},
});