1
|
<script lang="ts" setup>
|
1
|
<script lang="ts" setup>
|
2
|
- import { useTable, BasicTable } from '/@/components/Table';
|
2
|
+ import { BasicTable, useTable } from '/@/components/Table';
|
3
|
import { getColumns } from './config';
|
3
|
import { getColumns } from './config';
|
4
|
- import { getRuleNodeEventList } from '/@/api/ruleDesigner';
|
4
|
+ import { doClearEvents, getRuleNodeEventList } from '/@/api/ruleDesigner';
|
5
|
import { BasicNodeFormData, NodeData } from '../../../../types/node';
|
5
|
import { BasicNodeFormData, NodeData } from '../../../../types/node';
|
6
|
import { computed, reactive, ref, unref, watch } from 'vue';
|
6
|
import { computed, reactive, ref, unref, watch } from 'vue';
|
7
|
import { useUserStore } from '/@/store/modules/user';
|
7
|
import { useUserStore } from '/@/store/modules/user';
|
8
|
import { EventSelect } from '../EventSelect';
|
8
|
import { EventSelect } from '../EventSelect';
|
9
|
import { Icon } from '/@/components/Icon';
|
9
|
import { Icon } from '/@/components/Icon';
|
10
|
- import { Tooltip } from 'ant-design-vue';
|
|
|
11
|
- import { EventTypeEnum } from '../EventSelect/config';
|
10
|
+ import { Tooltip, Popconfirm } from 'ant-design-vue';
|
|
|
11
|
+ import { EventTypeEnum, EventTypeNameEnum } from '../EventSelect/config';
|
12
|
import { FilterForm } from '../FilterForm';
|
12
|
import { FilterForm } from '../FilterForm';
|
13
|
import { useModal } from '/@/components/Modal';
|
13
|
import { useModal } from '/@/components/Modal';
|
14
|
import { DataActionModeEnum } from '/@/enums/toolEnum';
|
14
|
import { DataActionModeEnum } from '/@/enums/toolEnum';
|
|
@@ -31,6 +31,8 @@ |
|
@@ -31,6 +31,8 @@ |
31
|
data: {} as Recordable,
|
31
|
data: {} as Recordable,
|
32
|
});
|
32
|
});
|
33
|
|
33
|
|
|
|
34
|
+ const dataLength = ref();
|
|
|
35
|
+
|
34
|
const [register, { reload, setColumns, setPagination }] = useTable({
|
36
|
const [register, { reload, setColumns, setPagination }] = useTable({
|
35
|
columns: getColumns(EventTypeEnum.DEBUG_RULE_NODE),
|
37
|
columns: getColumns(EventTypeEnum.DEBUG_RULE_NODE),
|
36
|
showIndexColumn: false,
|
38
|
showIndexColumn: false,
|
|
@@ -56,6 +58,8 @@ |
|
@@ -56,6 +58,8 @@ |
56
|
{ ...searchParams.data, eventType: unref(eventType) }
|
58
|
{ ...searchParams.data, eventType: unref(eventType) }
|
57
|
);
|
59
|
);
|
58
|
|
60
|
|
|
|
61
|
+ dataLength.value = result.totalElements;
|
|
|
62
|
+
|
59
|
return result;
|
63
|
return result;
|
60
|
},
|
64
|
},
|
61
|
});
|
65
|
});
|
|
@@ -100,6 +104,17 @@ |
|
@@ -100,6 +104,17 @@ |
100
|
} as ModalParamsType<string>);
|
104
|
} as ModalParamsType<string>);
|
101
|
};
|
105
|
};
|
102
|
|
106
|
|
|
|
107
|
+ const handleClearStats = async () => {
|
|
|
108
|
+ const userInfo = useUserStore();
|
|
|
109
|
+ await doClearEvents({
|
|
|
110
|
+ ruleId: unref(getNodeId)!,
|
|
|
111
|
+ tenantId: userInfo.getUserInfo.tenantId!,
|
|
|
112
|
+ ...(searchParams.params as Record<'startTime' | 'endTime', string>),
|
|
|
113
|
+ eventType: unref(eventType),
|
|
|
114
|
+ });
|
|
|
115
|
+ reload();
|
|
|
116
|
+ };
|
|
|
117
|
+
|
103
|
watch(
|
118
|
watch(
|
104
|
() => props.elementInfo?.id,
|
119
|
() => props.elementInfo?.id,
|
105
|
() => {
|
120
|
() => {
|
|
@@ -115,6 +130,20 @@ |
|
@@ -115,6 +130,20 @@ |
115
|
<EventSelect v-model:type="eventType" @change="handleEventTypeChange" />
|
130
|
<EventSelect v-model:type="eventType" @change="handleEventTypeChange" />
|
116
|
</template>
|
131
|
</template>
|
117
|
<template #toolbar>
|
132
|
<template #toolbar>
|
|
|
133
|
+ <Popconfirm
|
|
|
134
|
+ @confirm="handleClearStats"
|
|
|
135
|
+ :title="`清除所有${EventTypeNameEnum[eventType]}`"
|
|
|
136
|
+ :content="`是否确认清除所有${EventTypeNameEnum[eventType]}`"
|
|
|
137
|
+ >
|
|
|
138
|
+ <Tooltip title="">
|
|
|
139
|
+ <Icon
|
|
|
140
|
+ v-if="dataLength"
|
|
|
141
|
+ icon="ant-design:delete-outlined"
|
|
|
142
|
+ class="cursor-pointer svg:text-2xl"
|
|
|
143
|
+ />
|
|
|
144
|
+ </Tooltip>
|
|
|
145
|
+ </Popconfirm>
|
|
|
146
|
+
|
118
|
<Tooltip title="过滤器">
|
147
|
<Tooltip title="过滤器">
|
119
|
<Icon
|
148
|
<Icon
|
120
|
icon="material-symbols:filter-list"
|
149
|
icon="material-symbols:filter-list"
|