Compare commits

52 Commits

Author SHA1 Message Date
6fb020355b 配置前端动作分类 2026-03-12 10:16:56 +08:00
libertyspy
8b3fe9b548 UPDATE: fk 2026-02-09 21:05:07 +08:00
libertyspy
db30244cd1 Initial commit 2026-02-09 21:03:57 +08:00
libertyspy
c9bc62fb8c Initial commit 2026-02-09 20:10:24 +08:00
libertyspy
9d54395c29 Initial commit 2026-02-09 20:05:56 +08:00
libertyspy
35fd1c8937 Initial commit 2026-02-09 19:53:17 +08:00
libertyspy
579d0f2bd8 Initial commit 2026-02-09 15:35:20 +08:00
libertyspy
7f8abf2ff2 Initial commit 2026-02-09 15:26:21 +08:00
libertyspy
f1bcd3812d Initial commit 2026-02-09 15:06:04 +08:00
libertyspy
d3fda27bb0 Initial commit 2026-02-09 15:04:34 +08:00
libertyspy
538a43f597 Merge remote-tracking branch 'origin/master' 2026-02-09 14:53:43 +08:00
libertyspy
fcab8585c5 UPDATE: fk 2026-02-09 14:53:05 +08:00
libertyspy
0ffc42ab69 UPDATE: fk 2026-02-09 14:52:56 +08:00
libertyspy
46bead08a0 UPDATE: fk 2026-02-09 14:52:46 +08:00
zouju
e07b11ef95 修改部分规则代码 2026-02-09 11:15:26 +08:00
libertyspy
a78781782e Initial commit 2026-02-08 22:32:50 +08:00
libertyspy
0b55384442 Initial commit 2026-02-08 22:31:13 +08:00
libertyspy
43837901f3 Initial commit 2026-02-08 22:30:08 +08:00
libertyspy
8898cd2e6f Initial commit 2026-02-08 22:28:52 +08:00
libertyspy
f34274ea35 Initial commit 2026-02-08 22:16:22 +08:00
libertyspy
5ffdb5e508 Initial commit 2026-02-08 22:09:28 +08:00
libertyspy
a5a3c93135 UPDATE: fk 2026-02-08 21:50:56 +08:00
libertyspy
af697e9304 UPDATE: fk 2026-02-08 21:50:33 +08:00
libertyspy
e7abfca9f7 Initial commit 2026-02-08 21:36:39 +08:00
libertyspy
1058d666a0 Initial commit 2026-02-08 20:57:07 +08:00
libertyspy
58d36a3d6d Initial commit 2026-02-08 20:41:49 +08:00
libertyspy
b544391b5c Initial commit 2026-02-08 20:27:40 +08:00
libertyspy
e12c3c0302 UPDATE: fk 2026-02-08 20:14:46 +08:00
libertyspy
d8c429d000 UPDATE: fk 2026-02-08 20:14:07 +08:00
libertyspy
7909ea8acb UPDATE: fk 2026-02-08 18:51:18 +08:00
libertyspy
444c31612d Merge remote-tracking branch 'origin/master' 2026-02-08 18:50:38 +08:00
libertyspy
a3e34424d8 UPDATE: fk 2026-02-08 18:48:21 +08:00
libertyspy
76065ed5c4 Initial commit 2026-02-08 18:43:42 +08:00
libertyspy
70de3c68a8 Initial commit 2026-02-08 18:41:38 +08:00
libertyspy
3bb9178399 Initial commit 2026-02-08 18:05:48 +08:00
libertyspy
82fcedfa97 Initial commit 2026-02-08 17:57:40 +08:00
libertyspy
294e5d687e Initial commit 2026-02-08 17:11:03 +08:00
libertyspy
a246c88341 Initial commit 2026-02-08 16:44:50 +08:00
libertyspy
c9d5c38b52 Initial commit 2026-02-08 16:01:21 +08:00
libertyspy
9ded6b757c Initial commit 2026-02-08 15:59:14 +08:00
libertyspy
015030d650 Initial commit 2026-02-08 15:38:50 +08:00
libertyspy
b67f493678 UPDATE: fk 2026-02-08 15:38:32 +08:00
e3be036bd3 fix(behaviour): 修复行为树实例节点保存方法返回值类型
- 将返回类型从 Integer 改为 Long 以匹配实际数据类型
- 调整新增逻辑中的返回值,直接返回节点实例ID而不是插入操作的结果
- 统一更新逻辑的返回值处理方式
- 移动服务层调用顺序以确保正确的业务逻辑执行
2026-02-08 11:23:57 +08:00
0daa1c19cf Merge remote-tracking branch 'origin/master' 2026-02-07 19:37:10 +08:00
577bc3e1c0 feat(behaviour): 添加行为树模块功能实现
- 添加节点参数的保存、更新和删除操作支持
2026-02-06 16:16:05 +08:00
7c5c5d89ee Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution into dev 2026-02-05 17:22:35 +08:00
cd18e2a71d style(excel): 优化Excel注解中的字符串格式
- 移除Nodetemplate类中节点类型的双引号显示
- 移除Templateparameterdef类中数据类型的双引号显示
- 统一Excel导出时的字符串格式规范
2026-02-05 17:21:54 +08:00
06426bcb31 feat(behaviour): 添加行为树系统核心功能模块
- 创建行为树主对象实体类Behaviortree,包含ID、名称、描述、创建时间、更新时间、英文名和XML内容字段
- 实现行为树控制器BehaviortreeController,提供增删改查和导出功能接口
- 开发行为树数据访问层,包括Mapper接口和MyBatis XML映射文件
- 构建行为树服务层接口及实现类,封装业务逻辑处理
- 添加节点连接、节点参数、节点模板、模板参数定义和行为树实例节点等相关实体和服务接口
- 实现节点连接管理功能,支持父子节点关系建立和执行顺序配置
- 提供完整的CRUD操作和权限控制,集成Excel导出功能
2026-02-05 17:19:07 +08:00
ba5913a50b Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution into dev 2026-02-05 16:58:43 +08:00
19024e8486 Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution into dev 2026-02-05 16:22:12 +08:00
c90dfd8ccb Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution into dev 2026-02-05 16:02:37 +08:00
60bcac32c5 style(controller): 格式化测试控制器代码风格 2026-02-05 16:02:17 +08:00
171 changed files with 7323 additions and 13299 deletions

2
.gitignore vendored
View File

@@ -8,6 +8,8 @@
target/
!.mvn/wrapper/maven-wrapper.jar
node_modules/
######################################################################
# IDE

View File

@@ -1,8 +1,14 @@
package com.solution.web.controller.algo;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -32,11 +38,56 @@ import com.solution.common.core.page.TableDataInfo;
*/
@RestController
@Api("规则模块")
@RequestMapping("/algo/algorithm")
@RequestMapping("/api/algo/algorithm")
public class AlgorithmController extends BaseController {
@Autowired
private IAlgorithmService algorithmService;
/**
* 导出规则列表
*/
@ApiOperation("运行python程序")
@PostMapping("/run")
public Object run(@RequestBody Algorithm algorithm) {
List<Algorithm> list = algorithmService.selectAlgorithmList(algorithm);
ObjectMapper objectMapper = new ObjectMapper();
for (Algorithm al : list) {
String codePath = al.getCodePath();
try {
String jsonInput = objectMapper.writeValueAsString(al);
String pythonExe = "E:\\Apps\\anaconda3\\python.exe";
ProcessBuilder pb = new ProcessBuilder(pythonExe, codePath);
Process process = pb.start();
try (OutputStream os = process.getOutputStream()) {
os.write(jsonInput.getBytes(StandardCharsets.UTF_8));
os.flush();
}
String result;
// 修改你 Java 代码中的这一段
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
result = reader.lines().collect(Collectors.joining("\n"));
}
int exitCode = process.waitFor();
if (exitCode != 0) {
return "Python执行失败错误码" + exitCode;
}
return objectMapper.readTree(result);
} catch (Exception e) {
e.printStackTrace();
return "执行异常: " + e.getMessage();
}
}
return "未找到算法";
}
/**
* 查询规则列表
*/
@@ -56,7 +107,7 @@ public class AlgorithmController extends BaseController {
@PreAuthorize("@ss.hasPermi('algo:algorithm:export')")
@Log(title = "规则", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Algorithm algorithm) {
public void export(HttpServletResponse response, @RequestBody Algorithm algorithm) {
List<Algorithm> list = algorithmService.selectAlgorithmList(algorithm);
ExcelUtil<Algorithm> util = new ExcelUtil<Algorithm>(Algorithm.class);
util.exportExcel(response, list, "规则数据");

View File

@@ -0,0 +1,117 @@
package com.solution.web.controller.behaviour;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.solution.web.core.BehaviortreeProcessor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.system.domain.Behaviortree;
import com.solution.system.service.IBehaviortreeService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 行为树主Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@Api("行为树管理")
@RestController
@RequestMapping("/api/system/behaviortree")
public class BehaviortreeController extends BaseController
{
@Autowired
private IBehaviortreeService behaviortreeService;
@Autowired
private BehaviortreeProcessor behaviortreeProcessor;
/**
* 查询行为树主列表
*/
@ApiOperation("获取行为树列表")
@PreAuthorize("@ss.hasPermi('system:behaviortree:list')")
@GetMapping("/list")
public TableDataInfo list(Behaviortree behaviortree)
{
startPage();
List<Behaviortree> list = behaviortreeService.selectBehaviortreeList(behaviortree);
return getDataTable(list);
}
/**
* 导出行为树主列表
*/
@PreAuthorize("@ss.hasPermi('system:behaviortree:export')")
@Log(title = "行为树主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Behaviortree behaviortree)
{
List<Behaviortree> list = behaviortreeService.selectBehaviortreeList(behaviortree);
ExcelUtil<Behaviortree> util = new ExcelUtil<Behaviortree>(Behaviortree.class);
util.exportExcel(response, list, "行为树主数据");
}
/**
* 获取行为树主详细信息
*/
@ApiOperation("获取行为树详情")
@PreAuthorize("@ss.hasPermi('system:behaviortree:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(behaviortreeService.selectBehaviortreeById(id));
}
/**
* 新增行为树主
*/
@ApiOperation("新增行为树主")
@PreAuthorize("@ss.hasPermi('system:behaviortree:add')")
@Log(title = "行为树主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Behaviortree behaviortree)
{
return toAjax(behaviortreeProcessor.create(behaviortree));
}
/**
* 修改行为树主
*/
@ApiOperation("修改行为树主")
@PreAuthorize("@ss.hasPermi('system:behaviortree:edit')")
@Log(title = "行为树主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Behaviortree behaviortree)
{
return toAjax(behaviortreeProcessor.update(behaviortree));
}
/**
* 删除行为树主
*/
@ApiOperation("删除行为树主")
@PreAuthorize("@ss.hasPermi('system:behaviortree:remove')")
@Log(title = "行为树主", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
}
}

View File

@@ -0,0 +1,111 @@
package com.solution.web.controller.behaviour;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.solution.system.domain.Nodeconnection;
import com.solution.system.service.INodeconnectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 节点连接Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@Api("节点连接管理")
@RestController
@RequestMapping("/api/system/nodeconnection")
public class NodeconnectionController extends BaseController
{
@Autowired
private INodeconnectionService nodeconnectionService;
/**
* 查询节点连接列表
*/
@PreAuthorize("@ss.hasPermi('system:nodeconnection:list')")
@GetMapping("/list")
public TableDataInfo list(Nodeconnection nodeconnection)
{
startPage();
List<Nodeconnection> list = nodeconnectionService.selectNodeconnectionList(nodeconnection);
return getDataTable(list);
}
/**
* 导出节点连接列表
*/
@PreAuthorize("@ss.hasPermi('system:nodeconnection:export')")
@Log(title = "节点连接", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Nodeconnection nodeconnection)
{
List<Nodeconnection> list = nodeconnectionService.selectNodeconnectionList(nodeconnection);
ExcelUtil<Nodeconnection> util = new ExcelUtil<Nodeconnection>(Nodeconnection.class);
util.exportExcel(response, list, "节点连接数据");
}
/**
* 获取节点连接详细信息
*/
@ApiOperation("获取节点连接详细信息")
@PreAuthorize("@ss.hasPermi('system:nodeconnection:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(nodeconnectionService.selectNodeconnectionById(id));
}
/**
* 新增节点连接
*/
@ApiOperation("新增节点连接")
@PreAuthorize("@ss.hasPermi('system:nodeconnection:add')")
@Log(title = "节点连接", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Nodeconnection nodeconnection)
{
return toAjax(nodeconnectionService.insertNodeconnection(nodeconnection));
}
/**
* 修改节点连接
*/
@PreAuthorize("@ss.hasPermi('system:nodeconnection:edit')")
@Log(title = "节点连接", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Nodeconnection nodeconnection)
{
return toAjax(nodeconnectionService.updateNodeconnection(nodeconnection));
}
/**
* 删除节点连接
*/
@ApiOperation("删除节点连接")
@PreAuthorize("@ss.hasPermi('system:nodeconnection:remove')")
@Log(title = "节点连接", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(nodeconnectionService.deleteNodeconnectionByIds(ids));
}
}

View File

@@ -0,0 +1,111 @@
package com.solution.web.controller.behaviour;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.system.domain.Nodeparameter;
import com.solution.system.service.INodeparameterService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 节点参数Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@Api("节点参数管理")
@RestController
@RequestMapping("/api/system/nodeparameter")
public class NodeparameterController extends BaseController
{
@Autowired
private INodeparameterService nodeparameterService;
/**
* 查询节点参数列表
*/
@PreAuthorize("@ss.hasPermi('system:nodeparameter:list')")
@GetMapping("/list")
public TableDataInfo list(Nodeparameter nodeparameter)
{
startPage();
List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
return getDataTable(list);
}
/**
* 导出节点参数列表
*/
@PreAuthorize("@ss.hasPermi('system:nodeparameter:export')")
@Log(title = "节点参数", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Nodeparameter nodeparameter)
{
List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
ExcelUtil<Nodeparameter> util = new ExcelUtil<Nodeparameter>(Nodeparameter.class);
util.exportExcel(response, list, "节点参数数据");
}
/**
* 获取节点参数详细信息
*/
@PreAuthorize("@ss.hasPermi('system:nodeparameter:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(nodeparameterService.selectNodeparameterById(id));
}
/**
* 新增节点参数
*/
@ApiOperation("新增节点参数")
@PreAuthorize("@ss.hasPermi('system:nodeparameter:add')")
@Log(title = "节点参数", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Nodeparameter nodeparameter)
{
return toAjax(nodeparameterService.insertNodeparameter(nodeparameter));
}
/**
* 修改节点参数
*/
@ApiOperation("修改节点参数")
@PreAuthorize("@ss.hasPermi('system:nodeparameter:edit')")
@Log(title = "节点参数", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Nodeparameter nodeparameter)
{
return toAjax(nodeparameterService.updateNodeparameter(nodeparameter));
}
/**
* 删除节点参数
*/
@ApiOperation("删除节点参数")
@PreAuthorize("@ss.hasPermi('system:nodeparameter:remove')")
@Log(title = "节点参数", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(nodeparameterService.deleteNodeparameterByIds(ids));
}
}

View File

@@ -0,0 +1,171 @@
package com.solution.web.controller.behaviour;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.solution.common.core.domain.R;
import com.solution.system.domain.NodeTemplateEntity;
import com.solution.system.domain.Nodeparameter;
import com.solution.system.domain.Templateparameterdef;
import com.solution.system.service.INodeparameterService;
import com.solution.system.service.ITemplateparameterdefService;
import com.solution.web.controller.behaviour.vo.NodetemplateDTO;
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.system.domain.Nodetemplate;
import com.solution.system.service.INodetemplateService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 节点模板Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@Api("节点模板管理")
@RestController
@RequestMapping("/api/system/nodetemplate")
public class NodetemplateController extends BaseController {
@Autowired
private INodetemplateService nodetemplateService;
@Autowired
private INodeparameterService nodeparameterService;
@Autowired
private ITemplateparameterdefService templateparameterdefService;
/**
* 查询节点模板列表
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
@GetMapping("/list")
public TableDataInfo list(Nodetemplate nodetemplate) {
startPage();
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
return getDataTable(list);
}
@ApiOperation("节点模板列表")
@PreAuthorize("@ss.hasPermi('system:nodetemplate:all')")
@GetMapping("/all")
public R<List<NodeTemplateEntity>> all() {
Nodetemplate nodetemplate = new Nodetemplate();
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
if (CollectionUtils.isEmpty(list)) {
return R.ok(null);
}
List<NodeTemplateEntity> entities = new ArrayList<>();
for (Nodetemplate template : list) {
Templateparameterdef def = new Templateparameterdef();
def.setTemplateId(template.getId());
List<Templateparameterdef> parameters = templateparameterdefService.selectTemplateparameterdefList(def);
entities.add(new NodeTemplateEntity(template, parameters));
}
return R.ok(entities);
}
@ApiOperation("节点模板列表")
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
@GetMapping("/listAll")
public R<List<Nodetemplate>> listAll() {
Nodetemplate nodetemplate = new Nodetemplate();
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
if (CollectionUtils.isEmpty(list)) {
return R.ok(null);
}
Map<String, List<NodetemplateDTO>> groupedByTemplateType = list.stream()
.map(template -> {
NodetemplateDTO dto = new NodetemplateDTO();
dto.setId(template.getId());
dto.setName(template.getName());
dto.setDescription(template.getDescription());
dto.setEnglishName(template.getEnglishName());
dto.setLogicHandler(template.getLogicHandler());
dto.setTemplateType(template.getTemplateType());
return dto;
})
.collect(Collectors.groupingBy(NodetemplateDTO::getTemplateType));
List<NodetemplateVO> vos = new ArrayList<>();
groupedByTemplateType.forEach((key, value) -> {
// 处理逻辑
NodetemplateVO vo = new NodetemplateVO();
vo.setTemplateType(key);
vo.setDtoList(value);
vos.add(vo);
});
return R.ok(list);
}
/**
* 导出节点模板列表
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:export')")
@Log(title = "节点模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Nodetemplate nodetemplate) {
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
ExcelUtil<Nodetemplate> util = new ExcelUtil<Nodetemplate>(Nodetemplate.class);
util.exportExcel(response, list, "节点模板数据");
}
/**
* 获取节点模板详细信息
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(nodetemplateService.selectNodetemplateById(id));
}
/**
* 新增节点模板
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:add')")
@Log(title = "节点模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Nodetemplate nodetemplate) {
return toAjax(nodetemplateService.insertNodetemplate(nodetemplate));
}
/**
* 修改节点模板
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:edit')")
@Log(title = "节点模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Nodetemplate nodetemplate) {
return toAjax(nodetemplateService.updateNodetemplate(nodetemplate));
}
/**
* 删除节点模板
*/
@PreAuthorize("@ss.hasPermi('system:nodetemplate:remove')")
@Log(title = "节点模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(nodetemplateService.deleteNodetemplateByIds(ids));
}
}

View File

@@ -0,0 +1,104 @@
package com.solution.web.controller.behaviour;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.system.domain.Templateparameterdef;
import com.solution.system.service.ITemplateparameterdefService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 模板参数定义Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@RestController
@RequestMapping("/api/system/templateparameterdef")
public class TemplateparameterdefController extends BaseController
{
@Autowired
private ITemplateparameterdefService templateparameterdefService;
/**
* 查询模板参数定义列表
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:list')")
@GetMapping("/list")
public TableDataInfo list(Templateparameterdef templateparameterdef)
{
startPage();
List<Templateparameterdef> list = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
return getDataTable(list);
}
/**
* 导出模板参数定义列表
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:export')")
@Log(title = "模板参数定义", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Templateparameterdef templateparameterdef)
{
List<Templateparameterdef> list = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
ExcelUtil<Templateparameterdef> util = new ExcelUtil<Templateparameterdef>(Templateparameterdef.class);
util.exportExcel(response, list, "模板参数定义数据");
}
/**
* 获取模板参数定义详细信息
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(templateparameterdefService.selectTemplateparameterdefById(id));
}
/**
* 新增模板参数定义
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:add')")
@Log(title = "模板参数定义", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Templateparameterdef templateparameterdef)
{
return toAjax(templateparameterdefService.insertTemplateparameterdef(templateparameterdef));
}
/**
* 修改模板参数定义
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:edit')")
@Log(title = "模板参数定义", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Templateparameterdef templateparameterdef)
{
return toAjax(templateparameterdefService.updateTemplateparameterdef(templateparameterdef));
}
/**
* 删除模板参数定义
*/
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:remove')")
@Log(title = "模板参数定义", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(templateparameterdefService.deleteTemplateparameterdefByIds(ids));
}
}

View File

@@ -0,0 +1,207 @@
package com.solution.web.controller.behaviour;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.solution.common.core.domain.R;
import com.solution.system.domain.Nodeparameter;
import com.solution.system.domain.Templateparameterdef;
import com.solution.system.service.INodeparameterService;
import com.solution.system.service.ITemplateparameterdefService;
import com.solution.web.controller.behaviour.vo.NodeparameterVO;
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
import com.solution.web.controller.behaviour.vo.TreenodeinstanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.system.domain.Treenodeinstance;
import com.solution.system.service.ITreenodeinstanceService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 行为树实例节点Controller
*
* @author ruoyi
* @date 2026-02-05
*/
@Api("行为树实例节点管理")
@RestController
@RequestMapping("/api/system/treenodeinstance")
public class TreenodeinstanceController extends BaseController {
@Autowired
private ITreenodeinstanceService treenodeinstanceService;
@Autowired
private INodeparameterService nodeparameterService;
@Autowired
private ITemplateparameterdefService templateparameterdefService;
/**
* 查询行为树实例节点列表
*/
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:list')")
@GetMapping("/list")
public TableDataInfo list(Treenodeinstance treenodeinstance) {
startPage();
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
return getDataTable(list);
}
/**
* 导出行为树实例节点列表
*/
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:export')")
@Log(title = "行为树实例节点", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Treenodeinstance treenodeinstance) {
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
ExcelUtil<Treenodeinstance> util = new ExcelUtil<Treenodeinstance>(Treenodeinstance.class);
util.exportExcel(response, list, "行为树实例节点数据");
}
/**
* 获取行为树实例节点详细信息
*/
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(treenodeinstanceService.selectTreenodeinstanceById(id));
}
@ApiOperation("行为树实例节点详情展示")
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
@GetMapping(value = "/getInfo")
public R<TreenodeinstanceVO> getInfoParams(@PathVariable("id") Long id) {
TreenodeinstanceVO treenodeinstanceVO = new TreenodeinstanceVO();
Treenodeinstance treenodeinstance = treenodeinstanceService.selectTreenodeinstanceById(id);
BeanUtils.copyProperties(treenodeinstance, treenodeinstanceVO);
Templateparameterdef templateparameterdef = new Templateparameterdef();
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
if (CollectionUtils.isEmpty(templateparameterdefs)) {
return R.ok(treenodeinstanceVO);
}
List<NodeparameterVO> nodeparameterVOList = new ArrayList<>();
treenodeinstanceVO.setNodeparameterVOList(nodeparameterVOList);
Nodeparameter nodeparameter = new Nodeparameter();
nodeparameter.setNodeInstanceId(id);
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
Map<Long, Nodeparameter> nodeParameterMap = new HashMap<>();
if (!CollectionUtils.isEmpty(nodeparameters)) {
nodeParameterMap.putAll(nodeparameters.stream()
.collect(Collectors.toMap(
Nodeparameter::getParamDefId,
Function.identity(), (existing, replacement) -> existing
)));
}
templateparameterdefs.forEach(t -> {
NodeparameterVO vo = new NodeparameterVO();
vo.setDescription(t.getDescription());
vo.setParamKey(t.getParamKey());
vo.setDataType(t.getDataType());
vo.setDefaultValue(t.getDefaultValue());
vo.setParamDefId(t.getId());
vo.setNodeInstanceId(id);
if (nodeParameterMap.containsKey(t.getId())) {
Nodeparameter nodeparameter1 = nodeParameterMap.get(t.getId());
vo.setId(nodeparameter1.getId());
vo.setValue(nodeparameter1.getValue());
}
nodeparameterVOList.add(vo);
});
return R.ok(treenodeinstanceVO);
}
@ApiOperation("行为树实例节点保存或者跟新")
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
@PostMapping("/saveOrUpdate")
public R<Long> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
if (null == treenodeinstance.getId()) {
//新增
treenodeinstanceService.insertTreenodeinstance(treenodeinstance);
Templateparameterdef templateparameterdef = new Templateparameterdef();
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
if (CollectionUtils.isEmpty(templateparameterdefs)) {
return R.ok(treenodeinstance.getId());
}
templateparameterdefs.forEach(t -> {
Nodeparameter nodeparameter = new Nodeparameter();
nodeparameter.setNodeInstanceId(treenodeinstance.getId());
nodeparameter.setParamDefId(t.getId());
nodeparameter.setValue(t.getDefaultValue());
nodeparameterService.insertNodeparameter(nodeparameter);
});
}
treenodeinstanceService.updateTreenodeinstance(treenodeinstance);
return R.ok(treenodeinstance.getId());
}
/**
* 新增行为树实例节点
*/
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Treenodeinstance treenodeinstance) {
return toAjax(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
}
/**
* 修改行为树实例节点
*/
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:edit')")
@Log(title = "行为树实例节点", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Treenodeinstance treenodeinstance) {
return toAjax(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
}
/**
* 删除行为树实例节点
*/
@ApiOperation("删除行为树实例节点")
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:remove')")
@Log(title = "行为树实例节点", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public R<Integer> remove(@PathVariable Long id) {
Nodeparameter nodeparameter = new Nodeparameter();
nodeparameter.setNodeInstanceId(id);
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
if (!CollectionUtils.isEmpty(nodeparameters)) {
List<Long> ids = nodeparameters.stream()
.map(Nodeparameter::getId)
.collect(Collectors.toList());
Long[] idsArray = ids.toArray(new Long[0]);
nodeparameterService.deleteNodeparameterByIds(idsArray);
}
return R.ok(treenodeinstanceService.deleteTreenodeinstanceById(id));
}
}

View File

@@ -0,0 +1,52 @@
package com.solution.web.controller.behaviour.vo;
import io.swagger.annotations.ApiModelProperty;
public class BehaviortreeVO {
private Long id;
/** 行为树名称 */
@ApiModelProperty(name = "行为树名称")
private String name;
/** 行为树描述 */
@ApiModelProperty(name = "行为树描述")
private String description;
@ApiModelProperty(name = "英文名称")
private String englishName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getEnglishName() {
return englishName;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
}

View File

@@ -0,0 +1,100 @@
package com.solution.web.controller.behaviour.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "NodeparameterVO", description = "节点参数vo")
public class NodeparameterVO {
private Long id;
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
@ApiModelProperty("节点实例id")
private Long nodeInstanceId;
/** 关联到哪个参数定义 (外键: TemplateParameterDef.id) */
@ApiModelProperty("模板参数定义表id")
private Long paramDefId;
/** 节点实例设置的具体参数值 (覆盖模板默认值) */
@ApiModelProperty("节点实例设置的具体参数值 (覆盖模板默认值)")
private String value;
@ApiModelProperty("参数键名, 例如: target_name, speed")
private String paramKey;
/** 参数数据类型, 例如: "float", "int", "string", "bool" */
@ApiModelProperty("参数数据类型, 例如: float, int, string, bool")
private String dataType;
/** 默认值 */
@ApiModelProperty("默认值")
private String defaultValue;
@ApiModelProperty("参数名称描述")
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getNodeInstanceId() {
return nodeInstanceId;
}
public void setNodeInstanceId(Long nodeInstanceId) {
this.nodeInstanceId = nodeInstanceId;
}
public Long getParamDefId() {
return paramDefId;
}
public void setParamDefId(Long paramDefId) {
this.paramDefId = paramDefId;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getParamKey() {
return paramKey;
}
public void setParamKey(String paramKey) {
this.paramKey = paramKey;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@@ -0,0 +1,75 @@
package com.solution.web.controller.behaviour.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "NodetemplateDTO", description = "节点模板dto")
public class NodetemplateDTO {
private Long id;
/** 模板名称, 例如: "MoveToTarget", "IsTargetVisible" */
@ApiModelProperty("模板名称, 例如: MoveToTarget, IsTargetVisible")
private String name;
/** 对应的逻辑执行代码/脚本/函数名 */
@ApiModelProperty("对应的逻辑执行代码/脚本/函数名")
private String logicHandler;
/** 模板描述 */
@ApiModelProperty("模板描述")
private String description;
/** afsim 中转换的节点名 */
@ApiModelProperty("afsim 中转换的节点名")
private String englishName;
private String templateType;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogicHandler() {
return logicHandler;
}
public void setLogicHandler(String logicHandler) {
this.logicHandler = logicHandler;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getEnglishName() {
return englishName;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
public String getTemplateType() {
return templateType;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
}

View File

@@ -0,0 +1,32 @@
package com.solution.web.controller.behaviour.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "NodetemplateVO", description = "节点模板vo")
public class NodetemplateVO {
/** 模版类型节点模版或者条件判断例如“node”precondition“ */
@ApiModelProperty("模版类型节点模版或者条件判断例如“node”precondition“")
private String templateType;
@ApiModelProperty("节点模板数据")
private List<NodetemplateDTO> dtoList;
public String getTemplateType() {
return templateType;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
public List<NodetemplateDTO> getDtoList() {
return dtoList;
}
public void setDtoList(List<NodetemplateDTO> dtoList) {
this.dtoList = dtoList;
}
}

View File

@@ -0,0 +1,87 @@
package com.solution.web.controller.behaviour.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "TreenodeinstanceVO", description = "节点vo")
public class TreenodeinstanceVO {
private Long id;
@ApiModelProperty("行为树id")
private Long treeId;
/** 引用哪个节点模板 (外键: NodeTemplate.id) */
@ApiModelProperty("节点模板id")
private Long templateId;
/** 节点的显示名称 (可能与模板名称不同, 用于区分实例) */
@ApiModelProperty("节点的显示名称")
private String instanceName;
/** 判断当前节点是否为根节点,默认情况下是非根节点 */
@ApiModelProperty("判断当前节点是否为根节点,默认情况下是非根节点")
private Long isRoot;
@ApiModelProperty("节点介绍")
private String desciption;
@ApiModelProperty("节点变量结合")
private List<NodeparameterVO> nodeparameterVOList;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTreeId() {
return treeId;
}
public void setTreeId(Long treeId) {
this.treeId = treeId;
}
public Long getTemplateId() {
return templateId;
}
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public Long getIsRoot() {
return isRoot;
}
public void setIsRoot(Long isRoot) {
this.isRoot = isRoot;
}
public String getDesciption() {
return desciption;
}
public void setDesciption(String desciption) {
this.desciption = desciption;
}
public List<NodeparameterVO> getNodeparameterVOList() {
return nodeparameterVOList;
}
public void setNodeparameterVOList(List<NodeparameterVO> nodeparameterVOList) {
this.nodeparameterVOList = nodeparameterVOList;
}
}

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -24,15 +25,15 @@ import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法
*
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
public class TestController extends BaseController {
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
@@ -40,8 +41,7 @@ public class TestController extends BaseController
@ApiOperation("获取用户列表")
@GetMapping("/list")
public R<List<UserEntity>> userList()
{
public R<List<UserEntity>> userList() {
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return R.ok(userList);
}
@@ -49,30 +49,24 @@ public class TestController extends BaseController
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
public R<UserEntity> getUser(@PathVariable Integer userId) {
if (!users.isEmpty() && users.containsKey(userId)) {
return R.ok(users.get(userId));
}
else
{
} else {
return R.fail("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public R<String> save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
public R<String> save(UserEntity user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
return R.fail("用户ID不能为空");
}
users.put(user.getUserId(), user);
@@ -81,14 +75,11 @@ public class TestController extends BaseController
@ApiOperation("更新用户")
@PutMapping("/update")
public R<String> update(@RequestBody UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
public R<String> update(@RequestBody UserEntity user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
return R.fail("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
if (users.isEmpty() || !users.containsKey(user.getUserId())) {
return R.fail("用户不存在");
}
users.remove(user.getUserId());
@@ -99,23 +90,18 @@ public class TestController extends BaseController
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public R<String> delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
public R<String> delete(@PathVariable Integer userId) {
if (!users.isEmpty() && users.containsKey(userId)) {
users.remove(userId);
return R.ok();
}
else
{
} else {
return R.fail("用户不存在");
}
}
}
@ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity
{
class UserEntity {
@ApiModelProperty("用户ID")
private Integer userId;
@@ -128,56 +114,46 @@ class UserEntity
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
public UserEntity() {
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
public UserEntity(Integer userId, String username, String password, String mobile) {
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId)
{
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUsername()
{
public String getUsername() {
return username;
}
public void setUsername(String username)
{
public void setUsername(String username) {
this.username = username;
}
public String getPassword()
{
public String getPassword() {
return password;
}
public void setPassword(String password)
{
public void setPassword(String password) {
this.password = password;
}
public String getMobile()
{
public String getMobile() {
return mobile;
}
public void setMobile(String mobile)
{
public void setMobile(String mobile) {
this.mobile = mobile;
}
}

View File

@@ -0,0 +1,160 @@
package com.solution.web.core;
/*
* 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.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.solution.system.domain.*;
import com.solution.system.service.IBehaviortreeService;
import com.solution.system.service.INodeconnectionService;
import com.solution.system.service.INodeparameterService;
import com.solution.system.service.ITreenodeinstanceService;
import com.solution.web.core.graph.Graph;
import com.solution.web.core.graph.GraphEdge;
import com.solution.web.core.graph.GraphNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class BehaviortreeProcessor {
@Autowired
private IBehaviortreeService behaviortreeService;
@Autowired
private ITreenodeinstanceService treenodeinstanceService;
@Autowired
private INodeparameterService nodeparameterService;
@Autowired
private INodeconnectionService nodeconnectionService;
private ObjectMapper objectMapper = createObjectMapper();
public static ObjectMapper createObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
public int create(Behaviortree behaviortree) {
int result = behaviortreeService.insertBehaviortree(behaviortree);
processGraph(behaviortree);
return result;
}
public int update(Behaviortree behaviortree) {
int result = behaviortreeService.updateBehaviortree(behaviortree);
// 删除节点实例
treenodeinstanceService.deleteByTreeId(behaviortree.getId());
// 删除参数
nodeparameterService.deleteByTreeId(behaviortree.getId());
// 删除连线
nodeconnectionService.deleteByTreeId(behaviortree.getId());
processGraph(behaviortree);
return result;
}
private void processGraph(Behaviortree behaviortree) {
Graph graph = null;
try {
graph = objectMapper.readValue(behaviortree.getXmlContent(), Graph.class);
} catch (Exception e) {
// skip
e.printStackTrace();
}
if (null == graph) {
return;
}
// 插入节点 treenodeinstance
Map<String, Treenodeinstance> instanceKeyMap = new HashMap<>();
Map<String, Long> nodeKeyIndexMap = new HashMap<>();
if (graph.hasNodes()) {
Long index = 0L;
for (GraphNode node : graph.getNodes()) {
Treenodeinstance instance = createNodeInstance(behaviortree, node);
treenodeinstanceService.insertTreenodeinstance(instance);
instanceKeyMap.put(node.getKey(), instance);
if (node.hasParameters()) {
// 插入parameter nodeparameter
for (Templateparameterdef parameter : node.getParameters()) {
Nodeparameter nodeparameter = createNodeParameter(behaviortree, parameter, instance);
nodeparameterService.insertNodeparameter(nodeparameter);
}
}
nodeKeyIndexMap.put(node.getKey(), index);
index++;
}
}
// 插入连线 nodeconnection
if (graph.hasEdges()) {
for (GraphEdge edge : graph.getEdges()) {
Nodeconnection connection = createConnection(behaviortree, edge, instanceKeyMap, nodeKeyIndexMap);
nodeconnectionService.insertNodeconnection(connection);
}
}
}
private Nodeconnection createConnection(Behaviortree behaviortree, GraphEdge edge,
Map<String, Treenodeinstance> instanceKeyMap,
Map<String, Long> nodeKeyIndexMap) {
Nodeconnection connection = new Nodeconnection();
connection.setTreeId(behaviortree.getId());
if (null != instanceKeyMap.get(edge.getSource().getCell())) {
Treenodeinstance parent = instanceKeyMap.get(edge.getSource().getCell());
connection.setParentNodeId(parent.getId());
}
if (null != instanceKeyMap.get(edge.getTarget().getCell())) {
Treenodeinstance children = instanceKeyMap.get(edge.getTarget().getCell());
connection.setChildNodeId(children.getId());
}
if (null != nodeKeyIndexMap.get(edge.getSource().getCell())) {
connection.setOrderIndex(nodeKeyIndexMap.get(edge.getSource().getCell()));
}
return connection;
}
private Nodeparameter createNodeParameter(Behaviortree behaviortree, Templateparameterdef parameter,
Treenodeinstance instance) {
Nodeparameter nodeparameter = new Nodeparameter();
nodeparameter.setTreeId(behaviortree.getId());
nodeparameter.setNodeInstanceId(instance.getId());
nodeparameter.setParamDefId(parameter.getId());
nodeparameter.setValue(parameter.getDefaultValue());
return nodeparameter;
}
private Treenodeinstance createNodeInstance(Behaviortree behaviortree, GraphNode node) {
Treenodeinstance instance = new Treenodeinstance();
instance.setTreeId(behaviortree.getId());
instance.setTemplateId((long) node.getTemplate());
instance.setInstanceName(node.getName());
instance.setIsRoot((long) (node.isRoot() ? 1 : 0));
if ("precondition".equalsIgnoreCase(node.getTemplateType())) {
instance.setPreconditionTempleteId((long) node.getTemplate());
}
return instance;
}
}

View File

@@ -0,0 +1,52 @@
package com.solution.web.core.graph;
/*
* 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;
import java.util.List;
public class Graph implements Serializable {
private List<GraphNode> nodes;
private List<GraphEdge> edges;
public boolean hasNodes() {
return nodes != null && !nodes.isEmpty();
}
public boolean hasEdges() {
return edges != null && !edges.isEmpty();
}
@Override
public String toString() {
return "Graph{" +
"nodes=" + nodes +
", edges=" + edges +
'}';
}
public List<GraphNode> getNodes() {
return nodes;
}
public void setNodes(List<GraphNode> nodes) {
this.nodes = nodes;
}
public List<GraphEdge> getEdges() {
return edges;
}
public void setEdges(List<GraphEdge> edges) {
this.edges = edges;
}
}

View File

@@ -0,0 +1,85 @@
package com.solution.web.core.graph;
/*
* 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 org.springframework.util.StringUtils;
import java.io.Serializable;
public class GraphEdge implements Serializable {
private String key;
private Line source;
private Line target;
public boolean hasSource() {
return source != null && StringUtils.hasText(source.cell);
}
public boolean hasTarget() {
return target != null && StringUtils.hasText(target.cell);
}
public static class Line implements Serializable {
private String cell;
@Override
public String toString() {
return "Line{" +
"cell='" + cell + '\'' +
'}';
}
public String getCell() {
return cell;
}
public void setCell(String cell) {
this.cell = cell;
}
}
@Override
public String toString() {
return "GraphEdge{" +
"key='" + key + '\'' +
", source='" + source + '\'' +
", target='" + target + '\'' +
'}';
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public Line getSource() {
return source;
}
public void setSource(Line source) {
this.source = source;
}
public Line getTarget() {
return target;
}
public void setTarget(Line target) {
this.target = target;
}
}

View File

@@ -0,0 +1,142 @@
package com.solution.web.core.graph;
/*
* 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.Templateparameterdef;
import java.io.Serializable;
import java.util.List;
public class GraphNode implements Serializable {
private int id;
private int template;
private String templateType;
private String type;
private String key;
private String name;
private String description;
private String category;
private List<Templateparameterdef> parameters;
private List<GraphVariable> variables;
public boolean hasParameters() {
return parameters != null && !parameters.isEmpty();
}
public boolean hasVariables() {
return variables != null && !variables.isEmpty();
}
public boolean isRoot() {
return "root".equalsIgnoreCase(this.category);
}
@Override
public String toString() {
return "GraphNode{" +
"id=" + id +
", key='" + key + '\'' +
", name='" + name + '\'' +
", description='" + description + '\'' +
", parameters=" + parameters +
", variables=" + variables +
'}';
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getTemplateType() {
return templateType;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getTemplate() {
return template;
}
public void setTemplate(int template) {
this.template = template;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Templateparameterdef> getParameters() {
return parameters;
}
public void setParameters(List<Templateparameterdef> parameters) {
this.parameters = parameters;
}
public List<GraphVariable> getVariables() {
return variables;
}
public void setVariables(List<GraphVariable> variables) {
this.variables = variables;
}
}

View File

@@ -0,0 +1,65 @@
package com.solution.web.core.graph;
/*
* 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 GraphVariable implements Serializable {
private String key;
private String value;
private String defaults;
private String unit;
@Override
public String toString() {
return "GraphVariable{" +
"key='" + key + '\'' +
", value='" + value + '\'' +
", defaults='" + defaults + '\'' +
", unit='" + unit + '\'' +
'}';
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDefaults() {
return defaults;
}
public void setDefaults(String defaults) {
this.defaults = defaults;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}

View File

@@ -0,0 +1,89 @@
package com.solution.algo;
/*
* 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.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.solution.algo.domain.AlgorithmConfig;
import org.apache.ibatis.type.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@Component
@MappedTypes(List.class)
@MappedJdbcTypes({
JdbcType.VARCHAR,
JdbcType.BLOB
})
public class AlgorithmConfigTypeHandler extends BaseTypeHandler<List<AlgorithmConfig>>
implements TypeHandler<List<AlgorithmConfig>> {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final ObjectMapper objectMapper = new ObjectMapper();
private final CollectionType collectionType = objectMapper.getTypeFactory()
.constructCollectionType(List.class, AlgorithmConfig.class);
@Override
public void setNonNullParameter(PreparedStatement ps, int i, List<AlgorithmConfig> parameter, JdbcType jdbcType)
throws SQLException {
ps.setString(i, serialize(parameter));
}
public String serialize(List<AlgorithmConfig> indicatorConfig) {
if (null != indicatorConfig) {
try {
return objectMapper.writeValueAsString(indicatorConfig);
} catch (Exception e) {
logger.error("Can not serialize", e);
}
}
return null;
}
public List<AlgorithmConfig> deserialize(String config) throws SQLException {
if (StringUtils.hasText(config)) {
try {
return objectMapper.readValue(config, collectionType);
} catch (Exception e) {
logger.error("Can not deserialize", e);
}
}
return new ArrayList<>();
}
@Override
public List<AlgorithmConfig> getNullableResult(ResultSet rs, String columnName) throws SQLException {
String jsonValue = rs.getString(columnName);
return deserialize(jsonValue);
}
@Override
public List<AlgorithmConfig> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String jsonValue = rs.getString(columnIndex);
return deserialize(jsonValue);
}
@Override
public List<AlgorithmConfig> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String jsonValue = cs.getString(columnIndex);
return deserialize(jsonValue);
}
}

View File

@@ -34,6 +34,13 @@ public class Algorithm
@Excel(name = "算法描述")
private String description;
/** 算法配置 */
@Excel(name = "算法配置")
private String algoConfig;
/** 算法配置 */
private List<AlgorithmConfig> algoConfigList;
/** 算法参数定义信息 */
private List<AlgorithmParam> algorithmParamList;
@@ -87,6 +94,16 @@ public class Algorithm
return description;
}
public void setAlgoConfig(String algoConfig)
{
this.algoConfig = algoConfig;
}
public String getAlgoConfig()
{
return algoConfig;
}
public List<AlgorithmParam> getAlgorithmParamList()
{
return algorithmParamList;
@@ -97,6 +114,14 @@ public class Algorithm
this.algorithmParamList = algorithmParamList;
}
public List<AlgorithmConfig> getAlgoConfigList() {
return algoConfigList;
}
public void setAlgoConfigList(List<AlgorithmConfig> algoConfigList) {
this.algoConfigList = algoConfigList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -105,6 +130,7 @@ public class Algorithm
.append("type", getType())
.append("codePath", getCodePath())
.append("description", getDescription())
.append("algoConfig", getAlgoConfig())
.append("algorithmParamList", getAlgorithmParamList())
.toString();
}

View File

@@ -0,0 +1,35 @@
package com.solution.algo.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 AlgorithmConfig implements Serializable {
private String name;
private String operation;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
}

View File

@@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" />
<result property="codePath" column="code_path" />
<result property="description" column="description" />
<result property="algoConfig" column="algo_config" />
<result property="algoConfigList" column="algo_config_list" typeHandler="com.solution.algo.AlgorithmConfigTypeHandler" />
</resultMap>
<resultMap id="AlgorithmAlgorithmParamResult" type="Algorithm" extends="AlgorithmResult">
@@ -25,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAlgorithmVo">
select id, name, type, code_path, description from algorithm
select id, name, type, code_path, description, algo_config, algo_config_list from algorithm
</sql>
<select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmAlgorithmParamResult">
@@ -35,11 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="codePath != null and codePath != ''"> and code_path = #{codePath}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="algoConfig != null and algoConfig != ''"> and algo_config = #{algoConfig}</if>
</where>
</select>
<select id="selectAlgorithmById" parameterType="Long" resultMap="AlgorithmAlgorithmParamResult">
select id, name, type, code_path, description
select id, name, type, code_path, description, algo_config
from algorithm
where id = #{id}
</select>
@@ -57,12 +60,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''">type,</if>
<if test="codePath != null">code_path,</if>
<if test="description != null">description,</if>
<if test="algoConfig != null">algo_config,</if>
<if test="algoConfigList != null">algo_config_list,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="codePath != null">#{codePath},</if>
<if test="description != null">#{description},</if>
<if test="algoConfig != null">#{algoConfig},</if>
<if test="algoConfigList != null">#{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
</trim>
</insert>
@@ -73,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''">type = #{type},</if>
<if test="codePath != null">code_path = #{codePath},</if>
<if test="description != null">description = #{description},</if>
<if test="algoConfig != null">algo_config = #{algoConfig},</if>
<if test="algoConfigList != null">algo_config_list = #{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
</trim>
where id = #{id}
</update>

View File

@@ -0,0 +1,131 @@
package com.solution.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 行为树主对象 behaviortree
*
* @author ruoyi
* @date 2026-02-05
*/
public class Behaviortree extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 行为树ID (主键) */
private Long id;
/** 行为树名称 */
@Excel(name = "行为树名称")
private String name;
/** 行为树描述 */
@Excel(name = "行为树描述")
private String description;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String englishName;
/** 储存行为树的节点关系图 */
@Excel(name = "储存行为树的节点关系图")
private String xmlContent;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setEnglishName(String englishName)
{
this.englishName = englishName;
}
public String getEnglishName()
{
return englishName;
}
public void setXmlContent(String xmlContent)
{
this.xmlContent = xmlContent;
}
public String getXmlContent()
{
return xmlContent;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("description", getDescription())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.append("englishName", getEnglishName())
.append("xmlContent", getXmlContent())
.toString();
}
}

View File

@@ -0,0 +1,43 @@
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.util.ArrayList;
import java.util.List;
public class NodeTemplateEntity extends Nodetemplate {
private List<Templateparameterdef> parameters = new ArrayList<>();
public NodeTemplateEntity() {
}
public NodeTemplateEntity(List<Templateparameterdef> parameters) {
this.parameters = parameters;
}
public NodeTemplateEntity(NodeTemplateEntity entity) {
super(entity);
this.parameters = entity.getParameters();
}
public NodeTemplateEntity(Nodetemplate entity, List<Templateparameterdef> parameters) {
super(entity);
this.parameters = parameters;
}
public List<Templateparameterdef> getParameters() {
return parameters;
}
public void setParameters(List<Templateparameterdef> parameters) {
this.parameters = parameters;
}
}

View File

@@ -0,0 +1,92 @@
package com.solution.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 节点连接对象 nodeconnection
*
* @author ruoyi
* @date 2026-02-05
*/
public class Nodeconnection extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 连接ID (主键) */
private Long id;
private Long treeId;
/** 父节点 (外键: TreeInstanceNode.id) */
@Excel(name = "父节点 (外键: TreeInstanceNode.id)")
private Long parentNodeId;
/** 子节点 (外键: TreeInstanceNode.id) */
@Excel(name = "子节点 (外键: TreeInstanceNode.id)")
private Long childNodeId;
/** 子节点在父节点下的执行顺序 (对于 Sequence/Selector 等很重要) */
@Excel(name = "子节点在父节点下的执行顺序 (对于 Sequence/Selector 等很重要)")
private Long orderIndex;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public Long getTreeId() {
return treeId;
}
public void setTreeId(Long treeId) {
this.treeId = treeId;
}
public void setParentNodeId(Long parentNodeId)
{
this.parentNodeId = parentNodeId;
}
public Long getParentNodeId()
{
return parentNodeId;
}
public void setChildNodeId(Long childNodeId)
{
this.childNodeId = childNodeId;
}
public Long getChildNodeId()
{
return childNodeId;
}
public void setOrderIndex(Long orderIndex)
{
this.orderIndex = orderIndex;
}
public Long getOrderIndex()
{
return orderIndex;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentNodeId", getParentNodeId())
.append("childNodeId", getChildNodeId())
.append("orderIndex", getOrderIndex())
.toString();
}
}

View File

@@ -0,0 +1,92 @@
package com.solution.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 节点参数对象 nodeparameter
*
* @author ruoyi
* @date 2026-02-05
*/
public class Nodeparameter extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 节点参数ID (主键) */
private Long id;
private Long treeId;
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
@Excel(name = "关联到哪个节点实例 (外键: TreeInstanceNode.id)")
private Long nodeInstanceId;
/** 关联到哪个参数定义 (外键: TemplateParameterDef.id) */
@Excel(name = "关联到哪个参数定义 (外键: TemplateParameterDef.id)")
private Long paramDefId;
/** 节点实例设置的具体参数值 (覆盖模板默认值) */
@Excel(name = "节点实例设置的具体参数值 (覆盖模板默认值)")
private String value;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public Long getTreeId() {
return treeId;
}
public void setTreeId(Long treeId) {
this.treeId = treeId;
}
public void setNodeInstanceId(Long nodeInstanceId)
{
this.nodeInstanceId = nodeInstanceId;
}
public Long getNodeInstanceId()
{
return nodeInstanceId;
}
public void setParamDefId(Long paramDefId)
{
this.paramDefId = paramDefId;
}
public Long getParamDefId()
{
return paramDefId;
}
public void setValue(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeInstanceId", getNodeInstanceId())
.append("paramDefId", getParamDefId())
.append("value", getValue())
.toString();
}
}

View File

@@ -0,0 +1,140 @@
package com.solution.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 节点模板对象 nodetemplate
*
* @author ruoyi
* @date 2026-02-05
*/
public class Nodetemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 节点模板ID (主键) */
private Long id;
/** 节点类型: "Selector", "Sequence", "Action", "Condition", "Decorator" 等 */
@Excel(name = "节点类型: Selector, Sequence, Action, Condition, Decorator等")
private String type;
/** 模板名称, 例如: "MoveToTarget", "IsTargetVisible" */
@Excel(name = "模板名称, 例如: MoveToTarget, IsTargetVisible")
private String name;
/** 对应的逻辑执行代码/脚本/函数名 */
@Excel(name = "对应的逻辑执行代码/脚本/函数名")
private String logicHandler;
/** 模板描述 */
@Excel(name = "模板描述")
private String description;
/** afsim 中转换的节点名 */
@Excel(name = "afsim 中转换的节点名")
private String englishName;
/** 模版类型节点模版或者条件判断例如“node”precondition“ */
@Excel(name = "模版类型节点模版或者条件判断例如“node”precondition“")
private String templateType;
public Nodetemplate() {
}
public Nodetemplate(Nodetemplate template) {
this.id = template.id;
this.type = template.type;
this.name = template.name;
this.logicHandler = template.logicHandler;
this.description = template.description;
this.englishName = template.englishName;
this.templateType = template.templateType;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setLogicHandler(String logicHandler)
{
this.logicHandler = logicHandler;
}
public String getLogicHandler()
{
return logicHandler;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setEnglishName(String englishName)
{
this.englishName = englishName;
}
public String getEnglishName()
{
return englishName;
}
public void setTemplateType(String templateType)
{
this.templateType = templateType;
}
public String getTemplateType()
{
return templateType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("type", getType())
.append("name", getName())
.append("logicHandler", getLogicHandler())
.append("description", getDescription())
.append("englishName", getEnglishName())
.append("templateType", getTemplateType())
.toString();
}
}

View File

@@ -0,0 +1,127 @@
package com.solution.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 模板参数定义对象 templateparameterdef
*
* @author ruoyi
* @date 2026-02-05
*/
public class Templateparameterdef extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数定义ID (主键) */
private Long id;
/** 关联到哪个节点模板 (外键: NodeTemplate.id) */
@Excel(name = "关联到哪个节点模板 (外键: NodeTemplate.id)")
private Long templateId;
/** 参数键名, 例如: "target_name", "speed" */
@Excel(name = "参数键名, 例如: target_name, speed")
private String paramKey;
/** 参数数据类型, 例如: "float", "int", "string", "bool" */
@Excel(name = "参数数据类型, 例如: float, int, string, bool")
private String dataType;
/** 默认值 */
@Excel(name = "默认值")
private String defaultValue;
/** 参数描述 */
@Excel(name = "参数描述")
private String description;
/** 判断参数模版是节点的参数模版还是条件的参数模版 */
@Excel(name = "判断参数模版是节点的参数模版还是条件的参数模版")
private String templateType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTemplateId(Long templateId)
{
this.templateId = templateId;
}
public Long getTemplateId()
{
return templateId;
}
public void setParamKey(String paramKey)
{
this.paramKey = paramKey;
}
public String getParamKey()
{
return paramKey;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getDataType()
{
return dataType;
}
public void setDefaultValue(String defaultValue)
{
this.defaultValue = defaultValue;
}
public String getDefaultValue()
{
return defaultValue;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setTemplateType(String templateType)
{
this.templateType = templateType;
}
public String getTemplateType()
{
return templateType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("templateId", getTemplateId())
.append("paramKey", getParamKey())
.append("dataType", getDataType())
.append("defaultValue", getDefaultValue())
.append("description", getDescription())
.append("templateType", getTemplateType())
.toString();
}
}

View File

@@ -0,0 +1,140 @@
package com.solution.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 行为树实例节点对象 treenodeinstance
*
* @author ruoyi
* @date 2026-02-05
*/
public class Treenodeinstance extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 节点实例ID (主键) */
private Long id;
/** 属于哪棵行为树 (外键: BehaviorTree.id) */
@Excel(name = "属于哪棵行为树 (外键: BehaviorTree.id)")
private Long treeId;
/** 引用哪个节点模板 (外键: NodeTemplate.id) */
@Excel(name = "引用哪个节点模板 (外键: NodeTemplate.id)")
private Long templateId;
/** 节点的显示名称 (可能与模板名称不同, 用于区分实例) */
@Excel(name = "节点的显示名称 (可能与模板名称不同, 用于区分实例)")
private String instanceName;
/** 判断当前节点是否为根节点,默认情况下是非根节点 */
@Excel(name = "判断当前节点是否为根节点,默认情况下是非根节点")
private Long isRoot;
/** 节点执行的判断条件对应的模版id */
@Excel(name = "节点执行的判断条件对应的模版id")
private Long preconditionTempleteId;
@Excel(name = "节点介绍")
private String desciption;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String uuid;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTreeId(Long treeId)
{
this.treeId = treeId;
}
public Long getTreeId()
{
return treeId;
}
public void setTemplateId(Long templateId)
{
this.templateId = templateId;
}
public Long getTemplateId()
{
return templateId;
}
public void setInstanceName(String instanceName)
{
this.instanceName = instanceName;
}
public String getInstanceName()
{
return instanceName;
}
public void setIsRoot(Long isRoot)
{
this.isRoot = isRoot;
}
public Long getIsRoot()
{
return isRoot;
}
public void setPreconditionTempleteId(Long preconditionTempleteId)
{
this.preconditionTempleteId = preconditionTempleteId;
}
public Long getPreconditionTempleteId()
{
return preconditionTempleteId;
}
public void setUuid(String uuid)
{
this.uuid = uuid;
}
public String getUuid()
{
return uuid;
}
public String getDesciption() {
return desciption;
}
public void setDesciption(String desciption) {
this.desciption = desciption;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("treeId", getTreeId())
.append("templateId", getTemplateId())
.append("instanceName", getInstanceName())
.append("isRoot", getIsRoot())
.append("preconditionTempleteId", getPreconditionTempleteId())
.append("uuid", getUuid())
.append("desciption", getDesciption())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Behaviortree;
/**
* 行为树主Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface BehaviortreeMapper
{
/**
* 查询行为树主
*
* @param id 行为树主主键
* @return 行为树主
*/
public Behaviortree selectBehaviortreeById(Long id);
/**
* 查询行为树主列表
*
* @param behaviortree 行为树主
* @return 行为树主集合
*/
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree);
/**
* 新增行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
public int insertBehaviortree(Behaviortree behaviortree);
/**
* 修改行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
public int updateBehaviortree(Behaviortree behaviortree);
/**
* 删除行为树主
*
* @param id 行为树主主键
* @return 结果
*/
public int deleteBehaviortreeById(Long id);
/**
* 批量删除行为树主
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBehaviortreeByIds(Long[] ids);
}

View File

@@ -0,0 +1,64 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Nodeconnection;
import org.apache.ibatis.annotations.Param;
/**
* 节点连接Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface NodeconnectionMapper
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点连接
*
* @param id 节点连接主键
* @return 节点连接
*/
public Nodeconnection selectNodeconnectionById(Long id);
/**
* 查询节点连接列表
*
* @param nodeconnection 节点连接
* @return 节点连接集合
*/
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection);
/**
* 新增节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
public int insertNodeconnection(Nodeconnection nodeconnection);
/**
* 修改节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
public int updateNodeconnection(Nodeconnection nodeconnection);
/**
* 删除节点连接
*
* @param id 节点连接主键
* @return 结果
*/
public int deleteNodeconnectionById(Long id);
/**
* 批量删除节点连接
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNodeconnectionByIds(Long[] ids);
}

View File

@@ -0,0 +1,64 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Nodeparameter;
import org.apache.ibatis.annotations.Param;
/**
* 节点参数Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface NodeparameterMapper
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点参数
*
* @param id 节点参数主键
* @return 节点参数
*/
public Nodeparameter selectNodeparameterById(Long id);
/**
* 查询节点参数列表
*
* @param nodeparameter 节点参数
* @return 节点参数集合
*/
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter);
/**
* 新增节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
public int insertNodeparameter(Nodeparameter nodeparameter);
/**
* 修改节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
public int updateNodeparameter(Nodeparameter nodeparameter);
/**
* 删除节点参数
*
* @param id 节点参数主键
* @return 结果
*/
public int deleteNodeparameterById(Long id);
/**
* 批量删除节点参数
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNodeparameterByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Nodetemplate;
/**
* 节点模板Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface NodetemplateMapper
{
/**
* 查询节点模板
*
* @param id 节点模板主键
* @return 节点模板
*/
public Nodetemplate selectNodetemplateById(Long id);
/**
* 查询节点模板列表
*
* @param nodetemplate 节点模板
* @return 节点模板集合
*/
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate);
/**
* 新增节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
public int insertNodetemplate(Nodetemplate nodetemplate);
/**
* 修改节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
public int updateNodetemplate(Nodetemplate nodetemplate);
/**
* 删除节点模板
*
* @param id 节点模板主键
* @return 结果
*/
public int deleteNodetemplateById(Long id);
/**
* 批量删除节点模板
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNodetemplateByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Templateparameterdef;
/**
* 模板参数定义Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface TemplateparameterdefMapper
{
/**
* 查询模板参数定义
*
* @param id 模板参数定义主键
* @return 模板参数定义
*/
public Templateparameterdef selectTemplateparameterdefById(Long id);
/**
* 查询模板参数定义列表
*
* @param templateparameterdef 模板参数定义
* @return 模板参数定义集合
*/
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef);
/**
* 新增模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef);
/**
* 修改模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef);
/**
* 删除模板参数定义
*
* @param id 模板参数定义主键
* @return 结果
*/
public int deleteTemplateparameterdefById(Long id);
/**
* 批量删除模板参数定义
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTemplateparameterdefByIds(Long[] ids);
}

View File

@@ -0,0 +1,64 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Treenodeinstance;
import org.apache.ibatis.annotations.Param;
/**
* 行为树实例节点Mapper接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface TreenodeinstanceMapper
{
void deleteByTreeId(@Param(value = "treeId") Long treeId);
/**
* 查询行为树实例节点
*
* @param id 行为树实例节点主键
* @return 行为树实例节点
*/
public Treenodeinstance selectTreenodeinstanceById(Long id);
/**
* 查询行为树实例节点列表
*
* @param treenodeinstance 行为树实例节点
* @return 行为树实例节点集合
*/
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance);
/**
* 新增行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
public int insertTreenodeinstance(Treenodeinstance treenodeinstance);
/**
* 修改行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
public int updateTreenodeinstance(Treenodeinstance treenodeinstance);
/**
* 删除行为树实例节点
*
* @param id 行为树实例节点主键
* @return 结果
*/
public int deleteTreenodeinstanceById(Long id);
/**
* 批量删除行为树实例节点
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTreenodeinstanceByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Behaviortree;
/**
* 行为树主Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface IBehaviortreeService
{
/**
* 查询行为树主
*
* @param id 行为树主主键
* @return 行为树主
*/
public Behaviortree selectBehaviortreeById(Long id);
/**
* 查询行为树主列表
*
* @param behaviortree 行为树主
* @return 行为树主集合
*/
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree);
/**
* 新增行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
public int insertBehaviortree(Behaviortree behaviortree);
/**
* 修改行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
public int updateBehaviortree(Behaviortree behaviortree);
/**
* 批量删除行为树主
*
* @param ids 需要删除的行为树主主键集合
* @return 结果
*/
public int deleteBehaviortreeByIds(Long[] ids);
/**
* 删除行为树主信息
*
* @param id 行为树主主键
* @return 结果
*/
public int deleteBehaviortreeById(Long id);
}

View File

@@ -0,0 +1,65 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Nodeconnection;
import org.apache.ibatis.annotations.Param;
/**
* 节点连接Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface INodeconnectionService
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点连接
*
* @param id 节点连接主键
* @return 节点连接
*/
public Nodeconnection selectNodeconnectionById(Long id);
/**
* 查询节点连接列表
*
* @param nodeconnection 节点连接
* @return 节点连接集合
*/
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection);
/**
* 新增节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
public int insertNodeconnection(Nodeconnection nodeconnection);
/**
* 修改节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
public int updateNodeconnection(Nodeconnection nodeconnection);
/**
* 批量删除节点连接
*
* @param ids 需要删除的节点连接主键集合
* @return 结果
*/
public int deleteNodeconnectionByIds(Long[] ids);
/**
* 删除节点连接信息
*
* @param id 节点连接主键
* @return 结果
*/
public int deleteNodeconnectionById(Long id);
}

View File

@@ -0,0 +1,64 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Nodeparameter;
/**
* 节点参数Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface INodeparameterService
{
void deleteByTreeId(Long treeId);
/**
* 查询节点参数
*
* @param id 节点参数主键
* @return 节点参数
*/
public Nodeparameter selectNodeparameterById(Long id);
/**
* 查询节点参数列表
*
* @param nodeparameter 节点参数
* @return 节点参数集合
*/
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter);
/**
* 新增节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
public int insertNodeparameter(Nodeparameter nodeparameter);
/**
* 修改节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
public int updateNodeparameter(Nodeparameter nodeparameter);
/**
* 批量删除节点参数
*
* @param ids 需要删除的节点参数主键集合
* @return 结果
*/
public int deleteNodeparameterByIds(Long[] ids);
/**
* 删除节点参数信息
*
* @param id 节点参数主键
* @return 结果
*/
public int deleteNodeparameterById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Nodetemplate;
/**
* 节点模板Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface INodetemplateService
{
/**
* 查询节点模板
*
* @param id 节点模板主键
* @return 节点模板
*/
public Nodetemplate selectNodetemplateById(Long id);
/**
* 查询节点模板列表
*
* @param nodetemplate 节点模板
* @return 节点模板集合
*/
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate);
/**
* 新增节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
public int insertNodetemplate(Nodetemplate nodetemplate);
/**
* 修改节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
public int updateNodetemplate(Nodetemplate nodetemplate);
/**
* 批量删除节点模板
*
* @param ids 需要删除的节点模板主键集合
* @return 结果
*/
public int deleteNodetemplateByIds(Long[] ids);
/**
* 删除节点模板信息
*
* @param id 节点模板主键
* @return 结果
*/
public int deleteNodetemplateById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Templateparameterdef;
/**
* 模板参数定义Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface ITemplateparameterdefService
{
/**
* 查询模板参数定义
*
* @param id 模板参数定义主键
* @return 模板参数定义
*/
public Templateparameterdef selectTemplateparameterdefById(Long id);
/**
* 查询模板参数定义列表
*
* @param templateparameterdef 模板参数定义
* @return 模板参数定义集合
*/
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef);
/**
* 新增模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef);
/**
* 修改模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef);
/**
* 批量删除模板参数定义
*
* @param ids 需要删除的模板参数定义主键集合
* @return 结果
*/
public int deleteTemplateparameterdefByIds(Long[] ids);
/**
* 删除模板参数定义信息
*
* @param id 模板参数定义主键
* @return 结果
*/
public int deleteTemplateparameterdefById(Long id);
}

View File

@@ -0,0 +1,64 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Treenodeinstance;
/**
* 行为树实例节点Service接口
*
* @author ruoyi
* @date 2026-02-05
*/
public interface ITreenodeinstanceService
{
void deleteByTreeId(Long treeId);
/**
* 查询行为树实例节点
*
* @param id 行为树实例节点主键
* @return 行为树实例节点
*/
public Treenodeinstance selectTreenodeinstanceById(Long id);
/**
* 查询行为树实例节点列表
*
* @param treenodeinstance 行为树实例节点
* @return 行为树实例节点集合
*/
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance);
/**
* 新增行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
public int insertTreenodeinstance(Treenodeinstance treenodeinstance);
/**
* 修改行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
public int updateTreenodeinstance(Treenodeinstance treenodeinstance);
/**
* 批量删除行为树实例节点
*
* @param ids 需要删除的行为树实例节点主键集合
* @return 结果
*/
public int deleteTreenodeinstanceByIds(Long[] ids);
/**
* 删除行为树实例节点信息
*
* @param id 行为树实例节点主键
* @return 结果
*/
public int deleteTreenodeinstanceById(Long id);
}

View File

@@ -0,0 +1,93 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.BehaviortreeMapper;
import com.solution.system.domain.Behaviortree;
import com.solution.system.service.IBehaviortreeService;
/**
* 行为树主Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class BehaviortreeServiceImpl implements IBehaviortreeService
{
@Autowired
private BehaviortreeMapper behaviortreeMapper;
/**
* 查询行为树主
*
* @param id 行为树主主键
* @return 行为树主
*/
@Override
public Behaviortree selectBehaviortreeById(Long id)
{
return behaviortreeMapper.selectBehaviortreeById(id);
}
/**
* 查询行为树主列表
*
* @param behaviortree 行为树主
* @return 行为树主
*/
@Override
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree)
{
return behaviortreeMapper.selectBehaviortreeList(behaviortree);
}
/**
* 新增行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
@Override
public int insertBehaviortree(Behaviortree behaviortree)
{
return behaviortreeMapper.insertBehaviortree(behaviortree);
}
/**
* 修改行为树主
*
* @param behaviortree 行为树主
* @return 结果
*/
@Override
public int updateBehaviortree(Behaviortree behaviortree)
{
return behaviortreeMapper.updateBehaviortree(behaviortree);
}
/**
* 批量删除行为树主
*
* @param ids 需要删除的行为树主主键
* @return 结果
*/
@Override
public int deleteBehaviortreeByIds(Long[] ids)
{
return behaviortreeMapper.deleteBehaviortreeByIds(ids);
}
/**
* 删除行为树主信息
*
* @param id 行为树主主键
* @return 结果
*/
@Override
public int deleteBehaviortreeById(Long id)
{
return behaviortreeMapper.deleteBehaviortreeById(id);
}
}

View File

@@ -0,0 +1,98 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.NodeconnectionMapper;
import com.solution.system.domain.Nodeconnection;
import com.solution.system.service.INodeconnectionService;
/**
* 节点连接Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class NodeconnectionServiceImpl implements INodeconnectionService
{
@Autowired
private NodeconnectionMapper nodeconnectionMapper;
@Override
public void deleteByTreeId(Long treeId) {
nodeconnectionMapper.deleteByTreeId(treeId);
}
/**
* 查询节点连接
*
* @param id 节点连接主键
* @return 节点连接
*/
@Override
public Nodeconnection selectNodeconnectionById(Long id)
{
return nodeconnectionMapper.selectNodeconnectionById(id);
}
/**
* 查询节点连接列表
*
* @param nodeconnection 节点连接
* @return 节点连接
*/
@Override
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection)
{
return nodeconnectionMapper.selectNodeconnectionList(nodeconnection);
}
/**
* 新增节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
@Override
public int insertNodeconnection(Nodeconnection nodeconnection)
{
return nodeconnectionMapper.insertNodeconnection(nodeconnection);
}
/**
* 修改节点连接
*
* @param nodeconnection 节点连接
* @return 结果
*/
@Override
public int updateNodeconnection(Nodeconnection nodeconnection)
{
return nodeconnectionMapper.updateNodeconnection(nodeconnection);
}
/**
* 批量删除节点连接
*
* @param ids 需要删除的节点连接主键
* @return 结果
*/
@Override
public int deleteNodeconnectionByIds(Long[] ids)
{
return nodeconnectionMapper.deleteNodeconnectionByIds(ids);
}
/**
* 删除节点连接信息
*
* @param id 节点连接主键
* @return 结果
*/
@Override
public int deleteNodeconnectionById(Long id)
{
return nodeconnectionMapper.deleteNodeconnectionById(id);
}
}

View File

@@ -0,0 +1,98 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.NodeparameterMapper;
import com.solution.system.domain.Nodeparameter;
import com.solution.system.service.INodeparameterService;
/**
* 节点参数Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class NodeparameterServiceImpl implements INodeparameterService
{
@Autowired
private NodeparameterMapper nodeparameterMapper;
@Override
public void deleteByTreeId(Long treeId) {
nodeparameterMapper.deleteByTreeId(treeId);
}
/**
* 查询节点参数
*
* @param id 节点参数主键
* @return 节点参数
*/
@Override
public Nodeparameter selectNodeparameterById(Long id)
{
return nodeparameterMapper.selectNodeparameterById(id);
}
/**
* 查询节点参数列表
*
* @param nodeparameter 节点参数
* @return 节点参数
*/
@Override
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter)
{
return nodeparameterMapper.selectNodeparameterList(nodeparameter);
}
/**
* 新增节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
@Override
public int insertNodeparameter(Nodeparameter nodeparameter)
{
return nodeparameterMapper.insertNodeparameter(nodeparameter);
}
/**
* 修改节点参数
*
* @param nodeparameter 节点参数
* @return 结果
*/
@Override
public int updateNodeparameter(Nodeparameter nodeparameter)
{
return nodeparameterMapper.updateNodeparameter(nodeparameter);
}
/**
* 批量删除节点参数
*
* @param ids 需要删除的节点参数主键
* @return 结果
*/
@Override
public int deleteNodeparameterByIds(Long[] ids)
{
return nodeparameterMapper.deleteNodeparameterByIds(ids);
}
/**
* 删除节点参数信息
*
* @param id 节点参数主键
* @return 结果
*/
@Override
public int deleteNodeparameterById(Long id)
{
return nodeparameterMapper.deleteNodeparameterById(id);
}
}

View File

@@ -0,0 +1,93 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.NodetemplateMapper;
import com.solution.system.domain.Nodetemplate;
import com.solution.system.service.INodetemplateService;
/**
* 节点模板Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class NodetemplateServiceImpl implements INodetemplateService
{
@Autowired
private NodetemplateMapper nodetemplateMapper;
/**
* 查询节点模板
*
* @param id 节点模板主键
* @return 节点模板
*/
@Override
public Nodetemplate selectNodetemplateById(Long id)
{
return nodetemplateMapper.selectNodetemplateById(id);
}
/**
* 查询节点模板列表
*
* @param nodetemplate 节点模板
* @return 节点模板
*/
@Override
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate)
{
return nodetemplateMapper.selectNodetemplateList(nodetemplate);
}
/**
* 新增节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
@Override
public int insertNodetemplate(Nodetemplate nodetemplate)
{
return nodetemplateMapper.insertNodetemplate(nodetemplate);
}
/**
* 修改节点模板
*
* @param nodetemplate 节点模板
* @return 结果
*/
@Override
public int updateNodetemplate(Nodetemplate nodetemplate)
{
return nodetemplateMapper.updateNodetemplate(nodetemplate);
}
/**
* 批量删除节点模板
*
* @param ids 需要删除的节点模板主键
* @return 结果
*/
@Override
public int deleteNodetemplateByIds(Long[] ids)
{
return nodetemplateMapper.deleteNodetemplateByIds(ids);
}
/**
* 删除节点模板信息
*
* @param id 节点模板主键
* @return 结果
*/
@Override
public int deleteNodetemplateById(Long id)
{
return nodetemplateMapper.deleteNodetemplateById(id);
}
}

View File

@@ -0,0 +1,93 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.TemplateparameterdefMapper;
import com.solution.system.domain.Templateparameterdef;
import com.solution.system.service.ITemplateparameterdefService;
/**
* 模板参数定义Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class TemplateparameterdefServiceImpl implements ITemplateparameterdefService
{
@Autowired
private TemplateparameterdefMapper templateparameterdefMapper;
/**
* 查询模板参数定义
*
* @param id 模板参数定义主键
* @return 模板参数定义
*/
@Override
public Templateparameterdef selectTemplateparameterdefById(Long id)
{
return templateparameterdefMapper.selectTemplateparameterdefById(id);
}
/**
* 查询模板参数定义列表
*
* @param templateparameterdef 模板参数定义
* @return 模板参数定义
*/
@Override
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef)
{
return templateparameterdefMapper.selectTemplateparameterdefList(templateparameterdef);
}
/**
* 新增模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
@Override
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef)
{
return templateparameterdefMapper.insertTemplateparameterdef(templateparameterdef);
}
/**
* 修改模板参数定义
*
* @param templateparameterdef 模板参数定义
* @return 结果
*/
@Override
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef)
{
return templateparameterdefMapper.updateTemplateparameterdef(templateparameterdef);
}
/**
* 批量删除模板参数定义
*
* @param ids 需要删除的模板参数定义主键
* @return 结果
*/
@Override
public int deleteTemplateparameterdefByIds(Long[] ids)
{
return templateparameterdefMapper.deleteTemplateparameterdefByIds(ids);
}
/**
* 删除模板参数定义信息
*
* @param id 模板参数定义主键
* @return 结果
*/
@Override
public int deleteTemplateparameterdefById(Long id)
{
return templateparameterdefMapper.deleteTemplateparameterdefById(id);
}
}

View File

@@ -0,0 +1,98 @@
package com.solution.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.TreenodeinstanceMapper;
import com.solution.system.domain.Treenodeinstance;
import com.solution.system.service.ITreenodeinstanceService;
/**
* 行为树实例节点Service业务层处理
*
* @author ruoyi
* @date 2026-02-05
*/
@Service
public class TreenodeinstanceServiceImpl implements ITreenodeinstanceService
{
@Autowired
private TreenodeinstanceMapper treenodeinstanceMapper;
@Override
public void deleteByTreeId(Long treeId) {
treenodeinstanceMapper.deleteByTreeId(treeId);
}
/**
* 查询行为树实例节点
*
* @param id 行为树实例节点主键
* @return 行为树实例节点
*/
@Override
public Treenodeinstance selectTreenodeinstanceById(Long id)
{
return treenodeinstanceMapper.selectTreenodeinstanceById(id);
}
/**
* 查询行为树实例节点列表
*
* @param treenodeinstance 行为树实例节点
* @return 行为树实例节点
*/
@Override
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance)
{
return treenodeinstanceMapper.selectTreenodeinstanceList(treenodeinstance);
}
/**
* 新增行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
@Override
public int insertTreenodeinstance(Treenodeinstance treenodeinstance)
{
return treenodeinstanceMapper.insertTreenodeinstance(treenodeinstance);
}
/**
* 修改行为树实例节点
*
* @param treenodeinstance 行为树实例节点
* @return 结果
*/
@Override
public int updateTreenodeinstance(Treenodeinstance treenodeinstance)
{
return treenodeinstanceMapper.updateTreenodeinstance(treenodeinstance);
}
/**
* 批量删除行为树实例节点
*
* @param ids 需要删除的行为树实例节点主键
* @return 结果
*/
@Override
public int deleteTreenodeinstanceByIds(Long[] ids)
{
return treenodeinstanceMapper.deleteTreenodeinstanceByIds(ids);
}
/**
* 删除行为树实例节点信息
*
* @param id 行为树实例节点主键
* @return 结果
*/
@Override
public int deleteTreenodeinstanceById(Long id)
{
return treenodeinstanceMapper.deleteTreenodeinstanceById(id);
}
}

View File

@@ -0,0 +1,81 @@
<?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.BehaviortreeMapper">
<resultMap type="Behaviortree" id="BehaviortreeResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="description" column="description" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="englishName" column="english_name" />
<result property="xmlContent" column="xml_content" />
</resultMap>
<sql id="selectBehaviortreeVo">
select id, name, description, created_at, updated_at, english_name, xml_content from behaviortree
</sql>
<select id="selectBehaviortreeList" parameterType="Behaviortree" resultMap="BehaviortreeResult">
<include refid="selectBehaviortreeVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
<if test="xmlContent != null and xmlContent != ''"> and xml_content = #{xmlContent}</if>
</where>
</select>
<select id="selectBehaviortreeById" parameterType="Long" resultMap="BehaviortreeResult">
<include refid="selectBehaviortreeVo"/>
where id = #{id}
</select>
<insert id="insertBehaviortree" parameterType="Behaviortree" useGeneratedKeys="true" keyProperty="id">
insert into behaviortree
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="description != null">description,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="englishName != null and englishName != ''">english_name,</if>
<if test="xmlContent != null">xml_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="description != null">#{description},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="englishName != null and englishName != ''">#{englishName},</if>
<if test="xmlContent != null">#{xmlContent},</if>
</trim>
</insert>
<update id="updateBehaviortree" parameterType="Behaviortree">
update behaviortree
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="description != null">description = #{description},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="englishName != null and englishName != ''">english_name = #{englishName},</if>
<if test="xmlContent != null">xml_content = #{xmlContent},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBehaviortreeById" parameterType="Long">
delete from behaviortree where id = #{id}
</delete>
<delete id="deleteBehaviortreeByIds" parameterType="String">
delete from behaviortree where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,75 @@
<?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.NodeconnectionMapper">
<resultMap type="Nodeconnection" id="NodeconnectionResult">
<result property="id" column="id" />
<result property="treeId" column="tree_id" />
<result property="parentNodeId" column="parent_node_id" />
<result property="childNodeId" column="child_node_id" />
<result property="orderIndex" column="order_index" />
</resultMap>
<delete id="deleteByTreeId">
delete from nodeconnection where tree_id=#{treeId}
</delete>
<sql id="selectNodeconnectionVo">
select id, tree_id, parent_node_id, child_node_id, order_index from nodeconnection
</sql>
<select id="selectNodeconnectionList" parameterType="Nodeconnection" resultMap="NodeconnectionResult">
<include refid="selectNodeconnectionVo"/>
<where>
<if test="treeId != null "> and tree_id = #{treeId}</if>
<if test="parentNodeId != null "> and parent_node_id = #{parentNodeId}</if>
<if test="childNodeId != null "> and child_node_id = #{childNodeId}</if>
<if test="orderIndex != null "> and order_index = #{orderIndex}</if>
</where>
</select>
<select id="selectNodeconnectionById" parameterType="Long" resultMap="NodeconnectionResult">
<include refid="selectNodeconnectionVo"/>
where id = #{id}
</select>
<insert id="insertNodeconnection" parameterType="Nodeconnection" useGeneratedKeys="true" keyProperty="id">
insert into nodeconnection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treeId != null">tree_id,</if>
<if test="parentNodeId != null">parent_node_id,</if>
<if test="childNodeId != null">child_node_id,</if>
<if test="orderIndex != null">order_index,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="treeId != null">#{treeId},</if>
<if test="parentNodeId != null">#{parentNodeId},</if>
<if test="childNodeId != null">#{childNodeId},</if>
<if test="orderIndex != null">#{orderIndex},</if>
</trim>
</insert>
<update id="updateNodeconnection" parameterType="Nodeconnection">
update nodeconnection
<trim prefix="SET" suffixOverrides=",">
<if test="treeId != null">tree_id = #{treeId},</if>
<if test="parentNodeId != null">parent_node_id = #{parentNodeId},</if>
<if test="childNodeId != null">child_node_id = #{childNodeId},</if>
<if test="orderIndex != null">order_index = #{orderIndex},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNodeconnectionById" parameterType="Long">
delete from nodeconnection where id = #{id}
</delete>
<delete id="deleteNodeconnectionByIds" parameterType="String">
delete from nodeconnection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,74 @@
<?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.NodeparameterMapper">
<resultMap type="Nodeparameter" id="NodeparameterResult">
<result property="id" column="id" />
<result property="treeId" column="tree_id" />
<result property="nodeInstanceId" column="node_instance_id" />
<result property="paramDefId" column="param_def_id" />
<result property="value" column="value" />
</resultMap>
<delete id="deleteByTreeId">
delete from nodeparameter where tree_id=#{treeId}
</delete>
<sql id="selectNodeparameterVo">
select id, treeId, node_instance_id, param_def_id, value from nodeparameter
</sql>
<select id="selectNodeparameterList" parameterType="Nodeparameter" resultMap="NodeparameterResult">
<include refid="selectNodeparameterVo"/>
<where>
<if test="nodeInstanceId != null "> and node_instance_id = #{nodeInstanceId}</if>
<if test="paramDefId != null "> and param_def_id = #{paramDefId}</if>
<if test="value != null and value != ''"> and value = #{value}</if>
</where>
</select>
<select id="selectNodeparameterById" parameterType="Long" resultMap="NodeparameterResult">
<include refid="selectNodeparameterVo"/>
where id = #{id}
</select>
<insert id="insertNodeparameter" parameterType="Nodeparameter" useGeneratedKeys="true" keyProperty="id">
insert into nodeparameter
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treeId != null">tree_id,</if>
<if test="nodeInstanceId != null">node_instance_id,</if>
<if test="paramDefId != null">param_def_id,</if>
<if test="value != null">value,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="treeId != null">#{treeId},</if>
<if test="nodeInstanceId != null">#{nodeInstanceId},</if>
<if test="paramDefId != null">#{paramDefId},</if>
<if test="value != null">#{value},</if>
</trim>
</insert>
<update id="updateNodeparameter" parameterType="Nodeparameter">
update nodeparameter
<trim prefix="SET" suffixOverrides=",">
<if test="treeId != null">tree_id = #{treeId},</if>
<if test="nodeInstanceId != null">node_instance_id = #{nodeInstanceId},</if>
<if test="paramDefId != null">param_def_id = #{paramDefId},</if>
<if test="value != null">value = #{value},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNodeparameterById" parameterType="Long">
delete from nodeparameter where id = #{id}
</delete>
<delete id="deleteNodeparameterByIds" parameterType="String">
delete from nodeparameter where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,81 @@
<?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.NodetemplateMapper">
<resultMap type="Nodetemplate" id="NodetemplateResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="name" column="name" />
<result property="logicHandler" column="logic_handler" />
<result property="description" column="description" />
<result property="englishName" column="english_name" />
<result property="templateType" column="templete_type" />
</resultMap>
<sql id="selectNodetemplateVo">
select id, type, name, logic_handler, description, english_name, templete_type from nodetemplate
</sql>
<select id="selectNodetemplateList" parameterType="Nodetemplate" resultMap="NodetemplateResult">
<include refid="selectNodetemplateVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="logicHandler != null and logicHandler != ''"> and logic_handler = #{logicHandler}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
<if test="templateType != null and templateType != ''"> and templete_type = #{templateType}</if>
</where>
</select>
<select id="selectNodetemplateById" parameterType="Long" resultMap="NodetemplateResult">
<include refid="selectNodetemplateVo"/>
where id = #{id}
</select>
<insert id="insertNodetemplate" parameterType="Nodetemplate" useGeneratedKeys="true" keyProperty="id">
insert into nodetemplate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">type,</if>
<if test="name != null and name != ''">name,</if>
<if test="logicHandler != null">logic_handler,</if>
<if test="description != null">description,</if>
<if test="englishName != null">english_name,</if>
<if test="templateType != null and templateType != ''">templete_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">#{type},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="logicHandler != null">#{logicHandler},</if>
<if test="description != null">#{description},</if>
<if test="englishName != null">#{englishName},</if>
<if test="templateType != null and templateType != ''">#{templateType},</if>
</trim>
</insert>
<update id="updateNodetemplate" parameterType="Nodetemplate">
update nodetemplate
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type = #{type},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="logicHandler != null">logic_handler = #{logicHandler},</if>
<if test="description != null">description = #{description},</if>
<if test="englishName != null">english_name = #{englishName},</if>
<if test="templateType != null and templateType != ''">templete_type = #{templateType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNodetemplateById" parameterType="Long">
delete from nodetemplate where id = #{id}
</delete>
<delete id="deleteNodetemplateByIds" parameterType="String">
delete from nodetemplate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,81 @@
<?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.TemplateparameterdefMapper">
<resultMap type="Templateparameterdef" id="TemplateparameterdefResult">
<result property="id" column="id" />
<result property="templateId" column="template_id" />
<result property="paramKey" column="param_key" />
<result property="dataType" column="data_type" />
<result property="defaultValue" column="default_value" />
<result property="description" column="description" />
<result property="templateType" column="template_type" />
</resultMap>
<sql id="selectTemplateparameterdefVo">
select id, template_id, param_key, data_type, default_value, description, template_type from templateparameterdef
</sql>
<select id="selectTemplateparameterdefList" parameterType="Templateparameterdef" resultMap="TemplateparameterdefResult">
<include refid="selectTemplateparameterdefVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="paramKey != null and paramKey != ''"> and param_key = #{paramKey}</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType}</if>
</where>
</select>
<select id="selectTemplateparameterdefById" parameterType="Long" resultMap="TemplateparameterdefResult">
<include refid="selectTemplateparameterdefVo"/>
where id = #{id}
</select>
<insert id="insertTemplateparameterdef" parameterType="Templateparameterdef" useGeneratedKeys="true" keyProperty="id">
insert into templateparameterdef
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,</if>
<if test="paramKey != null and paramKey != ''">param_key,</if>
<if test="dataType != null and dataType != ''">data_type,</if>
<if test="defaultValue != null and defaultValue != ''">default_value,</if>
<if test="description != null">description,</if>
<if test="templateType != null and templateType != ''">template_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateId != null">#{templateId},</if>
<if test="paramKey != null and paramKey != ''">#{paramKey},</if>
<if test="dataType != null and dataType != ''">#{dataType},</if>
<if test="defaultValue != null and defaultValue != ''">#{defaultValue},</if>
<if test="description != null">#{description},</if>
<if test="templateType != null and templateType != ''">#{templateType},</if>
</trim>
</insert>
<update id="updateTemplateparameterdef" parameterType="Templateparameterdef">
update templateparameterdef
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id = #{templateId},</if>
<if test="paramKey != null and paramKey != ''">param_key = #{paramKey},</if>
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
<if test="defaultValue != null and defaultValue != ''">default_value = #{defaultValue},</if>
<if test="description != null">description = #{description},</if>
<if test="templateType != null and templateType != ''">template_type = #{templateType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTemplateparameterdefById" parameterType="Long">
delete from templateparameterdef where id = #{id}
</delete>
<delete id="deleteTemplateparameterdefByIds" parameterType="String">
delete from templateparameterdef where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,90 @@
<?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.TreenodeinstanceMapper">
<resultMap type="Treenodeinstance" id="TreenodeinstanceResult">
<result property="id" column="id" />
<result property="treeId" column="tree_id" />
<result property="templateId" column="template_id" />
<result property="instanceName" column="instance_name" />
<result property="isRoot" column="is_root" />
<result property="preconditionTempleteId" column="precondition_templete_id" />
<result property="uuid" column="uuid" />
<result property="desciption" column="desciption" />
</resultMap>
<delete id="deleteByTreeId">
delete from treenodeinstance where tree_id=#{treeId}
</delete>
<sql id="selectTreenodeinstanceVo">
select id, tree_id, template_id, instance_name, is_root, precondition_templete_id, uuid,desciption from treenodeinstance
</sql>
<select id="selectTreenodeinstanceList" parameterType="Treenodeinstance" resultMap="TreenodeinstanceResult">
<include refid="selectTreenodeinstanceVo"/>
<where>
<if test="treeId != null "> and tree_id = #{treeId}</if>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="instanceName != null and instanceName != ''"> and instance_name like concat('%', #{instanceName}, '%')</if>
<if test="isRoot != null "> and is_root = #{isRoot}</if>
<if test="preconditionTempleteId != null "> and precondition_templete_id = #{preconditionTempleteId}</if>
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
<if test="desciption != null and desciption != ''"> and desciption = #{desciption}</if>
</where>
</select>
<select id="selectTreenodeinstanceById" parameterType="Long" resultMap="TreenodeinstanceResult">
<include refid="selectTreenodeinstanceVo"/>
where id = #{id}
</select>
<insert id="insertTreenodeinstance" parameterType="Treenodeinstance" useGeneratedKeys="true" keyProperty="id">
insert into treenodeinstance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treeId != null">tree_id,</if>
<if test="templateId != null">template_id,</if>
<if test="instanceName != null">instance_name,</if>
<if test="isRoot != null">is_root,</if>
<if test="preconditionTempleteId != null">precondition_templete_id,</if>
<if test="uuid != null">uuid,</if>
<if test="desciption != null">desciption,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="treeId != null">#{treeId},</if>
<if test="templateId != null">#{templateId},</if>
<if test="instanceName != null">#{instanceName},</if>
<if test="isRoot != null">#{isRoot},</if>
<if test="preconditionTempleteId != null">#{preconditionTempleteId},</if>
<if test="uuid != null">#{uuid},</if>
<if test="desciption != null">#{desciption},</if>
</trim>
</insert>
<update id="updateTreenodeinstance" parameterType="Treenodeinstance">
update treenodeinstance
<trim prefix="SET" suffixOverrides=",">
<if test="treeId != null">tree_id = #{treeId},</if>
<if test="templateId != null">template_id = #{templateId},</if>
<if test="instanceName != null">instance_name = #{instanceName},</if>
<if test="isRoot != null">is_root = #{isRoot},</if>
<if test="preconditionTempleteId != null">precondition_templete_id = #{preconditionTempleteId},</if>
<if test="uuid != null">uuid = #{uuid},</if>
<if test="desciption != null">desciption = #{desciption},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTreenodeinstanceById" parameterType="Long">
delete from treenodeinstance where id = #{id}
</delete>
<delete id="deleteTreenodeinstanceByIds" parameterType="String">
delete from treenodeinstance where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>博弈竞赛环境</title>
<title>决策管理</title>
</head>
<body>
<div id="app" class="w-full h-full"></div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 MiB

After

Width:  |  Height:  |  Size: 418 KiB

View File

@@ -8,7 +8,7 @@
*/
export default {
dashboardUrl: '/app/ai/project/management',
dashboardUrl: '/app/decision/designer',
// 训练任务监控URL
taskMonitorUrl: 'http://192.168.1.100:8080',
// 集群监控URL

View File

@@ -7,9 +7,39 @@
* that was distributed with this source code.
*/
import { type RouteRecordRaw } from 'vue-router';
import { routers } from '@/views/ai/router';
import { type RouteRecordRaw, type RouteRecordRedirect } from 'vue-router';
export const routes: RouteRecordRaw[] = [
...routers,
{
name: 'index',
path: '/',
redirect: '/app/decision/designer',
meta: {
hidden: true,
},
} as RouteRecordRedirect,
{
name: 'signin',
path: '/signin',
meta: {
title: '登录',
},
component: () => import('@/views/signin.vue'),
},
{
name: 'decision-designer',
path: '/app/decision/designer',
meta: {
title: '决策树',
},
component: () => import('@/views/decision/designer.vue'),
},
{
name: 'decision-algorithm-management',
path: '/app/decision/algorithm/management',
meta: {
title: '指挥决策规则库管理',
},
component: () => import('@/views/decision/algorithm/management.vue'),
},
]

File diff suppressed because it is too large Load Diff

View File

@@ -34,3 +34,9 @@ export interface PageableResponse<T = any> extends BasicResponse {
[key: string]: unknown;
}
export interface ApiPaginationQuery {
page: number;
limit: number;
keyword: NullableString;
}

View File

@@ -7,7 +7,16 @@
* that was distributed with this source code.
*/
import type { NullableString } from '@/types';
export const generateKey = (type: string | null = ''): string => {
return `${type ? (type + '_') : ''}${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`
.replace('-', '_').toLowerCase();
};
};
export const substring = (s: NullableString, n: number = 10, p: string = '...') => {
if (s) {
return s.length > n ? (s.substring(0, n) + p) : s;
}
return s;
};

View File

@@ -1,22 +0,0 @@
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2025 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import request from '@/utils/request';
import type { DeductionTestResponse, FinderBrowserResult } from './types';
import type { NullableString } from '@/types';
export const findFinderBrowser = (path: NullableString): Promise<FinderBrowserResult> => {
return request.post<FinderBrowserResult>('/finder/browser', {
path: path,
});
};
export const startDeduction = (): Promise<DeductionTestResponse> => {
return request.postJson<DeductionTestResponse>('/deductionTest/startDeduction', {});
};

View File

@@ -1,36 +0,0 @@
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2025 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import request from '@/utils/request';
import type { DeductionPodResult, ModelDeduction, ModelDeductionDataResponse, ModelDeductionDetailsResponse, ModelDeductionPodStatusResponse } from './types';
import type { BasicResponse } from '@/types';
export const findDeductionPodResult = (query: Record<any, any> = { pageSize: 1000 }): Promise<DeductionPodResult> => {
return request.get<DeductionPodResult>('/deductionPodInfo/listAll', query);
};
export const createModelDeduction = (deduction: Partial<ModelDeduction>): Promise<BasicResponse> => {
return request.postJson<BasicResponse>('/deductionPodInfo/add', deduction);
};
export const deleteModelDeduction = (id: number): Promise<BasicResponse> => {
return request.delete<BasicResponse>(`/deductionPodInfo/${id}`);
};
export const findOneModelDeductionDetails = (id: number): Promise<ModelDeductionDetailsResponse> => {
return request.get<ModelDeductionDetailsResponse>(`/deductionPodInfo/${id}`);
}
export const findChartsDataById = (id: number): Promise<ModelDeductionDataResponse> => {
return request.get<ModelDeductionDataResponse>(`/deductionPodData/listByPodId/${id}`);
};
export const runDeductionPodAfsimControl = (data: any): Promise<ModelDeductionPodStatusResponse> => {
return request.postJson<ModelDeductionPodStatusResponse>(`/deductionPodInfo/afsimControl`, data);
};

View File

@@ -1,117 +0,0 @@
/*
* 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 { xAxisConfig } from './config';
import * as echarts from 'echarts';
import type { ChartOption } from './types';
export const createAreaChartOption = (options: ChartOption) => {
let blueName = options.blueName ?? '蓝方';
let redName = options.redName ?? '红方';
return {
title: {
text: options.title,
textStyle: {
color: '#eee',
fontSize: 16,
},
},
tooltip: {
trigger: 'axis',
textStyle: {
color: '#999',
},
},
grid: {
left: '1%',
right: '5%',
bottom: '15%',
containLabel: true,
},
legend: {
data: [blueName, redName],
textStyle: {
color: '#ddd',
fontSize: 14,
},
},
xAxis: {
type: 'category',
data: options.xAxisData,
boundaryGap: [0.1, 0.1],
...xAxisConfig,
},
yAxis: {
type: 'value',
boundaryGap: [0, 0.1],
...xAxisConfig,
},
series: [
{
name: blueName,
data: options.blueData,
type: 'line',
areaStyle: {
opacity: 0.8,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#0f86d7',
},
{
offset: 1,
color: '#0f1e48cc',
},
]),
},
itemStyle: {
color: '#409EFF', // 轮数1整体颜色
},
label: {
show: false, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12, // 数值文字大小
},
},
},
{
name: redName,
data: options.redData,
type: 'line',
areaStyle: {
opacity: 0.8,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#dc5959',
},
{
offset: 1,
color: '#bc1f1f',
},
]),
},
itemStyle: {
color: '#bc1f1f', // 轮数2整体颜色
},
label: {
show: false, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12, // 数值文字大小
},
},
},
],
};
};

View File

@@ -1,96 +0,0 @@
/*
* 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 { getVerticalGradient, xAxisConfig } from './config';
import type { ChartOption } from './types';
export const createBarChartOption = (options: ChartOption) => {
let blueName = options.blueName ?? '蓝方';
let redName = options.redName ?? '红方';
return {
title: {
text: options.title,
textStyle: {
color: '#eee',
fontSize: 16
}
},
tooltip: {
trigger: 'axis',
textStyle: {
color: '#999'
}
},
grid: {
left: '1%',
right: '5%',
bottom: '15%',
containLabel: true
},
legend: {
data: [blueName, redName],
textStyle: {
color: '#ddd',
fontSize: 14
}
},
xAxis: {
type: 'category',
data: options.xAxisData,
boundaryGap: [0.1, 0.1],
...xAxisConfig
},
yAxis: {
type: 'value',
boundaryGap: [0.1, 0.5],
...xAxisConfig
},
series: [
{
name: blueName,
data: options.blueData,
type: 'bar',
barWidth: '20%',
barGap: '10%',
barCategoryGap: '30%',
itemStyle: {
color: getVerticalGradient('#409EFF', '#87CEFA')
},
label: {
show: false, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12 // 数值文字大小
}
}
},
{
name: redName,
data: options.redData,
type: 'bar',
barWidth: '20%',
barGap: '10%',
barCategoryGap: '30%',
itemStyle: {
color: getVerticalGradient('#bc1f1f', '#e67e7e')
},
label: {
show: false, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12 // 数值文字大小
}
}
}
]
};
};

View File

@@ -1,77 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createLineChartOption } from './line-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
}
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.episodeReturnsBlue);
redData.push(item.episodeReturnsRed);
});
}
const options = createLineChartOption({
title: '环境总奖励对比',
blueName: props.blueName as string,
redName: props.redName as string,
xAxisData: xAxisData,
blueData: blueData,
redData: redData,
xAxisDataVisible: true,
labelVisible: false,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,97 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const defaultValues = {
hide_missile: 0,
angle: 0,
height: 0,
speed: 0,
}
const parseJson = (v: any)=> {
let values = {...defaultValues}
try{
values = JSON.parse(v as string);
} catch (e: any) {
console.error('error',e);
}
return {
...defaultValues,
...values
}
}
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
let blueValues = parseJson(item.returnComponentsBlue);
let redValues = parseJson(item.returnComponentsRed);
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(blueValues.hide_missile);
redData.push(redValues.hide_missile);
});
}
const options = createScatterChartOption({
title: '躲避奖励',
xAxisData,
blueData,
redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,94 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const defaultValues = {
hide_missile: 0,
angle: 0,
height: 0,
speed: 0,
}
const parseJson = (v: any)=> {
let values = {...defaultValues}
try{
values = JSON.parse(v as string);
} catch (e: any) {
console.error('error',e);
}
return {
...defaultValues,
...values
}
}
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
let blueValues = parseJson(item.returnComponentsBlue);
let redValues = parseJson(item.returnComponentsRed);
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(blueValues.angle);
redData.push(redValues.angle);
});
}
const options = createScatterChartOption({
title: '角度奖励', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,94 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const defaultValues = {
hide_missile: 0,
angle: 0,
height: 0,
speed: 0,
}
const parseJson = (v: any)=> {
let values = {...defaultValues}
try{
values = JSON.parse(v as string);
} catch (e: any) {
console.error('error',e);
}
return {
...defaultValues,
...values
}
}
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
let blueValues = parseJson(item.returnComponentsBlue);
let redValues = parseJson(item.returnComponentsRed);
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(blueValues.height);
redData.push(redValues.height);
});
}
const options = createScatterChartOption({
title: '高度奖励', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,94 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const defaultValues = {
hide_missile: 0,
angle: 0,
height: 0,
speed: 0,
}
const parseJson = (v: any)=> {
let values = {...defaultValues}
try{
values = JSON.parse(v as string);
} catch (e: any) {
console.error('error',e);
}
return {
...defaultValues,
...values
}
}
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
let blueValues = parseJson(item.returnComponentsBlue);
let redValues = parseJson(item.returnComponentsRed);
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(blueValues.speed);
redData.push(redValues.speed);
});
}
const options = createScatterChartOption({
title: '速度奖励', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,72 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.returnComponentsBlue);
redData.push(item.returnComponentsRed);
});
}
const options = createScatterChartOption({
title: '分项奖励对比', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,72 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createBarChartOption } from './bar-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.returnDelnatyBlue);
redData.push(item.returnDelnatyRed);
});
}
const options = createBarChartOption({
title: '决策错误对比', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,73 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.episodeLengthsBlue ?? 0);
redData.push(item.episodeLengthsRed ?? 0);
});
}
console.error('chart4',d, blueData, redData)
const options = createScatterChartOption({
title: '最长生存步数', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,72 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createScatterChartOption } from './scatter-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.fireConsumeBlue);
redData.push(item.fireConsumeRed);
});
}
const options = createScatterChartOption({
title: '击杀单位耗弹量', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,74 +0,0 @@
<template>
<div class="ks-model-chart-item-chart" ref="chartContainer" style="height: 480px;"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import { createLineChartOption } from './line-options';
import type {ChartLineData} from './types'
export default defineComponent({
props: {
datas: {
type: Object as PropType<ChartLineData>,
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
}
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ChartLineData) => {
if(d){
const options = createLineChartOption({
title: '飞行状态稳定性',
blueName: props.blueName as string,
redName: props.redName as string,
xAxisData: d.xAxisData,
blueData: d.blueData,
redData: d.redData,
xAxisDataVisible: true,
labelVisible: false,
});
nextTick(() => initChart(options));
} else {
if (chartInstance) {
chartInstance.dispose();
}
}
};
watch(() => props.datas, (n: ChartLineData | undefined) => n && load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,84 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer">
<a-carousel
arrows
:dots="false"
:slides-to-show="1"
:slides-to-scroll="1"
arrow="always"
:autoplay="false"
class="chart-carousel"
>
<template #prevArrow>
<div class="custom-slick-arrow prev-arrow" style="z-index: 1">
<left-circle-outlined />
</div>
</template>
<template #nextArrow>
<div class="custom-slick-arrow next-arrow">
<right-circle-outlined />
</div>
</template>
<div class="slick-slide-item" v-for="d in realDatas">
<div style="height: 500px">
<Charts006Impl :datas="d" :blueName="blueName" :redName="redName" />
</div>
</div>
</a-carousel>
</div>
</template>
<script lang="ts">
import { defineComponent, type PropType, ref, watch } from 'vue';
import type { ModelDeductionData } from '../types';
import type {ChartLineData} from './types';
import {downSampleData} from './utils'
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
import Charts006Impl from './charts-006-impl.vue'
export default defineComponent({
components: { RightCircleOutlined, LeftCircleOutlined ,Charts006Impl},
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const realDatas = ref<ChartLineData[]>([])
const load = (d: ModelDeductionData[]) => {
realDatas.value = [];
let dv:ChartLineData[] = [];
if (d) {
d.forEach(item => {
dv.push({
name: `轮数${item.currentEpisode}`,
xAxisData: [`轮数${item.currentEpisode}`],
blueData: downSampleData(item.normalizedBlueTrajectory || []),
redData: downSampleData(item.normalizedRedTrajectory || []),
options: {},
deduction: item,
})
});
}
realDatas.value = dv;
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
realDatas
};
}
});
</script>

View File

@@ -1,77 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createLineChartOption } from './line-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.firstFireTimeBlue);
redData.push(item.firstFireTimeRed);
});
}
const options = createLineChartOption({
title: '最早锁定发射时间',
blueName: props.blueName as string,
redName: props.redName as string,
xAxisData: xAxisData,
blueData: blueData,
redData: redData,
xAxisDataVisible: true,
labelVisible: false,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,72 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData } from '../types';
import { createAreaChartOption } from './area-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const xAxisData: string[] = [];
const blueData: any[] = [];
const redData: any[] = [];
if (d) {
d.forEach(item => {
xAxisData.push(`轮数${item.currentEpisode}`);
blueData.push(item.attackTimeBlue);
redData.push(item.attackTimeRed);
});
}
const options = createAreaChartOption({
title: '总攻击持续时间', xAxisData, blueData, redData,
blueName: props.blueName as string,
redName: props.redName as string,
});
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,74 +0,0 @@
<template>
<div class="ks-model-chart-item-chart" ref="chartContainer" style="height: 480px;"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import { createLineChartOption } from './line-options';
import type {ChartLineData} from './types'
export default defineComponent({
props: {
datas: {
type: Object as PropType<ChartLineData>,
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ChartLineData) => {
if(d){
const options = createLineChartOption({
title: `能量优势保持时间窗口 - ${d.name}`,
blueName: props.blueName as string,
redName: props.redName as string,
xAxisData: d.xAxisData,
blueData: d.blueData,
redData: d.redData,
xAxisDataVisible: true,
labelVisible: false,
});
nextTick(() => initChart(options));
} else {
if (chartInstance) {
chartInstance.dispose();
}
}
};
watch(() => props.datas, (n: ChartLineData | undefined) => n && load(n), { deep: true, immediate: true });
return {
chartContainer
};
}
});
</script>

View File

@@ -1,97 +0,0 @@
<template>
<div class="ks-model-chart-item" ref="chartContainer">
<a-carousel
arrows
:dots="false"
:slides-to-show="1"
:slides-to-scroll="1"
arrow="always"
:autoplay="false"
class="chart-carousel"
>
<template #prevArrow>
<div class="custom-slick-arrow prev-arrow" style="z-index: 1">
<left-circle-outlined />
</div>
</template>
<template #nextArrow>
<div class="custom-slick-arrow next-arrow">
<right-circle-outlined />
</div>
</template>
<div class="slick-slide-item" v-for="d in realDatas">
<div style="height: 500px">
<Charts006Impl :datas="d" :blueName="blueName" :redName="redName"/>
</div>
</div>
</a-carousel>
</div>
</template>
<script lang="ts">
import { defineComponent, type PropType, ref, watch } from 'vue';
import type { ModelDeductionData } from '../types';
import type {ChartLineData} from './types';
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
import Charts006Impl from './charts-006-impl.vue'
export default defineComponent({
components: { RightCircleOutlined, LeftCircleOutlined ,Charts006Impl},
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const realDatas = ref<ChartLineData[]>([])
const defaultValues: number[] = []
const parseJson = (v: any)=> {
let values: number[] = []
try{
values = JSON.parse(v as string) as number[];
} catch (e: any) {
console.error('error',e);
}
return values ?? []
}
const load = (d: ModelDeductionData[]) => {
realDatas.value = [];
let dv:ChartLineData[] = [];
if (d) {
d.forEach(item => {
dv.push({
name: `轮数${item.currentEpisode}`,
xAxisData: [`轮数${item.currentEpisode}`],
blueData: parseJson(item.energyAdvantage),
redData: parseJson(item.energyAdvantage),
options: {},
deduction: item,
})
});
}
realDatas.value = dv;
console.error(realDatas.value)
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
return {
realDatas
};
}
});
</script>

View File

@@ -1,87 +0,0 @@
<template>
<div class="ks-model-chart-item-child" style="width:50%;display: block;float:left;position: relative">
<div class="ks-model-chart-item-wrapper" ref="chartContainer" style="height:350px;"></div>
<div class="ks-model-chart-item-description">
<span class="pre">{{ lastItem?.blueWinRounds ?? 0}} {{ lastItem?.redWinRounds ?? 0}}</span>
<span class="total">{{ deductionPod.totalRound??0 }}</span>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData, DeductionPod } from '../types';
import { createPieChartOption } from './pie-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
deductionPod: {
type: [Object] as PropType<DeductionPod|null | undefined>,
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const deductionPod = ref<Partial<DeductionPod>>({})
const lastItem = ref<ModelDeductionData|null | undefined>(null)
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const blueName = props.blueName ?? '蓝方';
const redName = props.redName ?? '红方';
let pre = 0;
lastItem.value = null;
if (d && d.length >= 1) {
lastItem.value = d[d.length - 1] as ModelDeductionData;
const mineRounds = lastItem.value?.blueWinRounds ?? 0;
const totalRound = props.deductionPod?.totalRound ?? 0;
if (totalRound > 0) {
pre = Number((mineRounds / totalRound * 100).toFixed(2));
}
console.error('blue',mineRounds,totalRound)
}
const options = createPieChartOption(`${blueName}胜率`, 'blue', pre, `${blueName}胜率`, blueName as string, redName as string);
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
watch(() => props.deductionPod, (n: DeductionPod | null| undefined ) => deductionPod.value = n ?? {}, { deep: true, immediate: true });
return {
lastItem,
deductionPod,
chartContainer
};
}
});
</script>

View File

@@ -1,246 +0,0 @@
<template>
<a-modal :open="visible" style="width: 98%" class="ks-charts-modal" centered :footer="false" @cancel="handleCancel">
<template #title>
<a-space>
<span class="ks-charts-modal-icon"></span>
<span class="ks-charts-modal-title">指标效果对比</span>
</a-space>
</template>
<div class="ks-model-charts">
<a-card class="ks-model-chart-card">
<template #title>
<a-space>
<span class="ks-model-chart-card-icon model-icon"></span>
<span>多维度算法指标对比</span>
</a-space>
</template>
<a-row :gutter="15">
<a-col :span="8">
<Chart001 :datas="datas"/>
</a-col>
<a-col :span="8">
<Chart002 :datas="datas"/>
</a-col>
<a-col :span="8">
<Chart003 :datas="datas"/>
</a-col>
</a-row>
</a-card>
<a-card class="ks-model-chart-card">
<template #title>
<a-space>
<span class="ks-model-chart-card-icon grid-icon"></span>
<span>多维度仿真推演效果对比</span>
</a-space>
</template>
<a-row :gutter="15">
<a-col :span="24">
<div class="ks-model-chart-item" style="height:380px;">
<ChartRed :datas="datas"/>
<ChartBlue :datas="datas"/>
</div>
</a-col>
</a-row>
<a-row :gutter="15">
<a-col :span="12">
<Chart004 :datas="datas"/>
</a-col>
<a-col :span="12">
<Chart005 :datas="datas"/>
</a-col>
</a-row>
<a-row :gutter="15">
<a-col :span="12">
<Chart006 :datas="datas"/>
</a-col>
<a-col :span="12">
<Chart007 :datas="datas"/>
</a-col>
<a-col :span="12">
<Chart008 :datas="datas"/>
</a-col>
<a-col :span="12">
<Chart009 :datas="datas"/>
</a-col>
</a-row>
</a-card>
</div>
</a-modal>
</template>
<script lang="ts">
import { defineComponent, type PropType, ref, watch } from 'vue';
import Chart001 from './charts-001.vue';
import Chart002 from './charts-002.vue';
import Chart003 from './charts-003.vue';
import Chart004 from './charts-004.vue';
import Chart005 from './charts-005.vue';
import Chart006 from './charts-006.vue';
import Chart007 from './charts-007.vue';
import Chart008 from './charts-008.vue';
import Chart009 from './charts-009.vue';
import ChartBlue from './charts-blue.vue';
import ChartRed from './charts-red.vue';
import type { DeductionPod, ModelDeductionData } from '../types';
import { findChartsDataById } from '../api';
export default defineComponent(({
components: {
Chart001,
Chart002,
Chart003,
Chart004,
Chart005,
Chart006,
Chart007,
Chart008,
Chart009,
ChartBlue,
ChartRed,
},
props: {
visible: {
type: Boolean,
},
deduction: {
type: [Object, null, undefined] as PropType<DeductionPod | null | undefined>,
},
},
emits: ['cancel'],
setup(props, { emit }) {
const deduction = ref<DeductionPod | null | undefined>(props.deduction as DeductionPod);
const datas = ref<ModelDeductionData[]>([]);
const handleCancel = () => {
emit('cancel');
};
const load = (n: DeductionPod | null | undefined) => {
deduction.value = n;
if (n?.deductionId) {
findChartsDataById(n.deductionId).then(r => {
datas.value = r.data ?? [];
console.error(n, datas.value);
});
}
};
watch(() => props.deduction, (n: DeductionPod | null | undefined) => {
load(n);
}, { deep: true, immediate: true });
return {
handleCancel,
datas,
};
},
}));
</script>
<!--<style lang="less">-->
<!--.ks-charts-modal{-->
<!-- background: url('@/assets/icons/bg-model-builder-canvas.png') center / 100% 100%;-->
<!-- .ant-modal-content{-->
<!-- padding:0;-->
<!-- border: 1px solid #041a3c;-->
<!-- }-->
<!-- .ant-modal-header{-->
<!-- height: 55px;-->
<!-- line-height: 50px;-->
<!-- background: #041125;-->
<!-- background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);-->
<!-- border-radius: 0;-->
<!-- }-->
<!-- .ant-modal-close {-->
<!-- position: absolute;-->
<!-- top: 13px;-->
<!-- }-->
<!-- .ks-charts-modal-title,-->
<!-- .ant-modal-title {-->
<!-- line-height: 55px;-->
<!-- font-size:16px;-->
<!-- }-->
<!-- .ant-modal-body{-->
<!-- height: 90vh;-->
<!-- overflow: auto;-->
<!-- border-top: 1px solid #181d26;-->
<!-- background: #041125;-->
<!-- }-->
<!-- .ks-charts-modal-icon{-->
<!-- background: url('@/assets/icons/m-03.png') center / 100% 100%;-->
<!-- width: 30px;-->
<!-- height:30px;-->
<!-- display:block;-->
<!-- }-->
<!--}-->
<!--.ks-model-chart-card {-->
<!-- border-color: #161c26;-->
<!-- border-radius: 0;-->
<!-- margin-bottom: 15px;-->
<!-- background: transparent;-->
<!-- .ks-model-chart-card-icon{-->
<!-- width: 30px;-->
<!-- height:30px;-->
<!-- display:block;-->
<!-- &.grid-icon{-->
<!-- background: url('@/assets/icons/icon-grid.png') center / 100% 100%;-->
<!-- }-->
<!-- &.model-icon{-->
<!-- background: url('@/assets/icons/icon-model-input.png') center / 100% 100%;-->
<!-- }-->
<!-- }-->
<!-- .ant-card-head {-->
<!-- border-color: #161c26;-->
<!-- color: #eee;-->
<!-- border-radius: 0;-->
<!-- background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);-->
<!-- }-->
<!-- .ks-model-chart-item {-->
<!-- height: 500px;-->
<!-- padding: 15px;-->
<!-- border: 1px solid #0a2651;-->
<!-- margin-bottom: 15px;-->
<!-- color: #eee;-->
<!-- border-radius: 2px;-->
<!-- background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);-->
<!-- &.size-small{-->
<!-- height: 300px;-->
<!-- }-->
<!-- &:hover{-->
<!-- border-color: #2f3b4e;-->
<!-- cursor: pointer;-->
<!-- }-->
<!-- .ant-statistic-title {-->
<!-- color: #eee;-->
<!-- }-->
<!-- }-->
<!-- .ks-model-chart-item-description{-->
<!-- display:inline-block;-->
<!-- width: 100%;-->
<!-- text-align: center;-->
<!-- position: absolute;-->
<!-- bottom: 0px;-->
<!-- left: 0%;-->
<!-- span{-->
<!-- display:inline-block;-->
<!-- width: 100%;-->
<!-- font-weight: bold;-->
<!-- }-->
<!-- }-->
<!--}-->
<!--</style>-->

View File

@@ -1,87 +0,0 @@
<template>
<div class="ks-model-chart-item-child" style="width:50%;display: block;float:left;position: relative">
<div class="ks-model-chart-item-wrapper" ref="chartContainer" style="height:350px;"></div>
<div class="ks-model-chart-item-description">
<span class="pre">{{ lastItem?.redWinRounds ?? 0}} {{ lastItem?.blueWinRounds ?? 0}}</span>
<span class="total">{{ deductionPod.totalRound??0 }}</span>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, nextTick, type PropType, ref, watch } from 'vue';
import * as echarts from 'echarts';
import type { ModelDeductionData, DeductionPod } from '../types';
import { createPieChartOption } from './pie-options';
export default defineComponent({
props: {
datas: {
type: Array as PropType<ModelDeductionData[]>,
default: [],
},
deductionPod: {
type: [Object] as PropType<DeductionPod|null | undefined>,
},
redName: {
type: String as PropType<String>,
default: '红方',
},
blueName: {
type: String as PropType<String>,
default: '蓝方',
},
},
setup(props) {
const chartContainer = ref<HTMLElement | null>(null);
let chartInstance: echarts.ECharts | null = null;
const deductionPod = ref<Partial<DeductionPod>>({})
const lastItem = ref<ModelDeductionData|null | undefined>(null)
const initChart = (option: any) => {
if (!chartContainer.value) return;
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(chartContainer.value);
chartInstance.setOption(option);
// 自适应窗口大小(可选,提升体验)
window.addEventListener('resize', () => {
chartInstance?.resize();
});
};
const load = (d: ModelDeductionData[]) => {
const blueName = props.blueName ?? '蓝方';
const redName = props.redName ?? '红方';
let pre = 0;
lastItem.value = null;
if (d && d.length >= 1) {
lastItem.value = d[d.length - 1] as ModelDeductionData;
const mineRounds = lastItem.value?.redWinRounds ?? 0;
const totalRound = props.deductionPod?.totalRound ?? 0;
if (totalRound > 0) {
pre = Number((mineRounds / totalRound * 100).toFixed(2));
}
console.error('red',mineRounds,totalRound)
}
const options = createPieChartOption(`${redName}胜率`, 'red', pre, `${redName}胜率`, blueName as string, redName as string);
nextTick(() => initChart(options));
};
watch(() => props.datas, (n: ModelDeductionData[]) => load(n), { deep: true, immediate: true });
watch(() => props.deductionPod, (n: DeductionPod | null| undefined ) => deductionPod.value = n ?? {}, { deep: true, immediate: true });
return {
lastItem,
deductionPod,
chartContainer
};
}
});
</script>

View File

@@ -1,376 +0,0 @@
<template>
<Layout>
<a-card class="ks-page-card ks-charts-wrapper">
<template #title>
<a-space>
<span class="point"></span>
<span class="text">指标效果对比</span>
<a-tooltip placement="top">
<template #title>
返回
</template>
<a-button class="ks-page-card-goback" size="small" @click="goback">
<RollbackOutlined />
<span>返回</span>
</a-button>
</a-tooltip>
</a-space>
</template>
<div class="ks-scrollable">
<div class="ks-model-charts" style="height: 80vh;position: relative;overflow: auto">
<a-card class="ks-model-chart-card ks-model-chart-card-carousel">
<template #title>
<a-space>
<span class="ks-model-chart-card-icon model-icon"></span>
<span>多维度算法指标对比</span>
</a-space>
</template>
<a-carousel
arrows
:dots="false"
:slides-to-show="3"
:slides-to-scroll="1"
arrow="always"
:autoplay="false"
class="chart-carousel"
>
<template #prevArrow>
<div class="custom-slick-arrow prev-arrow" style="z-index: 1">
<left-circle-outlined />
</div>
</template>
<template #nextArrow>
<div class="custom-slick-arrow next-arrow">
<right-circle-outlined />
</div>
</template>
<div class="slick-slide-item">
<Chart001 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
<div class="slick-slide-item">
<Chart0021 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
<div class="slick-slide-item">
<Chart0022 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
<div class="slick-slide-item">
<Chart0023 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
<div class="slick-slide-item">
<Chart0024 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
<div class="slick-slide-item">
<Chart003 :datas="datas" :redName="redName" :blueName="blueName"/>
</div>
</a-carousel>
</a-card>
<a-card class="ks-model-chart-card">
<template #title>
<a-space>
<span class="ks-model-chart-card-icon grid-icon"></span>
<span>多维度仿真推演效果对比</span>
</a-space>
</template>
<a-row :gutter="15">
<a-col :span="24">
<div class="ks-model-chart-item" style="height:380px;">
<ChartRed :datas="datas" :deduction-pod="deductionPodDetails" :redName="redName" :blueName="blueName"/>
<ChartBlue :datas="datas" :deduction-pod="deductionPodDetails" :redName="redName" :blueName="blueName"/>
</div>
</a-col>
</a-row>
<a-row :gutter="15">
<a-col :span="12">
<Chart004 :datas="datas" :redName="redName" :blueName="blueName"/>
</a-col>
<a-col :span="12">
<Chart005 :datas="datas" :redName="redName" :blueName="blueName"/>
</a-col>
</a-row>
<a-row :gutter="15">
<!-- <a-col :span="12">-->
<!-- <Chart006 :datas="datas" :redName="redName" :blueName="blueName"/>-->
<!-- </a-col>-->
<a-col :span="12">
<Chart007 :datas="datas" :redName="redName" :blueName="blueName"/>
</a-col>
<a-col :span="12">
<Chart008 :datas="datas" :redName="redName" :blueName="blueName"/>
</a-col>
<!-- <a-col :span="12">-->
<!-- <Chart009 :datas="datas" :redName="redName" :blueName="blueName"/>-->
<!-- </a-col>-->
</a-row>
</a-card>
</div>
</div>
</a-card>
</Layout>
</template>
<script lang="ts">
import { defineComponent, type PropType, ref, watch } from 'vue';
import { LeftCircleOutlined, RightCircleOutlined, RollbackOutlined } from '@ant-design/icons-vue';
import {useRouter} from 'vue-router'
import Chart001 from './charts-001.vue';
import Chart002 from './charts-002.vue';
import Chart0021 from './charts-002-1.vue';
import Chart0022 from './charts-002-2.vue';
import Chart0023 from './charts-002-3.vue';
import Chart0024 from './charts-002-4.vue';
import Chart003 from './charts-003.vue';
import Chart004 from './charts-004.vue';
import Chart005 from './charts-005.vue';
import Chart006 from './charts-006.vue';
import Chart007 from './charts-007.vue';
import Chart008 from './charts-008.vue';
import Chart009 from './charts-009.vue';
import ChartBlue from './charts-blue.vue';
import ChartRed from './charts-red.vue';
import Layout from '../../layout.vue'
import type { DeductionPod, ModelDeductionData } from '../types';
import { findChartsDataById, findOneModelDeductionDetails } from '../api';
export default defineComponent({
components: {
RollbackOutlined,
Layout,
LeftCircleOutlined,
RightCircleOutlined,
Chart001,
Chart002,
Chart0021,
Chart0022,
Chart0023,
Chart0024,
Chart003,
Chart004,
Chart005,
Chart006,
Chart007,
Chart008,
Chart009,
ChartBlue,
ChartRed,
},
props: {
visible: {
type: Boolean,
},
deduction: {
type: [Object, null, undefined] as PropType<DeductionPod | null | undefined>,
},
},
emits: ['cancel'],
setup(_props, { emit }) {
const router = useRouter();
const datas = ref<ModelDeductionData[]>([]);
const deductionPodDetails = ref<DeductionPod | null | undefined>(null);
const blueName = ref<string>('蓝方')
const redName = ref<string>('红方')
const handleCancel = () => {
emit('cancel');
};
const goback = () => {
router.push({
path: '/app/ai/applications/gambling',
})
}
const load = (n: any) => {
deductionPodDetails.value = null
if (n?.params?.id) {
findOneModelDeductionDetails(n?.params?.id).then(rv=> {
deductionPodDetails.value = rv.data;
blueName.value = rv.data?.blueName ?? '蓝方';
redName.value = rv.data?.redName ?? '红方';
if(rv.data.deductionId) {
findChartsDataById(rv.data.deductionId).then(r => {
datas.value = (r.data ?? []).reverse();
console.error(n, datas.value);
});
}
})
}
};
watch(() => router.currentRoute.value, (n:any) => {
load(n);
}, { deep: true, immediate: true });
return {
goback,
deductionPodDetails,
handleCancel,
datas,
blueName,
redName,
};
},
});
</script>
<style lang="less">
.ks-charts-modal{
background: url('@/assets/icons/bg-model-builder-canvas.png') center / 100% 100%;
.ant-modal-content{
padding:0;
border: 1px solid #041a3c;
}
.ant-modal-header{
height: 55px;
line-height: 50px;
background: #041125;
background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);
border-radius: 0;
}
.ant-modal-close {
position: absolute;
top: 13px;
}
.ks-charts-modal-title,
.ant-modal-title {
line-height: 55px;
font-size:16px;
}
.ant-modal-body{
height: 90vh;
overflow: auto;
border-top: 1px solid #181d26;
background: #041125;
}
.ks-charts-modal-icon{
background: url('@/assets/icons/m-03.png') center / 100% 100%;
width: 30px;
height:30px;
display:block;
}
}
.ks-model-chart-card {
border-color: #161c26;
border-radius: 0;
margin-bottom: 15px;
background: transparent;
position: relative;
.ks-model-chart-card-icon{
width: 30px;
height:30px;
display:block;
&.grid-icon{
background: url('@/assets/icons/icon-grid.png') center / 100% 100%;
}
&.model-icon{
background: url('@/assets/icons/icon-model-input.png') center / 100% 100%;
}
}
.ant-card-head {
border-color: #161c26;
color: #eee;
border-radius: 0;
background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);
}
.ks-model-chart-item {
height: 500px;
display: block;
width: 100%;
padding: 15px;
border: 1px solid #0a2651;
margin-bottom: 15px;
color: #eee;
border-radius: 2px;
position: relative;
background: linear-gradient(359deg, #010c1d 1%, #041a3c 55%);
&.size-small{
height: 300px;
}
&:hover{
border-color: #2f3b4e;
cursor: pointer;
}
.ant-statistic-title {
color: #eee;
}
}
&.ks-model-chart-card-carousel{
.ks-model-chart-item{
margin-bottom: 0;
}
}
.ks-model-chart-item-description{
display:inline-block;
width: 100%;
text-align: center;
position: absolute;
bottom: 0px;
left: 0%;
span{
display:inline-block;
width: 100%;
font-weight: bold;
}
}
}
.chart-carousel {
position: relative;
.slick-slide-item {
width: calc(100% / 3 - 5px);
margin: 0 5px;
box-sizing: border-box;
padding: 0 10px;
position: relative;
}
// 自定义箭头样式优化(适配深色主题)
.custom-slick-arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 35px;
height: 35px;
font-size: 30px;
color: #eee;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
opacity: 0.3;
z-index: 20;
&:before {
display: none;
}
&:hover {
color: #fff;
opacity: 0.9;
}
&.prev-arrow {
left: 0px;
z-index: 20;
}
&.next-arrow {
right: 0px;
z-index: 20;
}
}
}
</style>

View File

@@ -1,110 +0,0 @@
/*
* 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.
*/
export const commonAxisConfig = {
axisLabel: {
color: '#eee',
fontSize: 12
},
axisLine: {
lineStyle: {
color: '#1e3150'
}
},
axisTick: {
lineStyle: {
color: '#1e3150'
}
},
splitLine: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.1)'
}
}
};
export const getRadialGradient = (colorStart: string, colorEnd: string) => {
return {
type: 'radial', // 径向渐变(饼图首选)
x: 0.5, // 渐变中心x坐标0-10.5为饼图中心)
y: 0.5, // 渐变中心y坐标
r: 0.5, // 渐变半径0-10.5适配饼图内半径到外半径)
colorStops: [
{ offset: 0, color: colorStart }, // 中心颜色(深)
{ offset: 1, color: colorEnd } // 边缘颜色(浅)
],
global: false // 局部渐变(仅作用于当前扇区)
};
};
export const getVerticalGradient = (colorStart: string, colorEnd: string) => {
return {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: colorStart }, // 顶部颜色(深)
{ offset: 1, color: colorEnd } // 底部颜色(浅)
]
};
};
export const xAxisConfig = {
splitLine: {
show: true,
lineStyle: {
color: 'rgba(255, 255, 255, 0.1)' // 网格线颜色(半透明白色)
}
},
axisLabel: {
color: '#eee',
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
axisLine: {
show: true,
lineStyle: {
color: '#1e3150' // X轴线颜色可选
},
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
}
export const yAxisConfig = {
splitLine: {
show: true,
lineStyle: {
color: 'rgba(255, 255, 255, 0.1)' // 网格线颜色(半透明白色)
}
},
axisLabel: {
color: '#eee',
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
axisLine: {
show: true,
lineStyle: {
color: '#1e3150' // X轴线颜色可选
},
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
}

View File

@@ -1,265 +0,0 @@
/*
* 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 { xAxisConfig } from './config';
import type { ChartOption } from './types';
export interface LineChartOption extends ChartOption{
}
export const createLineChartOption = (options: LineChartOption = {}) => {
let blueName = options.blueName ?? '蓝方';
let redName = options.redName ?? '红方';
return {
title: {
text: options.title,
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 16,
},
},
tooltip: {
trigger: 'axis',
textStyle: {
color: '#999', // 提示框字体颜色
},
},
grid: {
left: '1%',
right: '5%',
bottom: options.xAxisDataVisible ? '15%' : '10%',
containLabel: true,
},
legend: {
data: [blueName, redName],
textStyle: {
color: '#ddd',
fontSize: 14,
},
},
xAxis: {
show: options.xAxisDataVisible,
type: 'category',
data: options.xAxisData,
boundaryGap: [0.1, 0.1],
...xAxisConfig,
},
yAxis: {
type: 'value',
boundaryGap: [0.1, 0.1],
...xAxisConfig,
},
series: [
{
name: blueName,
type: 'line',
// stack: 'Total',
data: options.blueData,
lineStyle: {
color: '#409EFF',
width: 2,
},
itemStyle: {
color: '#409EFF',
},
emphasis: {
itemStyle: {
color: 'blue', // 高亮时填充色(白色)
borderColor: '#409EFF', // 高亮时边框色
borderWidth: 4,
},
symbolSize: 12, // 高亮时圆点放大
},
label: {
show: options.labelVisible, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12, // 数值文字大小
},
},
},
{
name: redName,
type: 'line',
// stack: 'Total',
data: options.redData,
lineStyle: {
color: '#bc1f1f',
width: 2,
},
itemStyle: {
color: '#bc1f1f',
},
emphasis: {
itemStyle: {
color: 'blue', // 高亮时填充色(白色)
borderColor: 'red', // 高亮时边框色
borderWidth: 4,
},
symbolSize: 12, // 高亮时圆点放大
},
label: {
show: options.labelVisible, // 开启数值显示
position: 'top', // 数值显示在柱子顶部可选top/inside/outside/bottom等
textStyle: {
color: '#eee', // 数值文字颜色
fontSize: 12, // 数值文字大小
},
},
},
],
};
};
// line-options.ts
export interface ChartOptimizationOptions {
showAllSymbol?: boolean;
animation?: boolean;
large?: boolean;
progressive?: number;
progressiveThreshold?: number;
}
export const createOptimizedLineChartOption = (
title: string,
xAxisData: string[],
blueData: number[],
redData: number[],
optimization: ChartOptimizationOptions = {}
): echarts.EChartsOption => {
const {
showAllSymbol = false,
animation = false,
large = true,
progressive = 500,
progressiveThreshold = 1000,
} = optimization;
return {
title: {
text: title,
left: 'center',
textStyle: {
fontSize: 16,
fontWeight: 'bold'
}
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
// 大数据时优化tooltip性能
confine: true,
appendToBody: true,
},
legend: {
data: ['蓝方轨迹', '红方轨迹'],
bottom: 10
},
grid: {
left: '3%',
right: '4%',
bottom: '15%',
top: '15%',
containLabel: true
},
xAxis: {
type: 'category',
data: xAxisData,
axisLabel: {
rotate: 45,
// 减少标签显示密度
interval: (index: number) => index % 50 === 0,
},
// 大数据优化
splitLine: {
show: false
}
},
yAxis: {
type: 'value',
name: '归一化值',
// 大数据优化
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
dataZoom: [
{
type: 'inside',
start: 0,
end: 100,
minValueSpan: 10
},
{
show: true,
type: 'slider',
top: '90%',
start: 0,
end: 100
}
],
series: [
{
name: '蓝方轨迹',
type: 'line',
data: blueData,
smooth: false, // 大数据时关闭平滑,提高性能
lineStyle: {
width: 1 // 减小线宽
},
itemStyle: {
color: '#1890ff'
},
// 性能优化配置
showSymbol: showAllSymbol,
symbol: 'circle',
symbolSize: 2, // 减小符号大小
animation: animation,
animationThreshold: 2000,
animationDuration: 1000,
animationEasing: 'cubicOut',
// 大数据模式优化
progressive: progressive,
progressiveThreshold: progressiveThreshold,
progressiveChunkMode: 'mod',
// 采样策略
sampling: 'lttb', // 使用LTTB采样算法保留趋势特征
},
{
name: '红方轨迹',
type: 'line',
data: redData,
smooth: false,
lineStyle: {
width: 1
},
itemStyle: {
color: '#ff4d4f'
},
showSymbol: showAllSymbol,
symbol: 'circle',
symbolSize: 2,
animation: animation,
animationThreshold: 2000,
animationDuration: 1000,
animationEasing: 'cubicOut',
progressive: progressive,
progressiveThreshold: progressiveThreshold,
progressiveChunkMode: 'mod',
sampling: 'lttb',
}
]
};
};

View File

@@ -1,173 +0,0 @@
/*
* 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.
*/
// 限定核心取值范围,同时保留扩展空间
export type PieChartSide = 'blue' | 'red' | string
export const createPieChartOption = (
title: string,
side: PieChartSide,
progressPercent: number | null,
centerText: string,
blueName: string,
redName: string,
) => {
// 定义基础颜色常量,提升可读性
const RED = '#bc1f1f';
const BLUE = '#205aae';
let color: string[];
// side=blue → 已占用(第一个元素)=红色,未占用(第二个)=蓝色
// side=red → 已占用(第一个元素)=蓝色,未占用(第二个)=红色
if (side === 'blue') {
color = [RED, BLUE];
} else if (side === 'red') {
color = [BLUE, RED];
} else {
// 兼容其他字符串值,使用默认逻辑
color = [RED, BLUE];
}
let blueNameText = blueName ?? '蓝方';
let redNameText = redName ?? '红方';
// 处理 null 值,避免显示 null%
const safeProgressPercent = Number(Number(progressPercent ?? 0).toFixed(2));
const realData = [
{ value: safeProgressPercent, name: side === 'blue' ? redNameText : blueNameText },
{ value: Number(Number(100 - safeProgressPercent).toFixed(2)), name: side === 'blue' ? blueNameText : redNameText }
]
// 核心修改1文本截取逻辑 - 只显示前4个字符
const displayText = centerText.length > 4 ? `${centerText.substring(0, 4)}...` : centerText;
// 保存完整文本用于tooltip显示
const fullCenterText = centerText;
console.error('realData',realData)
return {
title: {
text: title,
textStyle: {
color: '#eee',
fontSize: 16
}
},
tooltip: {
trigger: 'item',
textStyle: {
color: '#999'
},
// 核心修改2自定义tooltip格式化内容显示完整文本
formatter: (params: any) => {
return `
<div style="text-align: center;">
<div>${params.name}: ${params.value}%</div>
<div style="margin-top: 4px;">${fullCenterText}</div>
</div>
`;
}
},
grid: {
left: '1%',
right: '5%',
bottom: '1%',
top: '30%',
containLabel: true
},
xAxis: {
show: false,
axisLabel: {
color: '#eee',
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
axisLine: {
lineStyle: {
color: '#eee' // X轴线颜色可选
},
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
},
yAxis: {
show: false,
axisLabel: {
color: '#eee',
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
axisLine: {
lineStyle: {
color: '#eee' // X轴线颜色可选
},
textStyle: {
color: '#EEE', // 标题字体颜色
fontSize: 14
}
},
},
series: [
{
type: 'pie',
radius: ['40%', '60%'],
center: ['50%', '50%'],
data: realData,
color: color,
itemStyle: {
borderWidth: 0
},
// 启用饼图中心标签
label: {
show: true,
position: 'center',
// 核心修改3使用截取后的文本显示
formatter: `{a|${safeProgressPercent}%}\n{b|${displayText}}`,
rich: {
a: {
fontSize: 28,
fontWeight: 'bold',
color: '#eee',
lineHeight: 36
},
b: {
fontSize: 16,
color: '#ccc',
lineHeight: 24
}
}
},
// 禁用外部标签
labelLine: {
show: false
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
// 悬停时也显示中心标签
label: {
show: true,
fontSize: 28,
fontWeight: 'bold'
}
}
}
]
};
};

View File

@@ -1,126 +0,0 @@
/*
* 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 { xAxisConfig } from './config';
import type { ChartOption } from './types';
export interface ScatterChartOption extends ChartOption{
}
// 自定义三角形路径(调整尺寸适配显示)
export const triangleSymbol = 'path://M0,-6 L6,6 L-6,6 Z';
export const createScatterChartOption = (options: ScatterChartOption) => {
let blueName = options.blueName ?? '蓝方';
let redName = options.redName ?? '红方';
return {
title: {
text: options.title,
textStyle: {
color: '#eee',
fontSize: 16
}
},
tooltip: {
trigger: 'axis',
textStyle: {
color: '#999'
}
},
grid: {
left: '1%',
right: '5%',
bottom: '15%',
containLabel: true
},
legend: {
data: [blueName, redName],
textStyle: {
color: '#ddd',
fontSize: 14
}
},
xAxis: {
type: 'category',
data: options.xAxisData,
boundaryGap: [0.1, 0.1],
...xAxisConfig
},
yAxis: {
type: 'value',
boundaryGap: [0.1, 0.5],
...xAxisConfig
},
series: [
{
name: blueName,
type: 'scatter',
data: options.blueData,
symbol: 'circle', // 显式指定蓝方使用圆点ECharts默认也是circle显式设置更清晰
symbolSize: 8, // 圆点大小
itemStyle: {
color: '#409EFF' // 圆点颜色
},
emphasis: {
itemStyle: {
color: 'white',
borderColor: '#409EFF',
borderWidth: 2
},
symbolSize: 12
},
// 数值标签配置 - 显示在圆点上方
label: {
show: false,
position: 'top',
formatter: '{c}', // 直接显示数据值
textStyle: {
color: '#eee',
fontSize: 12,
fontWeight: 'bold'
},
offset: [0, -10] // 调整偏移量,让标签在圆点上方显示更美观
}
// 移除了markPoint配置去掉额外的三角形
},
{
name: redName,
type: 'scatter',
data: options.redData,
symbol: triangleSymbol, // 红方使用自定义三角形
symbolSize: 12, // 三角形尺寸(比原圆点稍大,保证视觉清晰)
itemStyle: {
color: '#bc1f1f' // 三角形颜色
},
emphasis: {
itemStyle: {
color: 'white',
borderColor: '#bc1f1f',
borderWidth: 2
},
symbolSize: 16 // 高亮时三角形放大
},
// 红方的数值标签配置
label: {
show: false,
position: 'top',
formatter: '{c}', // 直接显示数据值
textStyle: {
color: '#eee',
fontSize: 12,
fontWeight: 'bold'
},
offset: [0, -15] // 三角形高度更高,标签偏移量稍大
}
},
]
}
};

View File

@@ -1,30 +0,0 @@
/*
* 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 { ModelDeductionData } from '../types';
export interface ChartOption {
title?: string,
blueName?: string|undefined,
redName?: string|undefined,
xAxisData?: string[],
blueData?: any[],
redData?: any[],
xAxisDataVisible?: boolean,
labelVisible?: boolean,
}
export interface ChartLineData {
name: string,
xAxisData: string[],
blueData: number[],
redData: number [],
options: any,
deduction: ModelDeductionData,
}

View File

@@ -1,25 +0,0 @@
/*
* 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.
*/
export const downSampleData = (data: number[], targetCount = 200): number[] => {
if (!data.length || data.length <= targetCount) return data;
const step = Math.ceil(data.length / targetCount);
const sampledData: number[] = [];
for (let i = 0; i < data.length; i += step) {
sampledData.push(data[i] as any);
}
if (sampledData[sampledData.length - 1] !== data[data.length - 1]) {
sampledData[Number(sampledData?.length - 1)] = data[data.length - 1] as number;
}
return sampledData;
};

View File

@@ -1,35 +0,0 @@
/*
* 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 { ModelDeduction } from './types';
export const defaultModelDeduction = {
// 推演记录ID
id: null,
deductionId: null,
// 部署模型路径
deploymentModelPath: null,
// 对抗轮数配置
competitionRound: null,
// 对抗场次配置
competitionSession: 1,
// 推演倍数设置
deductionMultiple: 1,
// 并发调度配置
balanceStrategy: 1,
// 对抗模式选择
competitionMode: 1,
// 蓝方名称
blueNames: null,
// 红方名称
redNames: null,
// 数据状态1-正常0-已删除)
status: null,
stopped: false,
} as ModelDeduction;

View File

@@ -1,673 +0,0 @@
<template>
<Layout>
<a-card class="ks-page-card ks-cards-wrapper">
<template #title>
<a-space>
<span class="point"></span>
<span class="text">博弈竞赛单元运行环境</span>
</a-space>
</template>
<div class="ks-scrollable">
<a-row :gutter="15">
<a-col :span="8">
<!-- 基础配置卡片 -->
<a-card data-step="0" title="基础配置" class="ks-apps-card ks-top-apps-card">
<a-form
:model="modelDeduction"
autocomplete="off"
layout="horizontal"
:label-col="{span: 6}"
name="basic"
>
<a-form-item
label="部署模型选择"
name="deploymentModelPath"
>
<Finder :path="modelDeduction.deploymentModelPath"
@select="(p: string|null) => modelDeduction.deploymentModelPath = p" />
</a-form-item>
<a-form-item
label="对抗轮数配置"
name="competitionRound"
>
<a-input v-model:value="modelDeduction.competitionRound" placeholder="对抗轮数配置" style="width: 100%" />
</a-form-item>
<a-form-item
label="对抗场次配置"
name="competitionSession"
>
<a-input-number min="1" v-model:value="modelDeduction.competitionSession" placeholder="对抗场次配置" style="width: 100%" />
</a-form-item>
<a-form-item
label="推演倍数设置"
name="deductionMultiple"
>
<a-form-item-rest>
<a-flex>
<a-slider v-model:value="modelDeduction.deductionMultiple" :max="1000" :min="0" style="width:100%;" />
<a-input-number v-model:value="modelDeduction.deductionMultiple" :min="0" :max="1000" style="margin-left: 10px; width: 120px;" />
<span style="width: 80px; margin-left: 5px;color:#eee; line-height: 34px;"> / 1000</span>
</a-flex>
</a-form-item-rest>
</a-form-item>
<a-form-item
label="对抗模式选择"
name="competitionMode"
>
<a-select placeholder="请选择对抗模式" v-model:value="modelDeduction.competitionMode"
@change="(v: number | undefined | null)=> modelDeduction.competitionMode = v">
<a-select-option :value="1">循环赛</a-select-option>
<a-select-option :value="2">瑞士轮</a-select-option>
<a-select-option :value="3">单败淘汰赛</a-select-option>
<a-select-option :value="4">双败淘汰赛</a-select-option>
</a-select>
</a-form-item>
<a-form-item
label="并发调度配置"
name="balanceStrategy"
>
<a-select placeholder="并发调度配置" v-model:value="modelDeduction.balanceStrategy"
@change="(v: number | undefined | null)=> modelDeduction.balanceStrategy = v">
<a-select-option :value="1">均衡调度策略</a-select-option>
<a-select-option :value="2">集约调度策略</a-select-option>
<a-select-option :value="3">优先调度策略</a-select-option>
<a-select-option :value="4">触发调度策略</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-card>
<!-- 对抗配置卡片 -->
<a-card data-step="0" title="对抗配置" class="ks-apps-card ks-bottom-apps-card">
<a-form
autocomplete="off"
layout="horizontal"
:label-col="{span: 6}"
name="basic"
>
<a-form-item
label="蓝方"
name="taskName"
>
<div class="counter-wrapper">
<div class="counter-wrapper-item" v-for="i in blueCounter" :key="`blue-${i}`">
<a-row :gutter="15">
<a-col :span="19">
<Finder :only-directory="false" @select="(_p: any, f: any)=> blueNames[i] = f.name"/>
</a-col>
<a-col :span="5" v-if="i == 1">
<a-space>
<plus-circle-outlined @click="()=> add('blue')"/>
<minus-circle-outlined @click="()=> minus('blue')"/>
</a-space>
</a-col>
</a-row>
</div>
</div>
</a-form-item>
<a-form-item
label="红方"
name="t"
>
<div class="counter-wrapper">
<div class="counter-wrapper-item" v-for="i in redCounter" :key="`red-${i}`">
<a-row :gutter="15">
<a-col :span="19">
<Finder :only-directory="false" @select="(_p: any, f: any)=> redNames[i] = f.name"/>
</a-col>
<a-col :span="5" v-if="i == 1">
<a-space>
<plus-circle-outlined @click="()=> add('red')"/>
<minus-circle-outlined @click="()=> minus('red')"/>
</a-space>
</a-col>
</a-row>
</div>
</div>
</a-form-item>
</a-form>
</a-card>
</a-col>
<a-col :span="16">
<!-- 智能博弈空战卡片 -->
<a-card data-step="0" class="ks-pks-card ks-pk-apps-card">
<template #title>
<a-flex :gap="8">
<span style="margin-top: 5px;color:#eee;font-size:16px">智能博弈空战</span>
<span style="color:#999;font-size: 15px;line-height: 32px;margin-left: 40px;">
当前场次 {{ deductionPods.length }} 队伍数: {{ deductionPods.length * 2 }}
</span>
<a-button style="margin-left: auto; color:#fff;" @click="()=> startLoop()">
<a-flex>
<PlayCircleOutlined/>
<span style="margin-left: 10px;">对抗开始</span>
</a-flex>
</a-button>
<a-button style="margin-left: 15px;color:#fff;" @click="()=> rankingModelVisible = true">
<a-flex>
<OrderedListOutlined/>
<span style="margin-left: 10px;">排名统计</span>
</a-flex>
</a-button>
</a-flex>
</template>
<div class="w-full mt-2" style="margin-top: 15px;">
<a-row :gutter="15">
<a-col :span="8" v-for="(item,i) in deductionPods" :key="`pod-${item.id}`">
<a-card class="ks-pk-card" hoverable>
<template #title>
<a-flex>
<span class="ks-card-title"> {{i + 1}} </span>
</a-flex>
</template>
<div class="pk-wrapper">
<div class="pk-overlay" @click="()=> handleClickPkCard(item)"></div>
<div class="pk-teams" @click="()=> handleClickPkCard(item)">
<span class="left-team">
<a-tooltip placement="bottom">
<template #title>
{{item.blueName ?? `蓝方${i+1}`}}
</template>
{{getTeamName(item.blueName,'blue', i + 1)}}
</a-tooltip>
</span>
<span class="right-team">
<a-tooltip placement="bottom">
<template #title>
{{item.redName ?? `红方${i+1}`}}
</template>
{{getTeamName(item.redName,'red', i + 1)}}
</a-tooltip>
</span>
</div>
<div class="pk-footer">
<a-flex>
<a-progress
:percent="item.targetPercent"
:stroke-width="6"
style="margin-right: 30px;"
></a-progress>
<a-button :disabled="item.targetPercent < 100" class="pk-details-btn" size="small" @click="()=> handleDetails(item)">
对抗详情
</a-button>
</a-flex>
</div>
</div>
<template #extra class="pk-actions">
<a-space>
<span class="icon-action eye" @click="()=> handleTermStatusPopoverVisible(item)" style="margin-right: -5px;"></span>
<a-popover title="" trigger="click" v-model:open="item.termStatusPopoverVisible">
<template #content>
<a-flex>
<span style="width: 100px;text-align: right;">仿真运行状态: </span>
<span style="margin-left: 10px;">{{item.statusName ?? '-'}}</span>
</a-flex>
</template>
</a-popover>
<!-- <a-popover title="" trigger="click" v-if="item?.metricsParsed">-->
<!-- <span class="icon-action eye"></span>-->
<!-- <template #content v-if="item?.metricsParsed">-->
<!-- <a-flex>-->
<!-- <span style="width: 100px;text-align: right;">本轮总奖励: </span>-->
<!-- <span style="margin-left: 10px;">{{ item?.metricsParsed?.reward ?? '-' }}</span>-->
<!-- </a-flex>-->
<!-- <a-flex>-->
<!-- <span style="width: 100px;text-align: right;">本轮生存步数: </span>-->
<!-- <span style="margin-left: 10px;">{{ item?.metricsParsed?.steps ?? '-' }}</span>-->
<!-- </a-flex>-->
<!-- <template v-if="item?.metricsParsed?.details">-->
<!-- <a-flex>-->
<!-- <span style="width: 100px;text-align: right;">开火奖励累计值: </span>-->
<!-- <span style="margin-left: 10px;">{{ item.metricsParsed?.details.fire_reward ?? '-' }}</span>-->
<!-- </a-flex>-->
<!-- <a-flex>-->
<!-- <span style="width: 100px;text-align: right;">越界惩罚累计值: </span>-->
<!-- <span style="margin-left: 10px;">{{ item?.metricsParsed?.details.boundary_penalty ?? '-' }}</span>-->
<!-- </a-flex>-->
<!-- </template>-->
<!-- </template>-->
<!-- </a-popover>-->
<a-popconfirm
ok-text="确定"
cancel-text="取消"
@confirm="()=> confirmPause(item)"
>
<template #title>
确定{{ item.simulationStatus === 1 ? '暂停' : '开始' }}
</template>
<span :class="['icon-action', item.simulationStatus === 1 ? 'pause' : 'start']">
</span>
</a-popconfirm>
<a-popconfirm
title="确定删除?"
ok-text="确定"
cancel-text="取消"
@confirm="()=> confirmDelete(item)"
>
<span class="icon-action delete"></span>
</a-popconfirm>
</a-space>
</template>
</a-card>
</a-col>
</a-row>
</div>
</a-card>
</a-col>
</a-row>
</div>
</a-card>
<ChartsModal :deduction="selectedDeduction" :visible="chartsModalVisible" @cancel="()=> chartsModalVisible = false" />
<RankingModel :visible="rankingModelVisible" @cancel="()=> rankingModelVisible = false"/>
</Layout>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, ref } from 'vue';
import {useRouter} from 'vue-router'
import { message } from 'ant-design-vue';
import Layout from '../layout.vue';
import { MinusCircleOutlined, OrderedListOutlined, PlayCircleOutlined, PlusCircleOutlined } from '@ant-design/icons-vue';
import RankingModel from './ranking-modal.vue';
import { createModelDeduction, deleteModelDeduction, findDeductionPodResult, runDeductionPodAfsimControl } from './api';
import type { DeductionPod, DeductionPodMetrics, ModelDeduction } from './types';
import Finder from '../finder.vue';
import { defaultModelDeduction } from './config';
import ChartsModal from './charts/charts-modal.vue';
import type { NullableString } from '@/types';
const chartsModalVisible = ref<boolean>(false);
const router = useRouter();
// 排名弹窗显隐
const rankingModelVisible = ref<boolean>(false)
// 红蓝方计数器
const redCounter = ref<number>(1);
const blueCounter = ref<number>(1);
const blueNames = ref<string[]>([])
const redNames = ref<string[]>([])
// 模型推演配置
const modelDeduction = ref<ModelDeduction>({ ...defaultModelDeduction });
// 推演Pods数据扩展类型增加进度更新定时器
const deductionPods = ref<(DeductionPod & {
animatePercent: number; // 动画进度值
targetPercent: number; // 目标进度值
stopped: boolean; // 是否暂停
progressTimer: any; // 动画定时器
updateTimer: any; // 进度更新定时器
})[]>([]);
// 心跳方法定时器标识
const heartbeatTimer = ref<any | null>(null);
const selectedDeduction = ref<DeductionPod | null | undefined>(null);
const getTeamName = (name: NullableString | undefined, side: string, level: number = 1): string => {
if(name){
if(name.length>3){
return name.substring(0,2) + '...';
}
return name;
}
return `${side === 'red' ? '红方' : '蓝方'}${level}`
}
const parseNumberPercent = (source: number|null , target: number|null) : number => {
if(source && target){
try{
return Number(Number((source/ target) * 100).toFixed(2));
} catch (e: any){
console.error(e);
}
}
return 0;
}
const handleDetails = (item: Partial<DeductionPod>) => {
// chartsModalVisible.value = true;
// selectedDeduction.value = JSON.parse(JSON.stringify(item));
router.push({
path: `/app/ai/applications/gambling/${item.id}/charts`
})
};
/**
* 随机更新进度值(核心修改:优化初始启动逻辑)
* @param pod 单个pod实例
*/
const randomUpdateProgress = (pod: any) => {
// 如果暂停或进度已到100%,直接返回
if (pod.stopped || pod.animatePercent >= 100) {
return;
}
// 随机生成下次更新时间1-3秒
const randomInterval = 1000 + Math.random() * 2000;
// 随机生成进度增长量1-5%
const randomIncrement = 1 + Math.random() * 4;
pod.updateTimer = setTimeout(() => {
// 计算新的目标进度不超过100%
pod.targetPercent = Math.min(pod.animatePercent + randomIncrement, 100);
// 启动进度动画
animateProgress(pod, pod.targetPercent);
// 递归调用,实现持续更新
randomUpdateProgress(pod);
}, randomInterval);
};
/**
* 暂停/开始进度更新
* @param item 单个pod实例
*/
const confirmPause = (item: any) => {
item.simulationStatus = item.simulationStatus === 1 ? 2 : 1;
runDeductionPodAfsimControl({
jobId: item.jobId,
afsimHostIp: item.afsimHostIp,
afsimNodePort81: item.afsimNodePort81,
type: item.simulationStatus, // 1-恢复仿真2-暂停仿真3-查询状态)
}).then(r=> {
message.info(r.msg);
if(r.code === 200) {
item.stopped = !item.stopped;
}
if(r.data?.stateDescription){
item.statusName = r.data.stateDescription;
}
})
// if (item.stopped) {
// // 暂停:清除进度更新定时器
// if (item.updateTimer) {
// clearTimeout(item.updateTimer);
// item.updateTimer = null;
// }
// message.info('已暂停');
// } else {
// // 开始:重新启动进度更新
// randomUpdateProgress(item);
// message.info('已恢复');
// }
};
const handleTermStatusPopoverVisible = (item: Partial<DeductionPod>)=> {
item.termStatusPopoverVisible = ! item.termStatusPopoverVisible;
runDeductionPodAfsimControl({
jobId: item.jobId,
afsimHostIp: item.afsimHostIp,
afsimNodePort81: item.afsimNodePort81,
type: 3, // 1-恢复仿真2-暂停仿真3-查询状态)
}).then(r=> {
message.info(r.msg);
if(r.data.stateDescription){
item.statusName = r.data.stateDescription;
}
})
}
/**
* 删除pod同时清除相关定时器
* @param item 单个pod实例
*/
const confirmDelete = (item: any) => {
console.error('confirmDelete', item);
// 清除该pod的所有定时器
if (item.updateTimer) clearTimeout(item.updateTimer);
if (item.progressTimer) clearInterval(item.progressTimer);
deleteModelDeduction(item.id as number).then(res => {
if (res.code === 200) {
message.info('删除成功.');
loadData();
}
});
};
// 进度条平滑动画函数(保留原有逻辑)
const animateProgress = (pod: any, targetPercent: number) => {
targetPercent = Math.max(0, Math.min(100, Number(targetPercent) || 0));
if (typeof pod.animatePercent !== 'number') {
pod.animatePercent = 0;
}
const step = 0.5;
if (pod.progressTimer) {
clearInterval(pod.progressTimer);
}
if (Math.abs(pod.animatePercent - targetPercent) < step) {
pod.animatePercent = targetPercent;
return;
}
pod.progressTimer = setInterval(() => {
if (pod.animatePercent < targetPercent) {
pod.animatePercent = Math.min(pod.animatePercent + step, targetPercent);
} else {
pod.animatePercent = Math.max(pod.animatePercent - step, targetPercent);
}
if (Math.abs(pod.animatePercent - targetPercent) < step) {
pod.animatePercent = targetPercent;
clearInterval(pod.progressTimer);
pod.progressTimer = null;
}
}, 30);
};
// 点击PK卡片打开链接保留原有逻辑
const handleClickPkCard = (item: DeductionPod) => {
if (item?.afsimHostIp && item?.afsimNodePort6901) {
let url = `${item.afsimHostIp}:${item.afsimNodePort6901}`;
if(!url.startsWith('http://') && !url.startsWith('https://')) {
url = 'https://' + url;
}
const newWindow = window.open(url);
if (!newWindow) {
message.warning('窗口打开失败,请检查浏览器弹窗设置');
}
} else {
message.warning('缺少IP或端口信息无法打开链接');
}
};
const refresh = () => {
if (deductionPods.value) {
deductionPods.value.forEach(podItem => {
console.info('refresh', podItem);
randomUpdateProgress(podItem);
});
}
};
// 加载数据方法核心修改确保每个pod初始化后立即启动进度更新
const loadData = () => {
findDeductionPodResult().then(r => {
let rows: DeductionPod[] = Object.values(r.data ?? []) as DeductionPod[];
const newPods: any[] = [];
rows.forEach(row=> {
let metricsParsed: DeductionPodMetrics | null = null;
try {
const metricsStr = row?.metrics?.toString() ?? '';
metricsParsed = metricsStr ? JSON.parse(metricsStr) as DeductionPodMetrics : null;
} catch (e: any) {
console.warn('解析 metrics 失败:', e);
}
// 初始化进度相关参数默认不暂停进度从0开始
const podItem = {
...row,
metricsParsed,
fake: false,
stopped: false, // 默认不暂停,页面加载后直接运行
targetPercent: parseNumberPercent(row.currentRound, row.totalRound), // 初始目标进度
animatePercent: 0, // 初始动画进度
progressTimer: null, // 动画定时器
updateTimer: null, // 进度更新定时器
statusName: null,
termStatusPopoverVisible: false,
};
newPods.push(podItem);
})
// setTimeout(() => refresh(), 1000);
deductionPods.value = newPods;
console.log('最终 deductionPods 数据:', deductionPods.value);
});
};
// 心跳方法(加载数据)
const heartbeat = () => {
loadData();
};
// 增加红蓝方计数器
const add = (side: string)=> {
if('blue' === side){
blueCounter.value ++;
} else {
redCounter.value ++;
}
};
// 减少红蓝方计数器
const minus = (side: string)=> {
if('blue' === side){
blueCounter.value = Math.max(1, blueCounter.value - 1);
blueNames.value = blueNames.value.splice(blueNames.value.length-1,1);
} else {
redCounter.value = Math.max(1, redCounter.value - 1);
redNames.value = redNames.value.splice(redNames.value.length-1,1);
}
};
// 开始对抗
const startLoop = () => {
modelDeduction.value.redNames = redNames.value.filter(v=> v).join(',')
modelDeduction.value.blueNames = blueNames.value.filter(v=> v).join(',')
createModelDeduction(modelDeduction.value).then(res => {
if (res.code === 200) {
message.success('对抗已开始');
if (heartbeatTimer.value) {
clearInterval(heartbeatTimer.value);
}
heartbeat();
heartbeatTimer.value = setInterval(() => {
heartbeat();
}, 10000);
} else if (res.msg) {
message.error(res.msg);
}
}).catch(err => {
console.error('提交配置失败:', err);
message.error('提交配置失败,请重试');
});
};
// 组件挂载时加载初始数据(页面加载完成后自动执行,触发进度模拟)
onMounted(() => {
// 页面挂载后立即加载数据数据加载完成后自动启动所有Pods的进度更新
loadData();
});
heartbeatTimer.value = setInterval(() => {
loadData();
}, 3000);
// 组件卸载时清除所有定时器(防止内存泄漏,增强版)
onUnmounted(() => {
// 清除心跳定时器
if (heartbeatTimer.value) {
clearInterval(heartbeatTimer.value);
}
// 清除所有pod的定时器
// deductionPods.value.forEach(pod => {
// if (pod.progressTimer) clearInterval(pod.progressTimer);
// if (pod.updateTimer) clearTimeout(pod.updateTimer);
// });
// 清空pods数据避免残留
deductionPods.value = [];
});
</script>
<style lang="less">
.bg-wrapper .ant-card {
&.ks-apps-card{
&.ks-top-apps-card {
margin-bottom:15px!important;
&> .ant-card-body{
height: 35vh;
overflow: hidden;
.ant-form-item{
margin-bottom:15px;
}
}
}
&.ks-bottom-apps-card{
margin-bottom:0px!important;
&> .ant-card-body{
height: 32vh;
overflow: auto;
.ant-form-item{
margin-bottom:15px;
}
}
}
}
&.ks-pk-apps-card{
&> .ant-card-body{
height: 74vh;
}
}
.counter-wrapper{
border: 1px solid #475f71;
padding: 15px;
border-radius: 2px;
.counter-wrapper-item{
margin-bottom:15px;
text-align: left;
.anticon{
color:#a2b1ba;
cursor: pointer;
font-size: 18px;
line-height: 30px;
display: block;
}
&:last-child{
margin-bottom:0;
}
}
}
}
// 进度条动画样式优化(增强平滑度)
.ant-progress-inner {
transition: width 0.05s ease-in-out;
}
.ant-progress-bg {
transition: width 0.05s ease-in-out;
}
</style>

View File

@@ -1,692 +0,0 @@
<template>
<a-modal :open="visible" class="ks-ranking-modal" centered width="98%" :footer="null" @cancel="handleCancel">
<div class="modal-overlay"></div>
<div class="ranking-container">
<!-- 表头 -->
<div class="table-header">
<div class="header-row">
<div class="header-cell rank">排名</div>
<div class="header-cell team">团队</div>
<div class="header-cell red-win-rate">红方胜率</div>
<div class="header-cell blue-win-rate">蓝方胜率</div>
<div class="header-cell red-matches">红方场次</div>
<div class="header-cell blue-matches">蓝方场次</div>
<div class="header-cell invalid-matches">博弈关键节点</div>
<div class="header-cell total-score">总分</div>
<div class="header-cell total-win-rate">总胜率</div>
</div>
</div>
<!-- 排行榜主体 -->
<div class="ranking-body">
<template v-for="(team, index) in sortedTeams">
<div
class="team-row"
:class="[team.isFlipping ? 'flipping' : '', indexClasses[index] ? indexClasses[index] : '']"
:style="getRowStyle(index)"
>
<div class="row-front">
<div class="cell rank" :class="getRankClass(team.rank)">
<span class="rank-number">{{ team.rank }}</span>
<!-- <span v-if="team.rankChange !== 0" class="rank-change" :class="getChangeClass(team.rankChange)">-->
<!-- {{ getChangeSymbol(team.rankChange) }}-->
<!-- </span>-->
</div>
<div class="cell team">
<div class="team-info">
<div class="team-name">{{ team.name }}</div>
</div>
</div>
<div class="cell red-win-rate">
{{ String(team.redWinRate).substring(0, 5) }}%
</div>
<div class="cell blue-win-rate">
{{ String(team.blueWinRate).substring(0, 5) }}%
</div>
<div class="cell red-matches">{{ team.redMatches }}</div>
<div class="cell blue-matches">{{ team.blueMatches }}</div>
<div class="cell invalid-matches">{{ team.invalidMatches }}</div>
<div class="cell total-score">{{ team.totalScore }}</div>
<div class="cell total-win-rate">
{{ String(team.totalWinRate).substring(0, 5) }}%
</div>
</div>
<!-- 行背面翻转时显示 -->
<div class="row-back">
<div class="back-content">
<div class="back-title">团队详情</div>
<div class="back-stats">
<div>总场次: {{ team.totalMatches }}</div>
<div>红方胜场: {{ team.redWins }}</div>
<div>蓝方胜场: {{ team.blueWins }}</div>
<div>连续胜场: {{ team.winStreak }}</div>
</div>
</div>
</div>
</div>
</template>
</div>
<!-- 控制面板 -->
<!-- <div class="control-panel">-->
<!-- <button @click="toggleAutoRefresh" :class="{ active: autoRefresh }">-->
<!-- {{ autoRefresh ? '暂停更新' : '开始更新' }}-->
<!-- </button>-->
<!-- <button @click="manualUpdate">手动更新排名</button>-->
<!-- <button @click="triggerFlip">手动翻转</button>-->
<!-- <div class="timer-display">-->
<!-- 下次更新: {{ nextUpdateTime }}-->
<!-- </div>-->
<!-- </div>-->
</div>
<template #title>
<div class="header-export-button">
<a-tooltip title="排名结果导出" placement="bottom">
<CloudDownloadOutlined class="download-icon" @click="handleExport"/>
<!-- <span style="margin-left:10px;">排名结果导出</span>-->
</a-tooltip>
</div>
</template>
</a-modal>
</template>
<script lang="ts">
import { computed, defineComponent, onMounted, onUnmounted, ref, type CSSProperties, type SetupContext } from 'vue';
import {CloudDownloadOutlined} from '@ant-design/icons-vue';
// 定义团队数据接口
interface Team {
id: number;
name: string;
rank: number;
redWinRate: number;
blueWinRate: number;
redMatches: number;
blueMatches: number;
invalidMatches: string;
totalScore: number;
totalWinRate: number;
rankChange: number;
isFlipping?: boolean;
// 计算属性实例getter
totalMatches: number;
redWins: number;
blueWins: number;
winStreak: number;
}
// 定义Props类型
interface RankProps {
visible: boolean;
}
// 定义Emits类型
type RankEmits = {
cancel: []; // 无参数的cancel事件
};
// 团队数据(添加类型注解)
const teams = ref<Team[]>([
{ id: 1, name: '团队3', rank: 1, redWinRate: 85, blueWinRate: 72, redMatches: 20, blueMatches: 18, invalidMatches: "2:30'50''", totalScore: 95, totalWinRate: 78, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 2, name: '红方', rank: 2, redWinRate: 78, blueWinRate: 81, redMatches: 22, blueMatches: 20, invalidMatches: "1:31'30''", totalScore: 92, totalWinRate: 79, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 3, name: '团队3', rank: 3, redWinRate: 80, blueWinRate: 75, redMatches: 18, blueMatches: 16, invalidMatches: "2:10'22''", totalScore: 90, totalWinRate: 77, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 4, name: '团队4', rank: 4, redWinRate: 72, blueWinRate: 85, redMatches: 19, blueMatches: 21, invalidMatches: "3:01'12''", totalScore: 88, totalWinRate: 76, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 5, name: '团队8', rank: 5, redWinRate: 68, blueWinRate: 79, redMatches: 17, blueMatches: 19, invalidMatches: "2:45'21''", totalScore: 85, totalWinRate: 73, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 6, name: '团队5', rank: 6, redWinRate: 75, blueWinRate: 70, redMatches: 16, blueMatches: 15, invalidMatches: "1:02'33''", totalScore: 82, totalWinRate: 72, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 7, name: '团队7', rank: 7, redWinRate: 70, blueWinRate: 65, redMatches: 14, blueMatches: 13, invalidMatches: "3:20'10''", totalScore: 78, totalWinRate: 68, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 8, name: '团队6', rank: 8, redWinRate: 65, blueWinRate: 72, redMatches: 12, blueMatches: 14, invalidMatches: "2:33'16''", totalScore: 75, totalWinRate: 67, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 9, name: '蓝方0', rank: 9, redWinRate: 60, blueWinRate: 68, redMatches: 10, blueMatches: 12, invalidMatches: "2:12'54''", totalScore: 70, totalWinRate: 63, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
{ id: 10, name: '团队9', rank: 10, redWinRate: 55, blueWinRate: 60, redMatches: 8, blueMatches: 10, invalidMatches: "3:01'02''", totalScore: 65, totalWinRate: 58, rankChange: 0,
totalMatches: 0, redWins: 0, blueWins: 0, winStreak: 0 },
]);
export default defineComponent({
components: {
CloudDownloadOutlined,
},
props: {
visible: {
type: Boolean,
required: true
},
},
emits: {
cancel: () => true
},
setup(_props: RankProps, { emit }: SetupContext<RankEmits>) {
const autoRefresh = ref<boolean>(true);
const nextUpdateTime = ref<number>(30);
let rankTimer: any | null = null;
let flipTimer: any | null = null;
let countdownTimer: any | null = null;
const indexClasses: Record<number, string> = {
0: 'first-row',
1: 'second-row',
2: 'third-row',
};
const sortedTeams = computed<Team[]>(() => {
return [...teams.value].sort((a, b) => a.rank - b.rank);
});
const getRowStyle = (index: number): CSSProperties => {
const delay = index * 0.1;
return {
'--flip-delay': `${delay}s`,
};
};
// 获取排名样式类
const getRankClass = (rank: number): string => {
if (rank === 1) return 'rank-first';
if (rank === 2) return 'rank-second';
if (rank === 3) return 'rank-third';
return '';
};
// 获取变化样式类
const getChangeClass = (change: number): string => {
if (change > 0) return 'change-up';
if (change < 0) return 'change-down';
return '';
};
// 获取变化符号
const getChangeSymbol = (change: number): string => {
if (change > 0) return `${change}`;
if (change < 0) return `${Math.abs(change)}`;
return '-';
};
// 手动更新排名
const manualUpdate = (): void => {
updateRankings();
};
// 手动触发翻转
const triggerFlip = (): void => {
teams.value.forEach(team => {
team.isFlipping = true;
setTimeout(() => {
team.isFlipping = false;
}, 600);
});
};
// 切换自动更新
const toggleAutoRefresh = (): void => {
autoRefresh.value = !autoRefresh.value;
if (autoRefresh.value) {
startTimers();
} else {
clearTimers();
}
};
// 更新排名逻辑
const updateRankings = (): void => {
// 保存旧排名Record类型key为team.idvalue为rank
const oldRanks: Record<number, number> = teams.value.reduce((acc, team) => {
acc[team.id] = team.rank;
return acc;
}, {} as Record<number, number>);
// 随机打乱并重新分配排名
const shuffled: Team[] = [...teams.value]
.sort(() => Math.random() - 0.5)
.map((team, index) => ({
...team,
rank: index + 1,
// 随机更新一些数据(保持数值范围合理性)
redWinRate: Math.min(100, Math.max(50, team.redWinRate + (Math.random() * 10 - 5))),
blueWinRate: Math.min(100, Math.max(50, team.blueWinRate + (Math.random() * 10 - 5))),
redMatches: team.redMatches + Math.floor(Math.random() * 3),
blueMatches: team.blueMatches + Math.floor(Math.random() * 2),
totalScore: team.totalScore + Math.floor(Math.random() * 5),
totalWinRate: Math.min(100, Math.max(50, team.totalWinRate + (Math.random() * 8 - 4))),
}))
.map(team => {
// 计算排名变化
const oldRank = oldRanks[team.id] as number;
team.rankChange = oldRank - team.rank;
return team;
});
teams.value = shuffled;
};
// 翻转动画
const flipRows = (): void => {
teams.value.forEach(team => {
team.isFlipping = true;
setTimeout(() => {
team.isFlipping = false;
}, 600);
});
};
// 开始定时器
const startTimers = (): void => {
// 排名更新定时器30秒
rankTimer = setInterval(() => {
updateRankings();
}, 30000);
// 翻转定时器15秒
flipTimer = setInterval(() => {
flipRows();
}, 15000);
// 倒计时显示
nextUpdateTime.value = 30;
countdownTimer = setInterval(() => {
nextUpdateTime.value--;
if (nextUpdateTime.value <= 0) {
nextUpdateTime.value = 30;
}
}, 1000);
};
// 清除定时器
const clearTimers = (): void => {
if (rankTimer) clearInterval(rankTimer);
if (flipTimer) clearInterval(flipTimer);
if (countdownTimer) clearInterval(countdownTimer);
// 重置定时器变量
rankTimer = null;
flipTimer = null;
countdownTimer = null;
};
// 生命周期:挂载时初始化
onMounted(() => {
// 为每个团队添加计算属性实例getter
teams.value = teams.value.map(team => ({
...team,
isFlipping: false,
get totalMatches() {
// 注意invalidMatches是时间字符串这里原逻辑有问题暂时保持原有写法
return this.redMatches + this.blueMatches + this.invalidMatches.length;
},
get redWins() {
return Math.round(this.redMatches * this.redWinRate / 100);
},
get blueWins() {
return Math.round(this.blueMatches * this.blueWinRate / 100);
},
get winStreak() {
return Math.floor(Math.random() * 10) + 1;
},
}));
if (autoRefresh.value) {
startTimers();
}
});
// 生命周期:卸载时清理
onUnmounted(() => {
clearTimers();
});
// 取消事件处理
const handleCancel = (): void => emit('cancel');
const handleExport = () => {
try {
// 创建临时a标签用于触发下载
const link = document.createElement('a');
// 设置导出接口地址如果有URL参数可直接拼接/api/xxx?startTime=2026-01-01
link.href = '/api/modelDeduction/downloadRankData';
// 自定义下载文件名(后端也可通过响应头覆盖此值)
link.download = '排名数据.xlsx';
// 部分浏览器需要将a标签加入DOM才能触发下载
document.body.appendChild(link);
// 触发点击下载
link.click();
// 下载完成后移除临时标签清理DOM
document.body.removeChild(link);
} catch (error) {
// 异常捕获,给用户友好提示
console.error('导出失败:', error);
alert('数据导出失败,请稍后重试!');
}
};
return {
handleCancel,
indexClasses,
sortedTeams,
getRowStyle,
getRankClass,
getChangeClass,
toggleAutoRefresh,
autoRefresh,
manualUpdate,
triggerFlip,
nextUpdateTime,
getChangeSymbol,
handleExport,
};
},
});
</script>
<style lang="less">
.ks-ranking-modal {
position: relative;
background: #0d1f34;
background: url('@/assets/rank/titled-container.png') center / 100% 100%;
.ant-modal-close {
right: 65px;
top: 65px;
}
.ant-modal-content{
position: relative;
}
.export-button{
position: absolute;
right: 60px;
bottom: 40px;
}
.header-export-button{
position: absolute;
right: 100px;
top: 68px;
.download-icon{
cursor: pointer;
width: 23px;
height: 23px;
font-size: 14px;
border-radius: 50%;
border: 1px solid #10e5ff;
text-align: center;
display: block;
line-height: 20px;
color: #10e5ff;
}
}
//.modal-overlay {
// background: #000000b0;
// position: absolute;
// width: 100%;
// height: 100%;
// z-index: -1;
//}
.ranking-container {
padding: 10px 30px;
}
.table-header {
background: rgba(255, 255, 255, 0.05);
margin-top: 100px;
margin-bottom: 10px;
}
.header-row {
display: grid;
grid-template-columns: 0.8fr 1.5fr 1.2fr 1.2fr 1fr 1fr 1fr 0.8fr 1.2fr;
padding: 15px 20px;
gap: 10px;
}
.header-cell {
color: #8da2c0;
font-weight: bold;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 1px;
&.rank{
margin-left: 15px;
}
}
.ranking-body {
min-height: 600px;
}
.team-row {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
margin-bottom: 8px;
position: relative;
transform-style: preserve-3d;
transition: transform 0.6s ease;
transform-origin: center center;
height: 50px;
overflow: hidden;
background: url('@/assets/rank/bg-3.png') center / 100% 100%;
.rank-number {
width: 60px;
height: 40px;
text-align: center;
font-size: 18px;
color: #fff;
line-height: 40px;
}
&.first-row {
background: url('@/assets/rank/bg-1.png') center / 100% 100%;
.rank-number {
background: url('@/assets/rank/icon-1.png') center / 100% 100%;
}
}
&.second-row {
background: url('@/assets/rank/bg-2.png') center / 100% 100%;
.rank-number {
background: url('@/assets/rank/icon-2.png') center / 100% 100%;
}
}
&.third-row {
.rank-number {
background: url('@/assets/rank/icon-3.png') center / 100% 100%;
}
}
}
.team-row.flipping {
transform: rotateX(180deg);
transition-delay: var(--flip-delay);
}
.row-front,
.row-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
display: grid;
grid-template-columns: 0.8fr 1.5fr 1.2fr 1.2fr 1fr 1fr 1fr 0.8fr 1.2fr;
padding: 0 20px;
gap: 10px;
align-items: center;
}
.row-back {
background: linear-gradient(135deg, #4a00e0 0%, #8e2de2 100%);
transform: rotateX(180deg);
color: white;
border-radius: 8px;
}
.back-content {
grid-column: 1 / -1;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}
.back-title {
font-size: 18px;
font-weight: bold;
}
.back-stats {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px 30px;
font-size: 14px;
}
.rank,
.cell {
color: #fff;
font-size: 14px;
display: flex;
align-items: center;
}
//.rank {
// font-weight: bold;
// font-size: 18px;
// justify-content: center;
// position: relative;
//}
.rank-first {
color: #ffd700;
}
.rank-second {
color: #c0c0c0;
}
.rank-third {
color: #cd7f32;
}
.rank-number {
margin-right: 5px;
}
.rank-change {
font-size: 12px;
padding: 2px 6px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.1);
}
.change-up {
color: #4CAF50;
}
.change-down {
color: #f44336;
}
.team-info {
display: flex;
flex-direction: column;
}
.team-name {
font-weight: bold;
margin-bottom: 4px;
}
.team-id {
font-size: 11px;
color: #8da2c0;
}
.progress-bar {
background: rgba(255, 255, 255, 0.1);
height: 20px;
border-radius: 10px;
overflow: hidden;
position: relative;
}
.progress-bar.blue .progress-fill {
background: linear-gradient(90deg, #2196F3, #03A9F4);
}
.progress-bar.total .progress-fill {
background: linear-gradient(90deg, #FF9800, #FFC107);
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #f44336, #ff9800);
border-radius: 10px;
transition: width 0.3s ease;
}
.progress-text {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
color: white;
font-weight: bold;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.control-panel {
display: flex;
justify-content: center;
gap: 15px;
margin-top: 25px;
padding-top: 20px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.control-panel button {
padding: 10px 20px;
border: none;
border-radius: 6px;
background: rgba(255, 255, 255, 0.1);
color: white;
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
}
.control-panel button:hover {
background: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
}
.control-panel button.active {
background: linear-gradient(135deg, #4a00e0, #8e2de2);
}
.timer-display {
display: flex;
align-items: center;
padding: 0 20px;
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
color: #8da2c0;
font-size: 14px;
}
}
</style>

View File

@@ -1,222 +0,0 @@
/*
* 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 DeductionPodMetricsDetails {
// 开火奖励累计值
fire_reward: NullableString;
// 接近敌机奖励累计值
approach_reward: NullableString;
// 越界惩罚累计值
boundary_penalty: NullableString;
lock_reward: NullableString;
damage_reward: NullableString;
// 胜利奖励值
win_bonus: NullableString;
[key: string]: unknown;
}
export interface DeductionPodMetrics {
// 本轮总奖励。该 Episode 获得的总分。
reward: NullableString;
// 本轮生存步数。该 Episode 持续的步数,
steps: number;
// 胜负判定。1 表示胜利0表示失败/平局。
is_win: number;
// 环境分项奖励明细。包含环境返回的所有细分奖励项(动态字段)。
details: null | DeductionPodMetricsDetails;
[key: string]: unknown;
}
export interface DeductionPod {
id: number;
// 关联推演ID
deductionId: number;
// RayJob名称
jobName: NullableString;
// RayJob主机IP
jobHostIp: NullableString;
// 8000端口映射
jobNodePort8000: NullableString;
// 8265端口映射
jobNodePort8265: NullableString;
// Afsim主机IP
afsimHostIp: NullableString;
// 6901端口映射
afsimNodePort6901: NullableString;
// 50051端口映射
afsimNodePort50051: NullableString;
// 状态1-正常0-已删除)
status: number;
// 推演任务Job_ID
jobId: NullableString;
// 总轮数
totalRound: number;
// 当前轮数
currentRound: number;
// 内部详细指标,JSON格式
metrics: NullableString;
// 红方名称
redName: NullableString,
// 蓝方名称
blueName: NullableString;
// 仿真状态1-运行2-暂停)
simulationStatus: Number;
metricsParsed: null | DeductionPodMetrics;
[key: string]: unknown;
}
export interface DeductionPodResult extends ApiDataResponse<DeductionPod[]> {
}
export interface ModelDeduction {
// 推演记录ID
id: number | null,
deductionId: number | null,
// 部署模型路径
deploymentModelPath: NullableString,
// 对抗轮数配置
competitionRound: NullableString,
// 对抗场次配置
competitionSession: number,
// 并发调度配置
balanceStrategy: NullableString | number | undefined,
// 推演倍数设置
deductionMultiple: number,
// 对抗模式选择
competitionMode: NullableString | number | undefined | null,
// 数据状态1-正常0-已删除)
status: number | null,
// 蓝方名称
blueNames: NullableString,
// 红方名称
redNames: NullableString,
stopped: boolean;
[key: string]: unknown;
}
export interface ModelDeductionData {
id: number | null,
// 关联Pod信息ID
deductionPodId: number,
// 当前轮数
currentEpisode: number,
// 累计总步数
totalSteps: number,
// 蓝方总开火次数
fireTimesBlue: number,
// 红方总开火次数
fireTimesRed: number,
// 蓝方本轮回报
episodeReturnsBlue: number,
// 红方本轮回报
episodeReturnsRed: number,
// 当前轮次生存步数
episodeLengths: number,
// 胜负历史
winHistory: NullableString,
// 蓝方最近10轮平均回报
avgReturn1Last10: number,
// 蓝方最近100轮平均回报
avgReturn1Last100: number,
// 红方最近10轮平均回报
avgReturn2Last10: number,
// 红方最近100轮平均回报
avgReturn2Last100: number,
// 平均每轮步数
avgEpisodeLength: number,
// 蓝方胜率
winRate: number,
// 蓝方败率
lossRate: number,
// 平局率
drawRate: number,
// 当前轮步数
stepInEpisode: number,
// 蓝方回报分量详情
returnComponentsBlue: NullableString,
// 红方回报分量详情
returnComponentsRed: NullableString,
// 蓝方本轮惩罚值
returnDelnatyBlue: number,
// 红方本轮惩罚值
returnDelnatyRed: number,
// 蓝方每轮弹药消耗量
fireConsumeBlue: number,
// 红方每轮弹药消耗量
fireConsumeRed: number,
// 蓝方本轮首次开火时间步
firstFireTimeBlue: number,
// 红方本轮首次开火时间步
firstFireTimeRed: number,
// 蓝方攻击持续时间
attackTimeBlue: number,
// 蓝方生存步数
episodeLengthsBlue: number | null,
// 红方生存步数
episodeLengthsRed: number | null,
// 蓝方胜次数
blueWinRounds: number,
// 红方胜次数
redWinRounds: number,
// 红方攻击持续时间
attackTimeRed: number,
// 能量优势序列JSON数组1=优势0=劣势)
energyAdvantage: NullableString,
// 蓝方轨迹纬度序列JSON数组
trajectoryBlueLat: NullableString,
// 蓝方轨迹经度序列JSON数组
trajectoryBlueLon: NullableString,
// 蓝方轨迹高度序列JSON数组
trajectoryBlueAlt: NullableString,
// 红方轨迹纬度序列JSON数组
trajectoryRedLat: NullableString,
// 红方轨迹经度序列JSON数组
trajectoryRedLon: NullableString,
// 红方轨迹高度序列JSON数组
trajectoryRedAlt: NullableString,
// 状态1-正常0-已删除)
status: number,
// 创建者
createBy: NullableString,
// 创建时间
createTime: NullableString,
// 备注
remark: NullableString,
normalizedBlueTrajectory: number[];
normalizedRedTrajectory: number[];
[key: string]: unknown;
}
export interface ModelDeductionDataResponse extends ApiDataResponse<ModelDeductionData[]> {
}
export interface ModelDeductionDetailsResponse extends ApiDataResponse<DeductionPod> {
}
export interface ModelDeductionPodStatus {
status: NullableString,
state: NullableString,
stateDescription: NullableString,
}
export interface ModelDeductionPodStatusResponse extends ApiDataResponse<ModelDeductionPodStatus> {
}

View File

@@ -1,22 +0,0 @@
/*
* 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 { NullableString } from '@/types';
export interface DraggableElement {
id: number | null,
key?: NullableString,
name: NullableString,
description: NullableString,
category: NullableString,
draggable: boolean,
parent?: DraggableElement,
children: DraggableElement[]
[key: string]: unknown;
}

View File

@@ -1,322 +0,0 @@
<template>
<a-dropdown :trigger="['contextmenu']" @openChange="handleVisibleChange">
<a-card
:class="[
'ks-designer-node',
`ks-designer-${element?.category ?? 'model'}-node`
]"
hoverable
>
<template #title>
<a-space>
<span class="ks-designer-node-icon"></span>
<span class="ks-designer-node-title">{{ element?.name ?? '-' }}</span>
</a-space>
</template>
<!-- 节点内容区域 -->
<div class="w-full" v-if="element?.category !== 'component'">
<div class="ks-designer-node-content">
<div
v-for="(item, index) in element?.element?.children || []"
:key="item.id || index"
class="ks-designer-node-row"
>
<div
:data-port="`in-${item.id || index}`"
:title="`入桩: ${item.name}`"
class="port port-in"
magnet="passive"
></div>
<!-- child名称 -->
<div class="ks-designer-node-name">
{{ item.name }}
</div>
<!-- 右侧出桩只能作为连线源 -->
<div
:data-port="`out-${item.id || index}`"
:title="`出桩: ${item.name}`"
class="port port-out"
magnet="active"
></div>
</div>
<div v-if="!(element?.element?.children && element?.element?.children?.length > 0)" class="ks-designer-node-row">
<div class="port port-in" data-port="in-0" magnet="passive"></div>
<div class="ks-designer-node-name">
{{ element?.name ?? '-' }}
</div>
<div class="port port-out" data-port="out-0" magnet="active"></div>
</div>
</div>
</div>
<div class="w-full" v-else>
<p>隐藏纬度: {{ element?.parameters?.hiddenLatitude ?? '-' }}</p>
<p>激活函数: {{ element?.parameters?.activationFunction ?? '-' }}</p>
</div>
</a-card>
<template #overlay>
<a-menu @click="handleMenuClick">
<a-menu-item key="delete">
<template #icon>
<DeleteOutlined />
</template>
删除
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</template>
<script lang="ts">
import { defineComponent, onMounted, onUnmounted, ref } from 'vue';
import { elementProps } from './props';
import type { ModelElement } from '../model/types';
import { DeleteOutlined, SettingOutlined } from '@ant-design/icons-vue';
import type { Graph } from '@antv/x6';
export default defineComponent({
name: 'ModelElement',
components: {
SettingOutlined,
DeleteOutlined,
},
props: elementProps,
setup(_props) {
const element = ref<ModelElement | null>(
_props.node ? (_props.node.getData() as ModelElement) : null,
);
const updateKey = ref(0);
const isMenuVisible = ref(false);
// 获取画布实例
const getGraph = (): Graph | null => {
return _props.graph as Graph || null;
};
// 监听节点数据变化
const handleDataChange = () => {
if (_props.node) {
element.value = _props.node.getData() as ModelElement;
} else {
element.value = null;
}
updateKey.value++;
};
const handleVisibleChange = (visible: boolean) => {
isMenuVisible.value = visible;
};
const handleMenuClick = ({ key }: { key: string }) => {
if (key === 'delete') {
handleDelete();
}
};
const handleDelete = () => {
if (!_props.node) return;
const graph = getGraph();
if (graph) {
try {
// 先删除关联边
const connectedEdges = graph.getConnectedEdges(_props.node);
connectedEdges.forEach(edge => graph.removeEdge(edge));
// 再删除节点
graph.removeNode(_props.node);
console.info(`节点 ${_props.node.id} 已删除`);
} catch (error) {
console.error('删除节点失败:', error);
}
}
isMenuVisible.value = false;
};
onMounted(() => {
_props.node?.on('change:data', handleDataChange);
});
onUnmounted(() => {
_props.node?.off('change:data', handleDataChange);
});
return {
element,
handleMenuClick,
handleVisibleChange,
};
},
});
</script>
<style lang="less">
.ks-designer-node {
background: linear-gradient(150deg, #093866 1%, #1f69b3 55%);
border: 0;
border-radius: 8px;
width: 100%;
height: 100%;
cursor: pointer;
position: relative;
.ant-card-head {
border: 0;
height: 38px;
min-height: 38px;
border-radius: 0;
color: #ddd;
font-size: 12px;
font-weight: normal;
padding: 0 20px;
}
.ks-designer-node-icon {
width: 15px;
height: 15px;
display: block;
position: absolute;
left: 8px;
top: 13px;
background: url('@/assets/icons/model-4.svg') center / 100% 100%;
}
.ks-designer-node-title {
font-size: 13px;
}
.ant-card-body {
color: #fff;
height: calc(100% - 38px);
border-radius: 0;
font-size: 12px;
padding: 8px 15px;
overflow-y: auto;
border-top: 1px solid #195693;
}
&.ks-designer-task-node {
background: linear-gradient(150deg, #20421b 1%, #4a6646 55%);
.ant-card-body {
border-top: 1px solid #466741;
}
.ks-designer-node-icon {
background: url('@/assets/icons/m-02.png') center / 100% 100%;
}
}
&.ks-designer-input-node {
background: linear-gradient(150deg, #083058 1%, #1e5d9b 55%);
.ant-card-body {
border-top: 1px solid #105ca7;
}
.ks-designer-node-icon {
background: url('@/assets/icons/icon-model-input.png') center / 100% 100%;
}
}
&.ks-designer-action-node {
background: linear-gradient(150deg, #343207 1%, #485010 55%);
.ant-card-body {
border-top: 1px solid #59550e;
}
.ks-designer-node-icon {
background: url('@/assets/icons/bg-fk-point.png') center / 100% 100%;
}
}
&.ks-designer-component-node {
background: linear-gradient(150deg, #06226b 1%, #1a43a7 55%);
.ant-card-body {
border-top: 1px solid #26448c;
}
}
&.ks-designer-control-node {
background: linear-gradient(150deg, #1d4f32 1%, #326a5d 55%);
.ant-card-body {
border-top: 1px solid #326a5d;
}
.ks-designer-node-icon {
background: url('@/assets/icons/bg-model-builder-card-title.png') center / 100% 100%;
}
}
// 连接桩容器样式
.ks-designer-node-content {
width: 100%;
display: flex;
flex-direction: column;
gap: 4px; // 每个child行之间的间距
}
// 每个child行包含左右桩+文本)
.ks-designer-node-row {
width: 100%;
display: flex;
align-items: center;
position: relative;
height: 24px; // 固定行高,保证桩对齐
}
// 连接桩基础样式
.port {
width: 12px;
height: 12px;
border-radius: 50%;
cursor: crosshair;
flex-shrink: 0;
box-shadow: 0 0 0 2px rgb(74 114 214 / 80%);
z-index: 10; // 确保桩在最上层
// X6 标记为可连线的磁体
magnet: true;
}
// 左侧入桩样式
.port-in {
background-color: #093866; // 青色:入桩
margin-right: 8px; // 与文本的间距
//border: 1px solid #093866;
// X6 只能作为连线目标(入)
magnet: passive;
box-shadow: none;
width: 20px;
height: 20px;
display: block;
background: url('@/assets/icons/point.svg') center / 100% 100%;
}
// 右侧出桩样式
.port-out {
margin-left: 8px; // 与文本的间距
margin-right: 5px;
// X6 只能作为连线源(出)
magnet: active;
box-shadow: none;
width: 20px;
height: 20px;
display: block;
background: url('@/assets/icons/arrow-right.svg') center / 100% 100%;
}
// 节点文本样式
.ks-designer-node-name {
flex: 1; // 占满中间空间
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>

View File

@@ -1,81 +0,0 @@
/*
* 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.
*/
export const menuMap = [
{
key: '0',
title: '工程空间',
children: [
{
key: '0-1',
title: '工程管理',
path: '/app/ai/project/management',
},
{
key: '0-2',
title: '新建/自定义',
path: '/app/ai/project/create',
},
],
},
{
key: '1',
title: '智能体构建工具',
children: [
{
key: '1-1',
title: '智能体管理',
path: '/app/ai/model/management',
},
],
},
{
key: '2',
title: 'AI模型训练',
children: [
{
key: '2-0',
title: '训练任务管理',
path: '/app/ai/training/task/management',
},
{
key: '2-1',
title: '训练任务配置',
path: '/app/ai/training/task/configurer',
},
// {
// key: '2-4',
// title: '训练任务监控',
// path: '/app/ai/training/task/monitor',
// },
],
},
{
key: '3',
title: '博弈竞赛应用',
children: [
{
key: '3-1',
title: '博弈竞赛单元运行环境',
path: '/app/ai/applications/gambling',
},
{
key: '3-2',
title: '仿真测试推演脚本',
type: 'open-script-window'
},
],
},
{
key: '2-3',
title: '训练资源监控',
path: '/app/ai/training/resources/monitor',
children: []
},
];

View File

@@ -1,47 +0,0 @@
<template>
<Wrapper>
<div class="w-screen min-h-screen flex justify-center items-center p-5 box-border">
<div class="text-center flex flex-col gap-6 items-center">
<h1 class="m-0 text-4xl font-normal text-gray-900">智能体研发训练一体化工具</h1>
<div class="flex justify-center">
<a-space class="mt-6 mb-6">
<a-button class="w-[100px]" type="primary">控制台</a-button>
<a-button class="w-[100px]">帮助文档</a-button>
</a-space>
</div>
<div class="text-left flex flex-col gap-6 items-center">
<a-row :gutter="40">
<a-col :span="8">
<a-card :bordered="false" class="dashboard-card h-[150px]" title="开发" @click="gotoPage('/app/ai/model/design')">
模型构建学习算法和训练方法配置
</a-card>
</a-col>
<a-col :span="8">
<a-card :bordered="false" class="dashboard-card h-[150px]" title="训练" @click="gotoPage('/app/ai/training')">
模型部署训练配置与评估可视化
</a-card>
</a-col>
<a-col :span="8">
<a-card :bordered="false" class="dashboard-card h-[150px]" title="应用" @click="gotoPage('/app/ai/applications')">
模型发布应用推理优化
</a-card>
</a-col>
</a-row>
</div>
</div>
</div>
</Wrapper>
</template>
<script setup>
import { Wrapper } from '@/wrapper';
import { useRouter } from 'vue-router';
const router = useRouter();
const gotoPage = (path) => {
router.push({
path: path,
});
};
</script>

View File

@@ -1,274 +0,0 @@
<template>
<div class="ks-finder">
<a-input-search
v-model:value="currentPath"
:placeholder="placeholder"
:readonly="true"
:size="size"
@search="openFinder"
>
<!-- <template #enterButton>-->
<!-- <a-button>Custom</a-button>-->
<!-- </template>-->
</a-input-search>
<a-modal @cancel="()=> modalVisible = false" class="ks-finder-modal" :open="modalVisible" :title="title" centered width="50%">
<div class="ks-finder-list">
<a-row :gutter="15">
<a-col :span="4" v-for="file in files">
<div :class="['ks-finder-item',currentPath === file.path ? 'selected' : '']"
@click="()=> handleClick(file)"
@dblclick="()=> handleDbclick(file)">
<a-tooltip>
<template #title>
{{ file.name }}
</template>
<div class="ks-finder-item-icon">
<FolderFilled v-if="file.directory" />
<FileOutlined v-else />
</div>
</a-tooltip>
<div class="ks-finder-item-name">
{{ getFilename(file.name) }}
</div>
</div>
</a-col>
</a-row>
</div>
<template #footer>
<a-space>
<a-button style="width:120px;" @click="()=> handleCancel()">取消</a-button>
<a-button style="width:120px;" @click="()=> handleSelect()">确定</a-button>
</a-space>
</template>
</a-modal>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, watch } from 'vue';
import { message } from 'ant-design-vue';
import { FileOutlined, FolderFilled } from '@ant-design/icons-vue';
import { findFinderBrowser } from './api';
import type { FinderBrowser } from './types';
import type { NullableString } from '@/types';
export default defineComponent({
components: {
FileOutlined,
FolderFilled,
},
props: {
visible: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
clearable: {
type: Boolean,
default: true,
},
onlyDirectory: {
type: Boolean,
default: true,
},
required: {
type: Boolean,
default: true,
},
path: {
type: [String, null],
default: null,
},
size: {
type: String,
default: null,
},
title: {
type: String,
default: '请选择保存路径',
},
placeholder: {
type: String,
default: '请选择保存路径',
},
},
emits: ['cancel', 'select'],
setup(props, { emit }) {
const modalVisible = ref<boolean>(props.visible);
const currentPath = ref<string>(props.path ?? '');
const files = ref<FinderBrowser[]>([]);
const currentFile = ref<FinderBrowser|null>(null)
const openFinder = () => {
modalVisible.value = true;
};
const loadPaths = (_p: string = '') => {
files.value = [
{
name: 'home',
path: '/home',
directory: true,
children: []
},
];
if(!props.onlyDirectory){
files.value.push(...[
{
name: '空战博弈智能体模型1-100轮.pth',
path: '/空战博弈智能体模型1-100轮.pth',
directory: false,
children: []
},
{
name: '空战博弈智能体模型1-1000轮.pth',
path: '/空战博弈智能体模型1-1000轮.pth',
directory: false,
children: []
},
])
}
// findFinderBrowser(p).then(r => {
// files.value = r.data ?? [];
// });
};
watch(() => props.path, (n: any) => {
currentPath.value = n;
loadPaths(n);
});
watch(() => props.visible, (n: boolean) => {
modalVisible.value = true;
});
const getFilename = (n: NullableString) => {
if (n) {
return n.length > 20 ? (n.substring(0, 24) + '...') : n;
}
return n;
};
const handleClick = (file: FinderBrowser) => {
currentPath.value = file.path;
currentFile.value = file;
};
const handleDbclick = (file: FinderBrowser) => {
// loadPaths(file.path);
};
const handleCancel = () => {
emit('cancel');
modalVisible.value = false;
};
const handleSelect = () => {
if (props.required && !currentPath.value) {
message.error('请选择文件.');
return;
}
modalVisible.value = false;
emit('select', currentPath.value, currentFile.value);
};
loadPaths();
return {
modalVisible,
currentPath,
openFinder,
files,
loadPaths,
getFilename,
handleClick,
handleDbclick,
handleCancel,
handleSelect,
};
},
});
</script>
<style lang="less">
.ks-finder-modal {
.ant-modal-content {
height: 68vh;
}
.ant-modal-close {
position: absolute;
top: 30px;
}
.ant-modal-header {
height: 48px;
.ant-modal-title {
line-height: 50px;
}
}
.ant-modal-body {
}
.ks-finder-list {
overflow-x: hidden;
overflow-y: auto;
border: 1px solid #1c2136;
padding: 15px;
height: 50vh;
}
.ks-finder-item {
text-align: center;
cursor: pointer;
height: 120px;
border: 1px solid transparent;
padding: 10px;
margin-bottom: 15px;
&:hover {
border-color: #4e4f70;
.anticon {
color: #99d8fb;
}
}
&.selected {
border-color: #4e4f70;
.anticon {
color: #fff;
}
}
}
.ks-finder-item-icon {
height: 70px;
width: 100%;
.anticon {
margin-bottom: 5px;
color: #6abfef;
font-size: 70px;
}
.anticon-file {
font-size: 50px;
}
}
.ks-finder-item-name {
color: #a2b1ba;
font-size: 12px;
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More