Compare commits
9 Commits
538a43f597
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b3fe9b548 | ||
|
|
db30244cd1 | ||
|
|
c9bc62fb8c | ||
|
|
9d54395c29 | ||
|
|
35fd1c8937 | ||
|
|
579d0f2bd8 | ||
|
|
7f8abf2ff2 | ||
|
|
f1bcd3812d | ||
|
|
d3fda27bb0 |
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -38,6 +38,9 @@ public class Algorithm
|
|||||||
@Excel(name = "算法配置")
|
@Excel(name = "算法配置")
|
||||||
private String algoConfig;
|
private String algoConfig;
|
||||||
|
|
||||||
|
/** 算法配置 */
|
||||||
|
private List<AlgorithmConfig> algoConfigList;
|
||||||
|
|
||||||
/** 算法参数定义信息 */
|
/** 算法参数定义信息 */
|
||||||
private List<AlgorithmParam> algorithmParamList;
|
private List<AlgorithmParam> algorithmParamList;
|
||||||
|
|
||||||
@@ -111,6 +114,14 @@ public class Algorithm
|
|||||||
this.algorithmParamList = algorithmParamList;
|
this.algorithmParamList = algorithmParamList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AlgorithmConfig> getAlgoConfigList() {
|
||||||
|
return algoConfigList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlgoConfigList(List<AlgorithmConfig> algoConfigList) {
|
||||||
|
this.algoConfigList = algoConfigList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="codePath" column="code_path" />
|
<result property="codePath" column="code_path" />
|
||||||
<result property="description" column="description" />
|
<result property="description" column="description" />
|
||||||
<result property="algoConfig" column="algo_config" />
|
<result property="algoConfig" column="algo_config" />
|
||||||
|
<result property="algoConfigList" column="algo_config_list" typeHandler="com.solution.algo.AlgorithmConfigTypeHandler" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="AlgorithmAlgorithmParamResult" type="Algorithm" extends="AlgorithmResult">
|
<resultMap id="AlgorithmAlgorithmParamResult" type="Algorithm" extends="AlgorithmResult">
|
||||||
@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAlgorithmVo">
|
<sql id="selectAlgorithmVo">
|
||||||
select id, name, type, code_path, description, algo_config from algorithm
|
select id, name, type, code_path, description, algo_config, algo_config_list from algorithm
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmAlgorithmParamResult">
|
<select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmAlgorithmParamResult">
|
||||||
@@ -60,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="codePath != null">code_path,</if>
|
<if test="codePath != null">code_path,</if>
|
||||||
<if test="description != null">description,</if>
|
<if test="description != null">description,</if>
|
||||||
<if test="algoConfig != null">algo_config,</if>
|
<if test="algoConfig != null">algo_config,</if>
|
||||||
|
<if test="algoConfigList != null">algo_config_list,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="codePath != null">#{codePath},</if>
|
<if test="codePath != null">#{codePath},</if>
|
||||||
<if test="description != null">#{description},</if>
|
<if test="description != null">#{description},</if>
|
||||||
<if test="algoConfig != null">#{algoConfig},</if>
|
<if test="algoConfig != null">#{algoConfig},</if>
|
||||||
|
<if test="algoConfigList != null">#{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="codePath != null">code_path = #{codePath},</if>
|
<if test="codePath != null">code_path = #{codePath},</if>
|
||||||
<if test="description != null">description = #{description},</if>
|
<if test="description != null">description = #{description},</if>
|
||||||
<if test="algoConfig != null">algo_config = #{algoConfig},</if>
|
<if test="algoConfig != null">algo_config = #{algoConfig},</if>
|
||||||
|
<if test="algoConfigList != null">algo_config_list = #{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
BIN
modeler/src/assets/icons/bg-node-head.png
Normal file
BIN
modeler/src/assets/icons/bg-node-head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
@@ -34,4 +34,12 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
component: () => import('@/views/decision/designer.vue'),
|
component: () => import('@/views/decision/designer.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'decision-algorithm-management',
|
||||||
|
path: '/app/decision/algorithm/management',
|
||||||
|
meta: {
|
||||||
|
title: '指挥决策规则库管理',
|
||||||
|
},
|
||||||
|
component: () => import('@/views/decision/algorithm/management.vue'),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
@@ -270,20 +270,68 @@
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
min-height: calc(100vh - 90px);
|
min-height: calc(100vh - 90px);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
background: url('@/assets/icons/bg-fk.png') center / 100% 100%;
|
||||||
|
|
||||||
|
.ant-tabs .ant-tabs-ink-bar {
|
||||||
|
position: absolute;
|
||||||
|
background: transparent;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.ant-steps-horizontal{
|
||||||
|
&.ant-steps.ant-steps-navigation .ant-steps-item.ant-steps-item-active::before {
|
||||||
|
width: 30%;
|
||||||
|
margin-left: 37%;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.ant-steps-item-active{
|
||||||
|
.ant-steps-item-container{
|
||||||
|
&:after{
|
||||||
|
height: 1px;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
background: #377ead;
|
||||||
|
display: block;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.ant-card-head {
|
.ant-card-head {
|
||||||
border: 0;
|
border: 0;
|
||||||
color: #11aed7;
|
color: #a2b1ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .ant-card-head {
|
& > .ant-card-head {
|
||||||
height: 50px;
|
height: 40px;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
font-size: 16px;
|
border-radius: 0;
|
||||||
|
padding: 5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .ant-card-head {
|
& > .ant-card-head {
|
||||||
background: url('@/assets/icons/page-card-head.png') center / 100% 100%;
|
background: url('@/assets/icons/page-card-head.png') center / 100% 100%;
|
||||||
|
background: url('@/assets/icons/bg-fk-title.png') center / 100% 100%;
|
||||||
|
color: #eee;
|
||||||
|
|
||||||
|
.point {
|
||||||
|
background: url('@/assets/icons/bg-fk-point.png') center / 100% 100%;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
display: block;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin-top: 5px;
|
||||||
|
display: block;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .ant-card-body {
|
& > .ant-card-body {
|
||||||
@@ -979,6 +1027,8 @@
|
|||||||
border-right: 1px solid #062850;
|
border-right: 1px solid #062850;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
background: #081229;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1320,11 +1370,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-btn-default {
|
|
||||||
background: #7dd3f9;
|
|
||||||
border-color: #7dd3f9;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-field {
|
.btn-field {
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
@@ -1486,3 +1531,114 @@
|
|||||||
.ant-divider {
|
.ant-divider {
|
||||||
border-block-start: 1px solid rgb(255 255 255 / 17%);
|
border-block-start: 1px solid rgb(255 255 255 / 17%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.ant-pagination {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.ant-pagination-disabled .ant-pagination-item-link,
|
||||||
|
.ant-pagination-disabled:hover .ant-pagination-item-link,
|
||||||
|
.ant-pagination-prev .ant-pagination-item-link,
|
||||||
|
.ant-pagination-next .ant-pagination-item-link,
|
||||||
|
&.ant-pagination-mini .ant-pagination-total-text,
|
||||||
|
&.ant-pagination-mini .ant-pagination-simple-pager {
|
||||||
|
color: rgb(255 255 255 / 95%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.ant-pagination-simple .ant-pagination-simple-pager input {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid #0f4a7c;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.ant-empty-small {
|
||||||
|
margin-block: 8px;
|
||||||
|
color: rgb(207 207 207 / 66%);
|
||||||
|
}
|
||||||
|
.ant-btn >span {
|
||||||
|
display: inline-block;
|
||||||
|
float: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-btn,
|
||||||
|
.ant-input {
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-btn-primary {
|
||||||
|
color: #eee;
|
||||||
|
//border-color: #1b5b7d;
|
||||||
|
//background: linear-gradient(90deg, #1e4c65 0%, #0b3a62 100%);
|
||||||
|
border-color: #29759c;
|
||||||
|
background: linear-gradient(0deg, #0f374c 0, #154c69 100%);
|
||||||
|
&.selected,
|
||||||
|
&:not(:disabled):hover,
|
||||||
|
&:hover,
|
||||||
|
&:active {
|
||||||
|
border-color: #166094;
|
||||||
|
background: linear-gradient(90deg, #3687bc 0%, #074375 100%);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-btn-default {
|
||||||
|
&.ant-btn-dangerous{
|
||||||
|
background: transparent!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
color: #eee;
|
||||||
|
//border-color: #144087;
|
||||||
|
//background: linear-gradient(90deg, #0f4a7c 0%, #0a365b 100%);
|
||||||
|
border-color: #1c468b;
|
||||||
|
background: linear-gradient(0deg, #14223b 0, #1c468b 100%);
|
||||||
|
&.selected,
|
||||||
|
&:not(:disabled):hover,
|
||||||
|
&:hover,
|
||||||
|
&:active {
|
||||||
|
color: #fff;
|
||||||
|
border-color: #166094;
|
||||||
|
background: linear-gradient(90deg, #3687bc 0%, #074375 100%);
|
||||||
|
}
|
||||||
|
&:disabled,
|
||||||
|
&.disabled{
|
||||||
|
color: #a9a3a3;
|
||||||
|
&:hover{
|
||||||
|
color:#eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-field {
|
||||||
|
min-width: 120px;
|
||||||
|
background: #5796b2;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 2px;
|
||||||
|
color: #fff;
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #5796b2;
|
||||||
|
|
||||||
|
.anticon {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&.selected {
|
||||||
|
background: #19b0ff;
|
||||||
|
border-color: #19b0ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.gold {
|
||||||
|
background: transparent;
|
||||||
|
border-color: #b5b39d;
|
||||||
|
color: #b5b39d;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
modeler/src/views/decision/algorithm/api.ts
Normal file
36
modeler/src/views/decision/algorithm/api.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 { HttpRequestClient } from '@/utils/request';
|
||||||
|
import type { Algorithm, AlgorithmPageableResponse, AlgorithmRequest } from './types';
|
||||||
|
import type { BasicResponse } from '@/types';
|
||||||
|
|
||||||
|
const req = HttpRequestClient.create<BasicResponse>({
|
||||||
|
baseURL: '/api',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const findAlgorithmsByQuery = (query: Partial<AlgorithmRequest> = {}): Promise<AlgorithmPageableResponse> => {
|
||||||
|
return req.get('/algo/algorithm/list', query);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
|
||||||
|
return req.postJson('/algo/algorithm', algorithm);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const runAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
|
||||||
|
return req.postJson('/algo/algorithm/run', algorithm);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
|
||||||
|
return req.putJson('/algo/algorithm', algorithm);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteAlgorithm = (id: number): Promise<BasicResponse> => {
|
||||||
|
return req.delete(`/algo/algorithm/${id}`);
|
||||||
|
};
|
||||||
42
modeler/src/views/decision/algorithm/config.ts
Normal file
42
modeler/src/views/decision/algorithm/config.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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 algorithmTypes = [
|
||||||
|
{
|
||||||
|
type: 'defense',
|
||||||
|
name: '防守',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'offense',
|
||||||
|
name: '进攻',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'formation',
|
||||||
|
name: '队形',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export const algorithmConfigOperations = [
|
||||||
|
{
|
||||||
|
type: '+',
|
||||||
|
name: '加',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '-',
|
||||||
|
name: '减',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '*',
|
||||||
|
name: '乘',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '/',
|
||||||
|
name: '除',
|
||||||
|
},
|
||||||
|
]
|
||||||
513
modeler/src/views/decision/algorithm/management.vue
Normal file
513
modeler/src/views/decision/algorithm/management.vue
Normal file
@@ -0,0 +1,513 @@
|
|||||||
|
<template>
|
||||||
|
<Layout>
|
||||||
|
<template #sidebar>
|
||||||
|
<div class="ks-sidebar-header">
|
||||||
|
<a-flex class="ks-sidebar-title">
|
||||||
|
<span class="icon"></span>
|
||||||
|
<span class="text">指挥决策规则库管理</span>
|
||||||
|
</a-flex>
|
||||||
|
<a-button class="ks-sidebar-add" size="small" @click="handleCreate">
|
||||||
|
<PlusOutlined />
|
||||||
|
新增
|
||||||
|
</a-button>
|
||||||
|
</div>
|
||||||
|
<a-list item-layout="horizontal" :data-source="algorithms" class="ks-algorithm-list">
|
||||||
|
<template #renderItem="{ item }">
|
||||||
|
<a-list-item @click="()=> handleSelect(item)" :class="selectedAlgorithm?.id === item.id ? 'selected' : null">
|
||||||
|
<a-list-item-meta :description="substring(item.description,20)">
|
||||||
|
<template #title>
|
||||||
|
<span class="ks-algorithm-name">{{ substring(item.name, 20) }}</span>
|
||||||
|
<span class="ks-algorithm-type"><a-badge size="small" :count="getAlgorithmTypeName(item.type)"></a-badge></span>
|
||||||
|
</template>
|
||||||
|
</a-list-item-meta>
|
||||||
|
</a-list-item>
|
||||||
|
</template>
|
||||||
|
</a-list>
|
||||||
|
|
||||||
|
<a-pagination
|
||||||
|
v-model:current="query.pageNum"
|
||||||
|
:page-size="query.pageSize"
|
||||||
|
:total="algorithmsTotal"
|
||||||
|
simple size="small" @change="handleChange" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="w-full h-full">
|
||||||
|
|
||||||
|
<a-card class="ks-page-card ks-algorithm-card">
|
||||||
|
|
||||||
|
<template #title>
|
||||||
|
<a-space>
|
||||||
|
<span class="point"></span>
|
||||||
|
<span class="text">规则配置</span>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="ks-scrollable" style="height: 80.5vh;overflow-y: auto;padding-right: 10px">
|
||||||
|
|
||||||
|
<a-row :gutter="15">
|
||||||
|
<a-col :span="16">
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:label-col="{span: 6}"
|
||||||
|
:model="selectedAlgorithm"
|
||||||
|
autocomplete="off"
|
||||||
|
layout="horizontal"
|
||||||
|
name="basic"
|
||||||
|
>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="规则名称"
|
||||||
|
:rules="[{ required: true, message: '请输入算法名称!', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['name']"
|
||||||
|
>
|
||||||
|
<a-input v-model:value="selectedAlgorithm.name" placeholder="请输入算法名称" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="业务类型"
|
||||||
|
:rules="[{ required: true, message: '请输入业务类型!', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['type']"
|
||||||
|
>
|
||||||
|
<a-select placeholder="请选择业务类型" allow-clear v-model:value="selectedAlgorithm.type" @change="(v: any)=> selectedAlgorithm.type = v">
|
||||||
|
<a-select-option v-for="a in algorithmTypes" :value="a.type">{{ a.name }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="算法文件路径"
|
||||||
|
:rules="[{ required: true, message: '请输入算法文件路径!', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['codePath']"
|
||||||
|
>
|
||||||
|
<a-input v-model:value="selectedAlgorithm.codePath" placeholder="请输入算法文件路径" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="算法描述"
|
||||||
|
:rules="[{ required: false, message: '请输入算法描述', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['description']"
|
||||||
|
>
|
||||||
|
<a-textarea v-model:value="selectedAlgorithm.description" placeholder="请输入算法描述" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="算法参数定义"
|
||||||
|
:rules="[{ required: true, message: '请输入算法参数定义', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['algorithmParamList']"
|
||||||
|
>
|
||||||
|
<a-form-item-rest>
|
||||||
|
<div class="ks-algorithm-param-list">
|
||||||
|
<div class="ks-algorithm-param-item" v-for="(item,index) in selectedAlgorithm.algorithmParamList">
|
||||||
|
<a-row :gutter="15">
|
||||||
|
<a-col :span="7">
|
||||||
|
<a-input v-model:value="item.paramName" placeholder="请输入参数名" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="7">
|
||||||
|
<a-input v-model:value="item.defaultValue" placeholder="请输入默认值" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="7">
|
||||||
|
<a-input v-model:value="item.description" placeholder="请输入描述" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="3">
|
||||||
|
<a-space class="ks-algorithm-param-actions">
|
||||||
|
<MinusCircleOutlined @click="()=> handleMinus(index)" />
|
||||||
|
<PlusCircleOutlined @click="handleAdd" v-if="index === 0" />
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-form-item-rest>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="算法配置"
|
||||||
|
:rules="[{ required: false, message: '请输入算法配置', trigger: ['input', 'change'] }]"
|
||||||
|
:name="['algoConfig']"
|
||||||
|
>
|
||||||
|
<a-form-item-rest>
|
||||||
|
<div class="ks-algorithm-param-list">
|
||||||
|
<div class="ks-algorithm-param-item" v-for="(t,index) in selectedAlgorithm.algoConfigList">
|
||||||
|
<a-row :gutter="15">
|
||||||
|
<a-col :span="7">
|
||||||
|
<a-select placeholder="请选择参数" v-model:value="t.name" @change="(v: any)=> t.name = v">
|
||||||
|
<a-select-option :value="v.paramName" v-for="v in selectedAlgorithm.algorithmParamList">{{v.paramName}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="7">
|
||||||
|
<a-select placeholder="请选择操作" v-model:value="t.operation" @change="(v: any)=> t.operation = v">
|
||||||
|
<a-select-option :value="o.type" v-for="o in algorithmConfigOperations">{{o.name}} {{o.type}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="3">
|
||||||
|
<a-space class="ks-algorithm-param-actions">
|
||||||
|
<MinusCircleOutlined @click="()=> handleMinusConfig(index)" />
|
||||||
|
<PlusCircleOutlined @click="handleAddConfig" v-if="index === 0" />
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-form-item-rest>
|
||||||
|
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
:wrapper-col="{offset: 6}"
|
||||||
|
>
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleSave" type="primary">保存规则</a-button>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="selectedAlgorithm && selectedAlgorithm.id > 0"
|
||||||
|
title="确定运行?"
|
||||||
|
@confirm="handleRun"
|
||||||
|
>
|
||||||
|
<a-button>运行规则</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="selectedAlgorithm && selectedAlgorithm.id > 0"
|
||||||
|
title="确定删除?"
|
||||||
|
@confirm="handleDelete"
|
||||||
|
>
|
||||||
|
<a-button danger>删除规则</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
</a-form>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { type FormInstance, message } from 'ant-design-vue';
|
||||||
|
import { MinusCircleOutlined, PlusCircleOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import Layout from '../layout.vue';
|
||||||
|
import { createAlgorithm, deleteAlgorithm, findAlgorithmsByQuery, updateAlgorithm, runAlgorithm } from './api';
|
||||||
|
import type { Algorithm, AlgorithmParam, AlgorithmRequest } from './types';
|
||||||
|
import { substring } from '@/utils/strings';
|
||||||
|
import { algorithmTypes,algorithmConfigOperations } from './config';
|
||||||
|
import type { NullableString } from '@/types';
|
||||||
|
|
||||||
|
const query = ref<Partial<AlgorithmRequest>>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultAlgorithmParam: AlgorithmParam = {
|
||||||
|
id: 0,
|
||||||
|
algorithmId: 0,
|
||||||
|
// 参数名
|
||||||
|
paramName: null,
|
||||||
|
// 默认值
|
||||||
|
defaultValue: null,
|
||||||
|
// 描述
|
||||||
|
description: null,
|
||||||
|
};
|
||||||
|
const defaultAlgorithm: Algorithm = {
|
||||||
|
id: 0,
|
||||||
|
// 算法名称
|
||||||
|
name: null,
|
||||||
|
// 业务类型
|
||||||
|
type: undefined,
|
||||||
|
// 算法文件路径
|
||||||
|
codePath: null,
|
||||||
|
// 算法描述
|
||||||
|
description: null,
|
||||||
|
// 算法配置
|
||||||
|
algoConfig: null,
|
||||||
|
// 算法配置
|
||||||
|
algoConfigList: [],
|
||||||
|
// 算法参数定义信息
|
||||||
|
algorithmParamList: [
|
||||||
|
{ ...defaultAlgorithmParam },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const resolveItem = (item: Algorithm) => {
|
||||||
|
let newItem = JSON.parse(JSON.stringify(item))
|
||||||
|
if (!newItem.algorithmParamList) {
|
||||||
|
newItem.algorithmParamList = [];
|
||||||
|
}
|
||||||
|
if (newItem.algorithmParamList.length === 0) {
|
||||||
|
newItem.algorithmParamList.push({ ...defaultAlgorithmParam });
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
newItem.algoConfigList = JSON.parse(newItem.algoConfigList)
|
||||||
|
} catch (e: any){
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!newItem.algoConfigList){
|
||||||
|
newItem.algoConfigList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newItem.algoConfigList.length === 0){
|
||||||
|
newItem.algoConfigList.push({
|
||||||
|
name: undefined,
|
||||||
|
operation: undefined,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
const algorithms = ref<Algorithm[]>([]);
|
||||||
|
const algorithmsTotal = ref<number>(0);
|
||||||
|
const selectedAlgorithm = ref<Algorithm>(resolveItem(defaultAlgorithm));
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
|
||||||
|
const getAlgorithmTypeName = (type: NullableString): NullableString => {
|
||||||
|
let v = algorithmTypes.find(c => c.type === type);
|
||||||
|
return v && v.name ? v.name : type;
|
||||||
|
};
|
||||||
|
|
||||||
|
const load = () => {
|
||||||
|
algorithms.value = [];
|
||||||
|
algorithmsTotal.value = 0;
|
||||||
|
formRef.value?.resetFields();
|
||||||
|
selectedAlgorithm.value = resolveItem(defaultAlgorithm);
|
||||||
|
|
||||||
|
findAlgorithmsByQuery(query.value).then(r => {
|
||||||
|
algorithms.value = r.rows ?? [];
|
||||||
|
algorithmsTotal.value = r.total ?? 0;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleCreate = () => {
|
||||||
|
selectedAlgorithm.value = resolveItem(defaultAlgorithm);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSelect = (item: Algorithm) => {
|
||||||
|
selectedAlgorithm.value = resolveItem(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAdd = () => {
|
||||||
|
selectedAlgorithm.value.algorithmParamList.push({ ...defaultAlgorithmParam });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMinus = (index: number) => {
|
||||||
|
const paramList = selectedAlgorithm.value.algorithmParamList;
|
||||||
|
if (index === 0 && selectedAlgorithm.value.algorithmParamList.length === 1) {
|
||||||
|
selectedAlgorithm.value.algorithmParamList = [{ ...defaultAlgorithmParam }];
|
||||||
|
} else if (index >= 0 && index < paramList.length && paramList.length > 1) {
|
||||||
|
paramList.splice(index, 1);
|
||||||
|
selectedAlgorithm.value.algorithmParamList = [...paramList];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAddConfig = () => {
|
||||||
|
selectedAlgorithm.value.algoConfigList.push({ name: null, operation: null });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMinusConfig = (index: number) => {
|
||||||
|
const paramList = selectedAlgorithm.value.algoConfigList;
|
||||||
|
if (index === 0 && selectedAlgorithm.value.algoConfigList.length === 1) {
|
||||||
|
selectedAlgorithm.value.algoConfigList = [{ name: null, operation: null }];
|
||||||
|
} else if (index >= 0 && index < paramList.length && paramList.length > 1) {
|
||||||
|
paramList.splice(index, 1);
|
||||||
|
selectedAlgorithm.value.algoConfigList = [...paramList];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = () => {
|
||||||
|
if (selectedAlgorithm.value && selectedAlgorithm.value.id > 0) {
|
||||||
|
deleteAlgorithm(selectedAlgorithm.value.id).then(r => {
|
||||||
|
if (r.code === 200) {
|
||||||
|
load();
|
||||||
|
message.info(r.msg ?? '删除成功');
|
||||||
|
} else {
|
||||||
|
message.error(r.msg ?? '删除失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
if (formRef.value) {
|
||||||
|
formRef.value.validate().then(() => {
|
||||||
|
let res = null;
|
||||||
|
let savedValue: Algorithm = JSON.parse(JSON.stringify(selectedAlgorithm.value)) as any as Algorithm;
|
||||||
|
let algoConfig = '';
|
||||||
|
if( savedValue.algoConfigList ){
|
||||||
|
savedValue.algoConfigList.forEach(o=> {
|
||||||
|
if(o.name){
|
||||||
|
algoConfig = algoConfig + o.name;
|
||||||
|
}
|
||||||
|
if(o.operation){
|
||||||
|
algoConfig = algoConfig + o.operation;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
savedValue.algoConfig = algoConfig;
|
||||||
|
|
||||||
|
if (savedValue.id > 0) {
|
||||||
|
res = updateAlgorithm(savedValue);
|
||||||
|
} else {
|
||||||
|
res = createAlgorithm(savedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
res.then(r => {
|
||||||
|
if (r.code === 200) {
|
||||||
|
load();
|
||||||
|
message.info(r.msg ?? '操作成功');
|
||||||
|
} else {
|
||||||
|
message.error(r.msg ?? '操作失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRun = ()=> {
|
||||||
|
if (formRef.value) {
|
||||||
|
formRef.value.validate().then(() => {
|
||||||
|
runAlgorithm(selectedAlgorithm.value).then(r => {
|
||||||
|
if (r.code === 200) {
|
||||||
|
message.info(r.msg ?? '运行成功');
|
||||||
|
} else {
|
||||||
|
message.error(r.msg ?? '运行失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleChange = (page: number, pageSize: number) => {
|
||||||
|
query.value.pageNum = page;
|
||||||
|
query.value.pageSize = pageSize;
|
||||||
|
load();
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => load());
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.ks-algorithm-card {
|
||||||
|
.ant-card-head-title {
|
||||||
|
span.text {
|
||||||
|
display: block;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ks-sidebar-header {
|
||||||
|
line-height: 40px;
|
||||||
|
padding: 5px 15px;
|
||||||
|
background: #081d36;
|
||||||
|
min-height: 40px;
|
||||||
|
background: url(@/assets/icons/card-head.png) left / 180% 100%;
|
||||||
|
padding: 0 10px;
|
||||||
|
|
||||||
|
.ks-sidebar-title {
|
||||||
|
color: #7ae8fc;
|
||||||
|
font-size: 16px;
|
||||||
|
.icon {
|
||||||
|
background: url(@/assets/icons/list.png) center / 100% 100%;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
display: block;
|
||||||
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
.text{
|
||||||
|
margin-left: 40px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ks-sidebar-add {
|
||||||
|
position: absolute;
|
||||||
|
right: 7px;
|
||||||
|
top: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
.anticon {
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-list {
|
||||||
|
&.ks-algorithm-list {
|
||||||
|
.ant-list-item {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.5s;
|
||||||
|
border-left: 2px solid transparent;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&.selected,
|
||||||
|
&:hover {
|
||||||
|
background: #0a1b3c;
|
||||||
|
border-left: 2px solid #11377e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ks-algorithm-type {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
|
||||||
|
.ant-badge {
|
||||||
|
.ant-badge-count {
|
||||||
|
color: #c3c2c2;
|
||||||
|
background: #333f7d;
|
||||||
|
box-shadow: 0 0 0 1px #325478;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-list-item-meta {
|
||||||
|
.ant-list-item-meta-title {
|
||||||
|
color: #7ae8fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-list-item-meta-description {
|
||||||
|
color: #4d8c98;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ks-algorithm-param-list {
|
||||||
|
padding: 15px;
|
||||||
|
border: 1px solid #475f71;
|
||||||
|
border-radius: 2px;
|
||||||
|
|
||||||
|
.ks-algorithm-param-item {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.ks-algorithm-param-actions {
|
||||||
|
.anticon {
|
||||||
|
color: #7ae8fc;
|
||||||
|
font-size: 20px;
|
||||||
|
display: block;
|
||||||
|
line-height: 26px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
54
modeler/src/views/decision/algorithm/types.ts
Normal file
54
modeler/src/views/decision/algorithm/types.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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, PageableResponse } from '@/types';
|
||||||
|
|
||||||
|
export interface AlgorithmParam {
|
||||||
|
id: number,
|
||||||
|
algorithmId: number,
|
||||||
|
// 参数名
|
||||||
|
paramName: NullableString,
|
||||||
|
// 默认值
|
||||||
|
defaultValue: NullableString,
|
||||||
|
// 描述
|
||||||
|
description: NullableString,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AlgorithmConfig {
|
||||||
|
name: NullableString,
|
||||||
|
operation: NullableString,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Algorithm {
|
||||||
|
|
||||||
|
id: number,
|
||||||
|
// 算法名称
|
||||||
|
name: NullableString,
|
||||||
|
// 业务类型
|
||||||
|
type: NullableString | undefined,
|
||||||
|
// 算法文件路径
|
||||||
|
codePath: NullableString,
|
||||||
|
// 算法描述
|
||||||
|
description: NullableString,
|
||||||
|
// 算法配置
|
||||||
|
algoConfig: NullableString,
|
||||||
|
// 算法配置
|
||||||
|
algoConfigList: AlgorithmConfig[],
|
||||||
|
// 算法参数定义信息
|
||||||
|
algorithmParamList: AlgorithmParam[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AlgorithmRequest extends Algorithm {
|
||||||
|
pageNum: number,
|
||||||
|
pageSize: number,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AlgorithmPageableResponse extends PageableResponse<Algorithm> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,14 +9,13 @@
|
|||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<a-space>
|
<a-space>
|
||||||
<div class="port port-in" data-port="in-0" magnet="passive"></div>
|
|
||||||
<span class="ks-designer-node-title">{{ element?.name ?? '-' }}</span>
|
<span class="ks-designer-node-title">{{ element?.name ?? '-' }}</span>
|
||||||
<div class="port port-out" data-port="out-0" magnet="active"></div>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div class="port port-in" data-port="in-0" magnet="passive"></div>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<a-tooltip>
|
<a-tooltip v-if="(element?.description ?? (element?.name ?? '-')).length >= 38">
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ element?.description ?? element?.name }}
|
{{ element?.description ?? element?.name }}
|
||||||
</template>
|
</template>
|
||||||
@@ -24,7 +23,11 @@
|
|||||||
{{ substring(element?.description ?? (element?.name ?? '-'), 40) }}
|
{{ substring(element?.description ?? (element?.name ?? '-'), 40) }}
|
||||||
</p>
|
</p>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
<p v-else>
|
||||||
|
{{ substring(element?.description ?? (element?.name ?? '-'), 40) }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="port port-out" data-port="out-0" magnet="active"></div>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
@@ -135,15 +138,17 @@ export default defineComponent({
|
|||||||
background: #1e2533;
|
background: #1e2533;
|
||||||
border: 1px solid #4a7aff;
|
border: 1px solid #4a7aff;
|
||||||
|
|
||||||
|
border: 2px solid #000000;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border: 1px solid #4a7aff;
|
border: 2px solid #4a7aff;
|
||||||
box-shadow: 0 0 10px rgba(74, 122, 255, 0.3);
|
box-shadow: 0 0 10px rgba(74, 122, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-card-head {
|
.ant-card-head {
|
||||||
border: 0;
|
border: 0;
|
||||||
height: 38px;
|
height: 25px;
|
||||||
min-height: 38px;
|
min-height: 25px;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -153,6 +158,7 @@ export default defineComponent({
|
|||||||
border-top-left-radius: 8px;
|
border-top-left-radius: 8px;
|
||||||
border-top-right-radius: 8px;
|
border-top-right-radius: 8px;
|
||||||
background: linear-gradient(to bottom, rgba(108, 99, 255, 0.15), rgba(108, 99, 255, 0.05));
|
background: linear-gradient(to bottom, rgba(108, 99, 255, 0.15), rgba(108, 99, 255, 0.05));
|
||||||
|
background: url('@/assets/icons/bg-node-head.png') center / 100% 100%;
|
||||||
//background: linear-gradient(to bottom, rgb(234 234 234 / 20%), rgb(191 191 191 / 58%));
|
//background: linear-gradient(to bottom, rgb(234 234 234 / 20%), rgb(191 191 191 / 58%));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,19 +175,26 @@ export default defineComponent({
|
|||||||
.ks-designer-node-title {
|
.ks-designer-node-title {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
color: #312e2e;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-card-body {
|
.ant-card-body {
|
||||||
color: #f5f5f5;
|
color: #f5f5f5;
|
||||||
height: calc(100% - 38px);
|
height: calc(100% - 25px);
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 8px 15px;
|
padding: 8px 15px !important;
|
||||||
border-top: 1px solid rgba(108, 99, 255, 0.5);
|
border-top: 1px solid rgba(108, 99, 255, 0.5);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
box-shadow: 0 0 10px rgba(74, 122, 255, 0.3);
|
box-shadow: 0 0 10px rgba(74, 122, 255, 0.3);
|
||||||
|
|
||||||
|
white-space: normal; // 恢复默认的换行行为
|
||||||
|
word-wrap: break-word; // 允许长单词换行
|
||||||
|
word-break: break-all; // 允许在任意字符处换行
|
||||||
|
line-height: 1.4; // 增加行高提升可读性
|
||||||
|
box-shadow: 0 0 10px rgba(74, 122, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// model/task 节点:浅紫渐变
|
// model/task 节点:浅紫渐变
|
||||||
@@ -288,8 +301,9 @@ export default defineComponent({
|
|||||||
background: url('@/assets/icons/point.svg') center / 100% 100%;
|
background: url('@/assets/icons/point.svg') center / 100% 100%;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 5px;
|
//top: 7px;
|
||||||
top: 12px;
|
left: -8px;
|
||||||
|
top: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.port-out {
|
.port-out {
|
||||||
@@ -303,8 +317,11 @@ export default defineComponent({
|
|||||||
background: url('@/assets/icons/point.svg') center / 100% 100%;
|
background: url('@/assets/icons/point.svg') center / 100% 100%;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5px;
|
//right: 8px;
|
||||||
top: 12px;
|
//top: 7px;
|
||||||
|
top: 50%;
|
||||||
|
right: -12px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 节点文本样式
|
// 节点文本样式
|
||||||
|
|||||||
@@ -19,20 +19,24 @@
|
|||||||
<div class="ks-model-builder-content">
|
<div class="ks-model-builder-content">
|
||||||
<div class="ks-model-builder-actions">
|
<div class="ks-model-builder-actions">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-tooltip v-if="graph && currentBehaviorTree" placement="top">
|
<!-- <a-tooltip v-if="graph && currentBehaviorTree" placement="top">-->
|
||||||
<template #title>
|
<!-- <template #title>-->
|
||||||
保存
|
<!-- 保存-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
<a-popconfirm
|
<!-- <a-popconfirm-->
|
||||||
title="确定保存?"
|
<!-- title="确定保存?"-->
|
||||||
@confirm="handleSave"
|
<!-- @confirm="handleSave"-->
|
||||||
>
|
<!-- >-->
|
||||||
<a-button class="ks-model-builder-save" size="small">
|
<!-- <a-button class="ks-model-builder-save" size="small">-->
|
||||||
|
<!-- <CheckOutlined />-->
|
||||||
|
<!-- <span>保存</span>-->
|
||||||
|
<!-- </a-button>-->
|
||||||
|
<!-- </a-popconfirm>-->
|
||||||
|
<!-- </a-tooltip>-->
|
||||||
|
<a-button v-if="graph && currentBehaviorTree" class="ks-model-builder-save" size="small" @click="handleSave">
|
||||||
<CheckOutlined />
|
<CheckOutlined />
|
||||||
<span>保存</span>
|
<span>保存</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
|
||||||
</a-tooltip>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
<!-- 画布容器,添加拖放事件 -->
|
<!-- 画布容器,添加拖放事件 -->
|
||||||
|
|||||||
@@ -173,27 +173,6 @@ export default defineComponent({
|
|||||||
height: 40vh;
|
height: 40vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-pagination {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 10px;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.ant-pagination-disabled .ant-pagination-item-link,
|
|
||||||
.ant-pagination-disabled:hover .ant-pagination-item-link,
|
|
||||||
.ant-pagination-prev .ant-pagination-item-link,
|
|
||||||
.ant-pagination-next .ant-pagination-item-link,
|
|
||||||
&.ant-pagination-mini .ant-pagination-total-text,
|
|
||||||
&.ant-pagination-mini .ant-pagination-simple-pager {
|
|
||||||
color: rgb(255 255 255 / 95%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.ant-pagination-simple .ant-pagination-simple-pager input {
|
|
||||||
background-color: transparent;
|
|
||||||
border: 1px solid #0f4a7c;
|
|
||||||
color: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const createGraphTaskElementFromTemplate = (
|
|||||||
template: NodeTemplate,
|
template: NodeTemplate,
|
||||||
rect?: GraphTaskRect,
|
rect?: GraphTaskRect,
|
||||||
): GraphTaskElement => {
|
): GraphTaskElement => {
|
||||||
let realRect = { width: 200, height: 100, x: 0, y: 0, ...rect || {} };
|
let realRect = { width: 120, height: 80, x: 0, y: 0, ...rect || {} };
|
||||||
console.info('rect', rect);
|
console.info('rect', rect);
|
||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|||||||
10
modeler/types/components.d.ts
vendored
10
modeler/types/components.d.ts
vendored
@@ -13,6 +13,7 @@ export {}
|
|||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||||
|
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||||
AButton: typeof import('ant-design-vue/es')['Button']
|
AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
ACard: typeof import('ant-design-vue/es')['Card']
|
ACard: typeof import('ant-design-vue/es')['Card']
|
||||||
ACol: typeof import('ant-design-vue/es')['Col']
|
ACol: typeof import('ant-design-vue/es')['Col']
|
||||||
@@ -25,6 +26,7 @@ declare module 'vue' {
|
|||||||
AFloatButton: typeof import('ant-design-vue/es')['FloatButton']
|
AFloatButton: typeof import('ant-design-vue/es')['FloatButton']
|
||||||
AForm: typeof import('ant-design-vue/es')['Form']
|
AForm: typeof import('ant-design-vue/es')['Form']
|
||||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||||
|
AFormItemRest: typeof import('ant-design-vue/es')['FormItemRest']
|
||||||
AInput: typeof import('ant-design-vue/es')['Input']
|
AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
||||||
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||||
@@ -35,11 +37,14 @@ declare module 'vue' {
|
|||||||
ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider']
|
ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider']
|
||||||
AList: typeof import('ant-design-vue/es')['List']
|
AList: typeof import('ant-design-vue/es')['List']
|
||||||
AListItem: typeof import('ant-design-vue/es')['ListItem']
|
AListItem: typeof import('ant-design-vue/es')['ListItem']
|
||||||
|
AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta']
|
||||||
AMenu: typeof import('ant-design-vue/es')['Menu']
|
AMenu: typeof import('ant-design-vue/es')['Menu']
|
||||||
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||||
APagination: typeof import('ant-design-vue/es')['Pagination']
|
APagination: typeof import('ant-design-vue/es')['Pagination']
|
||||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||||
ARow: typeof import('ant-design-vue/es')['Row']
|
ARow: typeof import('ant-design-vue/es')['Row']
|
||||||
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
|
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
||||||
ATable: typeof import('ant-design-vue/es')['Table']
|
ATable: typeof import('ant-design-vue/es')['Table']
|
||||||
@@ -55,6 +60,7 @@ declare module 'vue' {
|
|||||||
// For TSX support
|
// For TSX support
|
||||||
declare global {
|
declare global {
|
||||||
const AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
const AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||||
|
const ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||||
const AButton: typeof import('ant-design-vue/es')['Button']
|
const AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
const ACard: typeof import('ant-design-vue/es')['Card']
|
const ACard: typeof import('ant-design-vue/es')['Card']
|
||||||
const ACol: typeof import('ant-design-vue/es')['Col']
|
const ACol: typeof import('ant-design-vue/es')['Col']
|
||||||
@@ -67,6 +73,7 @@ declare global {
|
|||||||
const AFloatButton: typeof import('ant-design-vue/es')['FloatButton']
|
const AFloatButton: typeof import('ant-design-vue/es')['FloatButton']
|
||||||
const AForm: typeof import('ant-design-vue/es')['Form']
|
const AForm: typeof import('ant-design-vue/es')['Form']
|
||||||
const AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
const AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||||
|
const AFormItemRest: typeof import('ant-design-vue/es')['FormItemRest']
|
||||||
const AInput: typeof import('ant-design-vue/es')['Input']
|
const AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
const AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
const AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
||||||
const AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
const AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||||
@@ -77,11 +84,14 @@ declare global {
|
|||||||
const ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider']
|
const ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider']
|
||||||
const AList: typeof import('ant-design-vue/es')['List']
|
const AList: typeof import('ant-design-vue/es')['List']
|
||||||
const AListItem: typeof import('ant-design-vue/es')['ListItem']
|
const AListItem: typeof import('ant-design-vue/es')['ListItem']
|
||||||
|
const AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta']
|
||||||
const AMenu: typeof import('ant-design-vue/es')['Menu']
|
const AMenu: typeof import('ant-design-vue/es')['Menu']
|
||||||
const AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
const AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||||
const APagination: typeof import('ant-design-vue/es')['Pagination']
|
const APagination: typeof import('ant-design-vue/es')['Pagination']
|
||||||
const APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
const APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||||
const ARow: typeof import('ant-design-vue/es')['Row']
|
const ARow: typeof import('ant-design-vue/es')['Row']
|
||||||
|
const ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
|
const ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
const ASpace: typeof import('ant-design-vue/es')['Space']
|
const ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
const ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
const ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
||||||
const ATable: typeof import('ant-design-vue/es')['Table']
|
const ATable: typeof import('ant-design-vue/es')['Table']
|
||||||
|
|||||||
Reference in New Issue
Block a user