--新增性能门限

This commit is contained in:
lai
2023-10-23 16:27:53 +08:00
parent da6ae18028
commit 49c12f1723
6 changed files with 716 additions and 335 deletions

View File

@@ -19,9 +19,16 @@ import {
taskStop,
taskRun,
} from '@/api/perfManage/taskManage';
import { regExpIPv4} from '@/utils/regular-utils';
const { t, currentLocale } = useI18n();
const generateOptions = (start: any, end: any) => {
const options = [];
for (let i = start; i <= end; i++) {
options.push({ label: i.toString(), value: i.toString() });
}
return options;
};
/**表格所需option */
const taskManageOption = reactive({
granulOption: [
@@ -45,38 +52,7 @@ const taskManageOption = reactive({
{ label: '星期六', value: '6' },
{ label: '星期天', value: '7' },
],
Monthly: [
{ label: '1', value: '1' },
{ label: '2', value: '2' },
{ label: '3', value: '3' },
{ label: '4', value: '4' },
{ label: '5', value: '5' },
{ label: '6', value: '6' },
{ label: '7', value: '7' },
{ label: '8', value: '8' },
{ label: '9', value: '9' },
{ label: '10', value: '10' },
{ label: '11', value: '11' },
{ label: '12', value: '12' },
{ label: '13', value: '13' },
{ label: '14', value: '14' },
{ label: '15', value: '15' },
{ label: '16', value: '16' },
{ label: '17', value: '17' },
{ label: '18', value: '18' },
{ label: '19', value: '19' },
{ label: '20', value: '20' },
{ label: '21', value: '21' },
{ label: '22', value: '22' },
{ label: '23', value: '23' },
{ label: '24', value: '24' },
{ label: '25', value: '25' },
{ label: '26', value: '26' },
{ label: '27', value: '27' },
{ label: '28', value: '28' },
{ label: '29', value: '29' },
{ label: '30', value: '30' },
],
Monthly: generateOptions(1, 30),
},
});
@@ -206,7 +182,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**
* 备份信息删除
* 测量任务删除
* @param row 记录编号ID
*/
function fnRecordDelete(row: Record<string, any>) {
@@ -323,17 +299,10 @@ const modalStateFrom = Form.useForm(
message: t('views.traceManage.task.neTypePlease'),
},
],
endTime: [
granulOption: [
{
required: true,
message: t('views.traceManage.task.rangePickerPlease'),
},
],
dstIp: [
{
required: true,
pattern: regExpIPv4,
message: t('views.traceManage.task.dstIpPlease'),
message: t('views.perfManage.taskManage.granulOptionPlease'),
},
],
performanceArr: [
@@ -379,7 +348,7 @@ function fnChange(open: any) {
}
/**性能测量数据集对应修改 */
function fnSelectInterface(s: any, option: any) {
function fnSelectPer(s: any, option: any) {
modalState.from.kpiSet = s.join(',');
const groupedData = option.reduce((groups: any, item: any) => {
const { kpiCode, ...rest } = item;
@@ -556,32 +525,39 @@ function fnModalVisibleByEdit(id?: string) {
* 进行表达规则校验
*/
function fnModalOk() {
const from = toRaw(modalState.from);
from.accountId = useUserStore().userName;
console.log(from);
modalState.confirmLoading = true;
const perfTask = from.id ? updatePerfTask(from) : addPerfTask(from);
const hide = message.loading(t('common.loading'), 0);
perfTask
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
modalStateFrom
.validate()
.then(e => {
const from = toRaw(modalState.from);
from.accountId = useUserStore().userName;
console.log(from);
modalState.confirmLoading = true;
const perfTask = from.id ? updatePerfTask(from) : addPerfTask(from);
const hide = message.loading(t('common.loading'), 0);
perfTask
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
});
modalState.visibleByEdit = false;
modalStateFrom.resetFields();
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
modalState.confirmLoading = false;
fnGetList();
});
modalState.visibleByEdit = false;
modalStateFrom.resetFields();
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
modalState.confirmLoading = false;
fnGetList();
.catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
});
}
@@ -838,14 +814,18 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.id)"
:disabled="record.status === 'Active'"
:disabled="record.status !== 'Inactive'"
>
<template #icon><FormOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.deleteText') }}</template>
<a-button type="link" @click.prevent="fnRecordDelete(record)">
<a-button
type="link"
@click.prevent="fnRecordDelete(record)"
:disabled="record.status !== 'Inactive'"
>
<template #icon><DeleteOutlined /></template>
</a-button>
</a-tooltip>
@@ -1031,7 +1011,7 @@ onMounted(() => {
placeholder="Please select"
v-model:value="modalState.neTypPerformanceList"
:options="modalState.neTypPerformance"
@change="fnSelectInterface"
@change="fnSelectPer"
>
</a-select>
</a-form-item>