Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
package com.solution.web.controller.behaviour;
|
||||||
|
|
||||||
|
import com.solution.common.core.controller.BaseController;
|
||||||
|
import com.solution.common.core.domain.AjaxResult;
|
||||||
|
import com.solution.system.service.HbNodeCommandService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/node/command")
|
||||||
|
public class HbNodeCommandController extends BaseController {
|
||||||
|
|
||||||
|
private final HbNodeCommandService nodeCommandService;
|
||||||
|
|
||||||
|
public HbNodeCommandController(HbNodeCommandService nodeCommandService) {
|
||||||
|
this.nodeCommandService = nodeCommandService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/all")
|
||||||
|
public AjaxResult all() {
|
||||||
|
return success(nodeCommandService.findAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.solution.system.domain;
|
||||||
|
/*
|
||||||
|
* 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 java.io.Serializable;
|
||||||
|
|
||||||
|
public class HbNodeCommand implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String command;
|
||||||
|
|
||||||
|
private String chineseName;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommand(String command) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChineseName() {
|
||||||
|
return chineseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChineseName(String chineseName) {
|
||||||
|
this.chineseName = chineseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.solution.system.mapper;
|
||||||
|
/*
|
||||||
|
* 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 com.solution.system.domain.HbNodeCommand;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface HbNodeCommandMapper {
|
||||||
|
|
||||||
|
List<HbNodeCommand> findAll();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.solution.system.service;
|
||||||
|
/*
|
||||||
|
* 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 com.solution.system.domain.HbNodeCommand;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface HbNodeCommandService {
|
||||||
|
|
||||||
|
List<HbNodeCommand> findAll();
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.solution.system.service.impl;
|
||||||
|
/*
|
||||||
|
* 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 com.solution.system.domain.HbNodeCommand;
|
||||||
|
import com.solution.system.mapper.HbNodeCommandMapper;
|
||||||
|
import com.solution.system.service.HbNodeCommandService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class HbNodeCommandServiceImpl implements HbNodeCommandService {
|
||||||
|
|
||||||
|
private final HbNodeCommandMapper hbNodeCommandMapper;
|
||||||
|
|
||||||
|
public HbNodeCommandServiceImpl(HbNodeCommandMapper hbNodeCommandMapper) {
|
||||||
|
this.hbNodeCommandMapper = hbNodeCommandMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HbNodeCommand> findAll() {
|
||||||
|
return hbNodeCommandMapper.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.solution.system.mapper.HbNodeCommandMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.solution.system.domain.HbNodeCommand" id="HbNodeCommandMapperMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="command" column="command"/>
|
||||||
|
<result property="description" column="description"/>
|
||||||
|
<result property="chineseName" column="chinese_name"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="findAll" resultMap="HbNodeCommandMapperMap">
|
||||||
|
select *
|
||||||
|
from bh_node_command
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -1204,7 +1204,7 @@
|
|||||||
.ant-tabs-content {
|
.ant-tabs-content {
|
||||||
//padding: 15px;
|
//padding: 15px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
background: #041b36db;
|
background: #041832;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.settings-tab,
|
&.settings-tab,
|
||||||
@@ -1508,9 +1508,7 @@
|
|||||||
border-inline-end-width: 1px;
|
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-placeholder,
|
||||||
.ant-select .ant-select-selection-search-input{
|
.ant-select .ant-select-selection-search-input{
|
||||||
background: transparent
|
background: transparent
|
||||||
@@ -1832,3 +1830,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import { HttpRequestClient } from '@/utils/request';
|
import { HttpRequestClient } from '@/utils/request';
|
||||||
import type { BasicResponse } from '@/types';
|
import type { BasicResponse } from '@/types';
|
||||||
import type { PlatformListableResponse } from './types';
|
import type { NodeCommandListResponse, PlatformListableResponse } from './types';
|
||||||
|
|
||||||
const req = HttpRequestClient.create<BasicResponse>({
|
const req = HttpRequestClient.create<BasicResponse>({
|
||||||
baseURL: '/api',
|
baseURL: '/api',
|
||||||
@@ -19,3 +19,7 @@ const req = HttpRequestClient.create<BasicResponse>({
|
|||||||
export const findAllBasicPlatforms = (): Promise<PlatformListableResponse> => {
|
export const findAllBasicPlatforms = (): Promise<PlatformListableResponse> => {
|
||||||
return req.get<PlatformListableResponse>('/system/firerule/platforms/basic');
|
return req.get<PlatformListableResponse>('/system/firerule/platforms/basic');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const findAllNodeCommands = (): Promise<NodeCommandListResponse> => {
|
||||||
|
return req.get<NodeCommandListResponse>('/node/command/all')
|
||||||
|
}
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
<Properties
|
<Properties
|
||||||
v-if="graph"
|
v-if="graph"
|
||||||
:platforms="platforms"
|
:platforms="platforms"
|
||||||
|
:nodeCommands="nodeCommands"
|
||||||
:element="selectedNodeTaskElement"
|
:element="selectedNodeTaskElement"
|
||||||
:graph="graph as any"
|
:graph="graph as any"
|
||||||
:node="selectedModelNode 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 { createGraphTaskElement, createLineOptions, type GraphContainer, type GraphTaskElement, hasElements, hasRootElementNode, resolveGraph, useGraphCanvas } from '../graph';
|
||||||
import { registerNodeElement } from './register';
|
import { registerNodeElement } from './register';
|
||||||
import { findAllBasicPlatforms } from '../api';
|
import { findAllBasicPlatforms, findAllNodeCommands } from '../api';
|
||||||
import type { Platform } from '../types';
|
import type { Platform } from '../types';
|
||||||
import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree } from './api';
|
import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree } from './api';
|
||||||
import TressCard from './trees-card.vue';
|
import TressCard from './trees-card.vue';
|
||||||
@@ -111,6 +112,7 @@ export default defineComponent({
|
|||||||
const changed = ref<boolean>(false);
|
const changed = ref<boolean>(false);
|
||||||
const treesCardRef = ref<InstanceType<typeof TressCard> | null>(null);
|
const treesCardRef = ref<InstanceType<typeof TressCard> | null>(null);
|
||||||
const platforms = ref<Platform[]>([]);
|
const platforms = ref<Platform[]>([]);
|
||||||
|
const nodeCommands = ref<NodeCommand[]>([])
|
||||||
const currentScenarioId = ref<number | null>(null);
|
const currentScenarioId = ref<number | null>(null);
|
||||||
|
|
||||||
const {
|
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) => {
|
const handleDragStart = (nm: NodeDragTemplate) => {
|
||||||
draggedNodeData.value = nm;
|
draggedNodeData.value = nm;
|
||||||
@@ -449,13 +463,14 @@ export default defineComponent({
|
|||||||
// 初始化
|
// 初始化
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
loadPlatforms();
|
loadDatasource();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 清理
|
// 清理
|
||||||
onBeforeUnmount(() => destroy());
|
onBeforeUnmount(() => destroy());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
nodeCommands,
|
||||||
currentScenarioId,
|
currentScenarioId,
|
||||||
platforms,
|
platforms,
|
||||||
treesCardRef,
|
treesCardRef,
|
||||||
|
|||||||
@@ -111,6 +111,11 @@
|
|||||||
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
|
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-option v-for="pl in platforms" :value="pl.name">{{pl.description}}</a-select-option>
|
||||||
</a-select>
|
</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"
|
<a-input v-else v-model:value="setting.defaultValue"
|
||||||
:placeholder="setting.description" size="small" />
|
:placeholder="setting.description" size="small" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -127,6 +132,16 @@
|
|||||||
<a-form-item v-for="setting in currentElement.parameters" :label="setting.description">
|
<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"
|
<a-input-number v-if="setting.dataType === 'double'" v-model:value="setting.defaultValue"
|
||||||
:placeholder="setting.description" size="small" style="width:100%;" />
|
: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-input v-else v-model:value="setting.defaultValue" :placeholder="setting.description" size="small" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
@@ -161,7 +176,7 @@ import type { ElementParameter, ElementVariable, GraphTaskElement } from '../gra
|
|||||||
import type { BehaviorTree } from './tree';
|
import type { BehaviorTree } from './tree';
|
||||||
import type { Graph, Node, NodeProperties } from '@antv/x6';
|
import type { Graph, Node, NodeProperties } from '@antv/x6';
|
||||||
import { generateKey } from '@/utils/strings';
|
import { generateKey } from '@/utils/strings';
|
||||||
import type { Platform } from '@/views/decision/types';
|
import type { NodeCommand, Platform } from '../types';
|
||||||
|
|
||||||
const actionSpaceColumns = [
|
const actionSpaceColumns = [
|
||||||
{ title: '序号', dataIndex: 'index', key: 'index', width: 40 },
|
{ 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 },
|
node: { type: [Object, null] as PropType<Node<NodeProperties> | null | undefined>, required: false },
|
||||||
graph: { type: [Object, null] as PropType<Graph | null | undefined>, required: true },
|
graph: { type: [Object, null] as PropType<Graph | null | undefined>, required: true },
|
||||||
platforms: { type: Array as PropType<Platform[]>, required: true },
|
platforms: { type: Array as PropType<Platform[]>, required: true },
|
||||||
|
nodeCommands: { type: Array as PropType<NodeCommand[]>, required: true },
|
||||||
},
|
},
|
||||||
emits: ['update-element', 'update-tree'],
|
emits: ['update-element', 'update-tree'],
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const platforms = ref<Platform[]>(props.platforms ?? []);
|
const platforms = ref<Platform[]>(props.platforms ?? []);
|
||||||
|
const nodeCommands = ref<NodeCommand[]>(props.nodeCommands ?? []);
|
||||||
|
|
||||||
const activeTopTabsKey = ref<string>('1');
|
const activeTopTabsKey = ref<string>('1');
|
||||||
const activeBottomTabsKey = ref<string>('1');
|
const activeBottomTabsKey = ref<string>('1');
|
||||||
@@ -370,11 +387,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
watch(() => currentElement.value, () => updateNode(), { deep: true });
|
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 });
|
watch(() => props.platforms, (n: Platform[] | null | undefined) => platforms.value = n ?? [], { deep: true, immediate: true });
|
||||||
|
|
||||||
onMounted(() => load());
|
onMounted(() => load());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
nodeCommands,
|
||||||
platforms,
|
platforms,
|
||||||
addParameterTab,
|
addParameterTab,
|
||||||
groupedParametersActiveTab,
|
groupedParametersActiveTab,
|
||||||
|
|||||||
21
modeler/src/views/decision/types/command.ts
Normal file
21
modeler/src/views/decision/types/command.ts
Normal 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[]> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,3 +8,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './platform'
|
export * from './platform'
|
||||||
|
export * from './command'
|
||||||
Reference in New Issue
Block a user