feat(sj_1.0.0): 重试日志新增删除功能和功能完善
This commit is contained in:
parent
620553d32e
commit
ac9b427731
@ -21,6 +21,7 @@ const local: App.I18n.Schema = {
|
||||
deleteSuccess: 'Delete Success',
|
||||
confirmDelete: 'Are you sure you want to delete?',
|
||||
edit: 'Edit',
|
||||
detail: 'Detail',
|
||||
index: 'Index',
|
||||
keywordSearch: 'Please enter keyword',
|
||||
logout: 'Logout',
|
||||
|
@ -21,6 +21,7 @@ const local: App.I18n.Schema = {
|
||||
deleteSuccess: '删除成功',
|
||||
confirmDelete: '确认删除吗?',
|
||||
edit: '编辑',
|
||||
detail: '详情',
|
||||
index: '序号',
|
||||
keywordSearch: '请输入关键词搜索',
|
||||
logout: '退出登录',
|
||||
|
@ -426,7 +426,8 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
component: 'view.retry_log',
|
||||
meta: {
|
||||
title: 'retry_log',
|
||||
i18nKey: 'route.retry_log'
|
||||
i18nKey: 'route.retry_log',
|
||||
icon: 'tabler:logs'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -48,7 +48,24 @@ export function fetchUpdateSceneStatus(id: number, status: number) {
|
||||
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
||||
return request<Api.RetryLog.RetryLogList>({
|
||||
url: '/retry-task-log/list',
|
||||
method: 'put',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** delete retry log */
|
||||
export function fetchDeleteRetryLog(id: number) {
|
||||
return request<boolean>({
|
||||
url: `/retry-task-log/${id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
/** delete retry log */
|
||||
export function fetchBatchDeleteRetryLog(ids: number[]) {
|
||||
return request<boolean>({
|
||||
url: `/retry-task-log/ids`,
|
||||
method: 'delete',
|
||||
data: ids
|
||||
});
|
||||
}
|
||||
|
4
src/typings/api.d.ts
vendored
4
src/typings/api.d.ts
vendored
@ -965,7 +965,7 @@ declare namespace Api {
|
||||
/** retryLog */
|
||||
type RetryLog = Common.CommonRecord<{
|
||||
/** UniqueId */
|
||||
UniqueId: string;
|
||||
uniqueId: string;
|
||||
/** 组名称 */
|
||||
groupName: string;
|
||||
/** 场景名称 */
|
||||
@ -984,7 +984,7 @@ declare namespace Api {
|
||||
|
||||
/** retryLog search params */
|
||||
type RetryLogSearchParams = CommonType.RecordNullable<
|
||||
Pick<Api.RetryLog.RetryLog, 'UniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo'> &
|
||||
Pick<Api.RetryLog.RetryLog, 'uniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo'> &
|
||||
CommonSearchParams
|
||||
>;
|
||||
|
||||
|
1
src/typings/app.d.ts
vendored
1
src/typings/app.d.ts
vendored
@ -267,6 +267,7 @@ declare namespace App {
|
||||
deleteSuccess: string;
|
||||
confirmDelete: string;
|
||||
edit: string;
|
||||
detail: string;
|
||||
index: string;
|
||||
keywordSearch: string;
|
||||
logout: string;
|
||||
|
@ -1,9 +1,10 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { fetchRetryLogPageList } from '@/service/api';
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { fetchBatchDeleteRetryLog, fetchDeleteRetryLog, fetchRetryLogPageList } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { retryTaskStatusTypeRecord, retryTaskTypeRecord } from '@/constants/business';
|
||||
import RetryLogSearch from './modules/retry-log-search.vue';
|
||||
|
||||
const appStore = useAppStore();
|
||||
@ -15,7 +16,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
size: 10,
|
||||
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||
UniqueId: null,
|
||||
uniqueId: null,
|
||||
groupName: null,
|
||||
sceneName: null,
|
||||
idempotentId: null,
|
||||
@ -34,7 +35,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
width: 64
|
||||
},
|
||||
{
|
||||
key: 'UniqueId',
|
||||
key: 'uniqueId',
|
||||
title: $t('page.retryLog.UniqueId'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
@ -55,13 +56,39 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'retryStatus',
|
||||
title: $t('page.retryLog.retryStatus'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
if (row.retryStatus === null) {
|
||||
return null;
|
||||
}
|
||||
const tagMap: Record<Api.RetryTask.RetryStatusType, NaiveUI.ThemeColor> = {
|
||||
0: 'info',
|
||||
1: 'success',
|
||||
2: 'error',
|
||||
3: 'warning'
|
||||
};
|
||||
const label = $t(retryTaskStatusTypeRecord[row.retryStatus!]);
|
||||
|
||||
return <NTag type={tagMap[row.retryStatus!]}>{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'taskType',
|
||||
title: $t('page.retryLog.taskType'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
if (row.taskType === null) {
|
||||
return null;
|
||||
}
|
||||
const tagMap: Record<Api.RetryTask.TaskType, NaiveUI.ThemeColor> = {
|
||||
1: 'warning',
|
||||
2: 'error'
|
||||
};
|
||||
const label = $t(retryTaskTypeRecord[row.taskType!]);
|
||||
|
||||
return <NTag type={tagMap[row.taskType!]}>{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'idempotentId',
|
||||
@ -89,8 +116,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
render: row => (
|
||||
<div class="flex-center gap-8px">
|
||||
<NButton type="primary" ghost size="small" onClick={() => edit(row.id)}>
|
||||
{$t('common.edit')}
|
||||
{$t('common.detail')}
|
||||
</NButton>
|
||||
{row.retryStatus === 1 ? (
|
||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id)}>
|
||||
{{
|
||||
default: () => $t('common.confirmDelete'),
|
||||
@ -101,33 +129,29 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
)
|
||||
}}
|
||||
</NPopconfirm>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const {
|
||||
handleAdd,
|
||||
handleEdit,
|
||||
checkedRowKeys,
|
||||
onBatchDeleted,
|
||||
onDeleted
|
||||
// closeDrawer
|
||||
} = useTableOperate(data, getData);
|
||||
const { handleAdd, handleEdit, checkedRowKeys } = useTableOperate(data, getData);
|
||||
|
||||
async function handleBatchDelete() {
|
||||
// request
|
||||
console.log(checkedRowKeys.value);
|
||||
|
||||
onBatchDeleted();
|
||||
const { error } = await fetchBatchDeleteRetryLog(checkedRowKeys.value as any[]);
|
||||
if (!error) {
|
||||
window.$message?.success($t('common.deleteSuccess'));
|
||||
getData();
|
||||
}
|
||||
}
|
||||
|
||||
function handleDelete(id: any) {
|
||||
// request
|
||||
console.log(id);
|
||||
|
||||
onDeleted();
|
||||
async function handleDelete(id: any) {
|
||||
await fetchDeleteRetryLog(id);
|
||||
window.$message?.success($t('common.deleteSuccess'));
|
||||
getData();
|
||||
}
|
||||
|
||||
function edit(id: any) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { $t } from '@/locales';
|
||||
import SelectGroup from '@/components/common/select-group.vue';
|
||||
import SelectScene from '@/components/common/select-scene.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'RetryLogSearch'
|
||||
@ -26,13 +28,13 @@ function search() {
|
||||
<template>
|
||||
<SearchForm :model="model" @search="search" @reset="reset">
|
||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.groupName')" path="groupName" class="pr-24px">
|
||||
<NInput v-model:value="model.groupName" :placeholder="$t('page.retryLog.form.groupName')" />
|
||||
<SelectGroup v-model="model.groupName" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.sceneName')" path="sceneName" class="pr-24px">
|
||||
<NInput v-model:value="model.sceneName" :placeholder="$t('page.retryLog.form.sceneName')" />
|
||||
<SelectScene v-model:value="model.sceneName" :group-name="model.groupName as string" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.UniqueId')" path="UniqueId" class="pr-24px">
|
||||
<NInput v-model:value="model.UniqueId" :placeholder="$t('page.retryLog.form.UniqueId')" />
|
||||
<NInput v-model:value="model.uniqueId" :placeholder="$t('page.retryLog.form.UniqueId')" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.idempotentId')" path="idempotentId" class="pr-24px">
|
||||
<NInput v-model:value="model.idempotentId" :placeholder="$t('page.retryLog.form.idempotentId')" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm, NSwitch, NTag } from 'naive-ui';
|
||||
import { NButton, NSwitch, NTag } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import { fetchGetRetryScenePageList, fetchUpdateSceneStatus } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
@ -131,39 +131,16 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
<NButton type="primary" ghost size="small" onClick={() => edit(row.id!)}>
|
||||
{$t('common.edit')}
|
||||
</NButton>
|
||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
||||
{{
|
||||
default: () => $t('common.confirmDelete'),
|
||||
trigger: () => (
|
||||
<NButton type="error" ghost size="small">
|
||||
{$t('common.delete')}
|
||||
</NButton>
|
||||
)
|
||||
}}
|
||||
</NPopconfirm>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const {
|
||||
drawerVisible,
|
||||
operateType,
|
||||
editingData,
|
||||
handleAdd,
|
||||
handleEdit,
|
||||
checkedRowKeys,
|
||||
onDeleted
|
||||
// closeDrawer
|
||||
} = useTableOperate(data, getData);
|
||||
|
||||
function handleDelete(id: string) {
|
||||
// request
|
||||
console.log(id);
|
||||
|
||||
onDeleted();
|
||||
}
|
||||
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys } = useTableOperate(
|
||||
data,
|
||||
getData
|
||||
);
|
||||
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
|
Loading…
Reference in New Issue
Block a user