UPDATE: VERSION-20260331

This commit is contained in:
libertyspy
2026-03-31 14:32:54 +08:00
parent 705021b391
commit a0d8f555f9
6 changed files with 110 additions and 11 deletions

View File

@@ -1204,7 +1204,7 @@
.ant-tabs-content {
//padding: 15px;
padding: 4px;
background: #041b36db;
background: #041832;
}
&.settings-tab,
@@ -1508,9 +1508,7 @@
border-inline-end-width: 1px;
}
}
.ant-select:not(.ant-select-customize-input) .ant-select-selector{
border: 1px solid #2c2a2a;
}
.ant-select .ant-select-selection-placeholder,
.ant-select .ant-select-selection-search-input{
background: transparent
@@ -1831,4 +1829,45 @@
}
}
}
}
.ks-add-parameter-action{
color: #eee;
position: absolute;
right: 14px;
top: 6px;
cursor: pointer;
}
.ks-parameter-setting-tabs{
.ant-tabs-nav{
background: none;
}
.ant-tabs-nav-list{
margin-left: 0;
}
&.ant-tabs-left >.ant-tabs-content-holder,
&.ant-tabs-left >div>.ant-tabs-content-holder{
border-left-color: #09264b;
}
.ant-tabs-tab-remove{
//position: absolute;
//right: 10px;
//top: 7px;
.anticon{
color: rgb(173 206 224);
}
}
&.ant-tabs-left >.ant-tabs-nav .ant-tabs-tab{
border-radius: 0!important;
}
&.ant-tabs-card >.ant-tabs-nav .ant-tabs-tab-active,
&.ant-tabs-card >div>.ant-tabs-nav .ant-tabs-tab-active {
background: #09264c;
}
&.ant-tabs-left >.ant-tabs-content-holder >.ant-tabs-content>.ant-tabs-tabpane,
&.ant-tabs-left >div>.ant-tabs-content-holder >.ant-tabs-content>.ant-tabs-tabpane{
padding-left: 5px;
}
}

View File

@@ -9,7 +9,7 @@
import { HttpRequestClient } from '@/utils/request';
import type { BasicResponse } from '@/types';
import type { PlatformListableResponse } from './types';
import type { NodeCommandListResponse, PlatformListableResponse } from './types';
const req = HttpRequestClient.create<BasicResponse>({
baseURL: '/api',
@@ -18,4 +18,8 @@ const req = HttpRequestClient.create<BasicResponse>({
export const findAllBasicPlatforms = (): Promise<PlatformListableResponse> => {
return req.get<PlatformListableResponse>('/system/firerule/platforms/basic');
};
};
export const findAllNodeCommands = (): Promise<NodeCommandListResponse> => {
return req.get<NodeCommandListResponse>('/node/command/all')
}

View File

@@ -43,6 +43,7 @@
<Properties
v-if="graph"
:platforms="platforms"
:nodeCommands="nodeCommands"
:element="selectedNodeTaskElement"
:graph="graph as any"
:node="selectedModelNode as any"
@@ -72,7 +73,7 @@ import { createGraphTaskElementFromTemplate } from './utils';
import { createGraphTaskElement, createLineOptions, type GraphContainer, type GraphTaskElement, hasElements, hasRootElementNode, resolveGraph, useGraphCanvas } from '../graph';
import { registerNodeElement } from './register';
import { findAllBasicPlatforms } from '../api';
import { findAllBasicPlatforms, findAllNodeCommands } from '../api';
import type { Platform } from '../types';
import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree } from './api';
import TressCard from './trees-card.vue';
@@ -111,6 +112,7 @@ export default defineComponent({
const changed = ref<boolean>(false);
const treesCardRef = ref<InstanceType<typeof TressCard> | null>(null);
const platforms = ref<Platform[]>([]);
const nodeCommands = ref<NodeCommand[]>([])
const currentScenarioId = ref<number | null>(null);
const {
@@ -138,6 +140,18 @@ export default defineComponent({
});
};
const loadNodeCommands = ()=> {
nodeCommands.value = []
findAllNodeCommands().then(r=> {
nodeCommands.value = r.data ?? []
})
}
const loadDatasource = ()=> {
loadPlatforms();
loadNodeCommands();
}
// 处理拖动开始
const handleDragStart = (nm: NodeDragTemplate) => {
draggedNodeData.value = nm;
@@ -449,13 +463,14 @@ export default defineComponent({
// 初始化
onMounted(() => {
init();
loadPlatforms();
loadDatasource();
});
// 清理
onBeforeUnmount(() => destroy());
return {
nodeCommands,
currentScenarioId,
platforms,
treesCardRef,

View File

@@ -111,6 +111,11 @@
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
<a-select-option v-for="pl in platforms" :value="pl.name">{{pl.description}}</a-select-option>
</a-select>
<a-select :placeholder="`请选择${setting.description}`"
allow-clear
v-else-if="setting.paramKey === 'command'" v-model:value="setting.defaultValue">
<a-select-option v-for="pl in nodeCommands" :value="pl.command">{{pl.chineseName}}</a-select-option>
</a-select>
<a-input v-else v-model:value="setting.defaultValue"
:placeholder="setting.description" size="small" />
</a-form-item>
@@ -127,6 +132,16 @@
<a-form-item v-for="setting in currentElement.parameters" :label="setting.description">
<a-input-number v-if="setting.dataType === 'double'" v-model:value="setting.defaultValue"
:placeholder="setting.description" size="small" style="width:100%;" />
<a-select :placeholder="`请选择${setting.description}`"
allow-clear
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
<a-select-option v-for="pl in platforms" :value="pl.name">{{ pl.description }}</a-select-option>
</a-select>
<a-select :placeholder="`请选择${setting.description}`"
allow-clear
v-else-if="setting.paramKey === 'command'" v-model:value="setting.defaultValue">
<a-select-option v-for="pl in nodeCommands" :value="pl.command">{{pl.chineseName}}</a-select-option>
</a-select>
<a-input v-else v-model:value="setting.defaultValue" :placeholder="setting.description" size="small" />
</a-form-item>
</template>
@@ -161,7 +176,7 @@ import type { ElementParameter, ElementVariable, GraphTaskElement } from '../gra
import type { BehaviorTree } from './tree';
import type { Graph, Node, NodeProperties } from '@antv/x6';
import { generateKey } from '@/utils/strings';
import type { Platform } from '@/views/decision/types';
import type { NodeCommand, Platform } from '../types';
const actionSpaceColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', width: 40 },
@@ -179,10 +194,12 @@ export default defineComponent({
node: { type: [Object, null] as PropType<Node<NodeProperties> | null | undefined>, required: false },
graph: { type: [Object, null] as PropType<Graph | null | undefined>, required: true },
platforms: { type: Array as PropType<Platform[]>, required: true },
nodeCommands: { type: Array as PropType<NodeCommand[]>, required: true },
},
emits: ['update-element', 'update-tree'],
setup(props, { emit }) {
const platforms = ref<Platform[]>(props.platforms ?? []);
const nodeCommands = ref<NodeCommand[]>(props.nodeCommands ?? []);
const activeTopTabsKey = ref<string>('1');
const activeBottomTabsKey = ref<string>('1');
@@ -370,11 +387,13 @@ export default defineComponent({
watch(() => currentElement.value, () => updateNode(), { deep: true });
watch(() => props.nodeCommands, (n: NodeCommand[] | null | undefined) => nodeCommands.value = n ?? [], { deep: true, immediate: true });
watch(() => props.platforms, (n: Platform[] | null | undefined) => platforms.value = n ?? [], { deep: true, immediate: true });
onMounted(() => load());
return {
nodeCommands,
platforms,
addParameterTab,
groupedParametersActiveTab,

View File

@@ -0,0 +1,21 @@
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2026 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import type { ApiDataResponse, NullableString } from '@/types';
export interface NodeCommand {
id: number,
command: NullableString,
chineseName: NullableString,
description: NullableString,
}
export interface NodeCommandListResponse extends ApiDataResponse<NodeCommand[]> {
}

View File

@@ -7,4 +7,5 @@
* that was distributed with this source code.
*/
export * from './platform'
export * from './platform'
export * from './command'