Initial commit

This commit is contained in:
libertyspy
2026-02-09 20:10:24 +08:00
parent 9d54395c29
commit c9bc62fb8c
3 changed files with 110 additions and 2 deletions

View File

@@ -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;