Initial commit
This commit is contained in:
@@ -1562,6 +1562,89 @@
|
||||
|
||||
.ant-btn-default{
|
||||
&.ant-btn-dangerous{
|
||||
background: transparent!important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.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 {
|
||||
color: #eee;
|
||||
//border-color: #144087;
|
||||
//background: linear-gradient(90deg, #0f4a7c 0%, #0a365b 100%);
|
||||
border-color: #1c468b;
|
||||
background: linear-gradient(0deg, #284e91 0, #2c5dad 100%);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,10 @@ 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);
|
||||
};
|
||||
|
||||
@@ -131,7 +131,14 @@
|
||||
:wrapper-col="{offset: 6}"
|
||||
>
|
||||
<a-space>
|
||||
<a-button @click="handleSave">保存规则</a-button>
|
||||
<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="确定删除?"
|
||||
@@ -159,7 +166,7 @@ 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 } from './api';
|
||||
import { createAlgorithm, deleteAlgorithm, findAlgorithmsByQuery, updateAlgorithm, runAlgorithm } from './api';
|
||||
import type { Algorithm, AlgorithmParam, AlgorithmRequest } from './types';
|
||||
import { substring } from '@/utils/strings';
|
||||
import { algorithmTypes } from './config';
|
||||
@@ -284,6 +291,20 @@ const handleSave = () => {
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user