feat(sj_1.1.0-beta3): 告警通知与用户管理新增删除功能
This commit is contained in:
parent
67cf8e7ea4
commit
cc4b6121ca
@ -35,8 +35,9 @@ export function fetchJobBatchRetry(jobId: string) {
|
||||
/** delete job */
|
||||
export function fetchDeleteJobBatch(id: string) {
|
||||
return request<boolean>({
|
||||
url: `/job/batch/${id}`,
|
||||
method: 'delete'
|
||||
url: `/job/batch/ids`,
|
||||
method: 'delete',
|
||||
data: [id]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -43,3 +43,21 @@ export function fetchUpdateSceneStatus(id: string, status: Api.Common.EnableStat
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** delete retry scene status */
|
||||
export function fetchDeleteRetryScene(id: string) {
|
||||
return request({
|
||||
url: '/scene-config/ids',
|
||||
method: 'delete',
|
||||
data: [id]
|
||||
});
|
||||
}
|
||||
|
||||
/** batch delete retry scene status */
|
||||
export function fetchBatchDeleteRetryScene(data: string[]) {
|
||||
return request({
|
||||
url: '/scene-config/ids',
|
||||
method: 'delete',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
@ -35,6 +35,15 @@ export function fetchDelUser(id: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/** batch delete user */
|
||||
export function fetchBatchDelteUser(data: string[]) {
|
||||
return request<boolean>({
|
||||
url: `/user/ids`,
|
||||
method: 'delete',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/** update user password */
|
||||
export function fetchUpdateUserPassword(data: Api.UserManager.UpdateUserPassword) {
|
||||
return request<boolean>({
|
||||
|
@ -130,7 +130,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
align: 'center',
|
||||
width: 130,
|
||||
width: 80,
|
||||
render: row => (
|
||||
<div class="flex-center gap-8px">
|
||||
{row.retryStatus === 1 ? (
|
||||
|
@ -2,7 +2,12 @@
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import { useBoolean } from '@sa/hooks';
|
||||
import { fetchGetRetryScenePageList, fetchUpdateSceneStatus } from '@/service/api';
|
||||
import {
|
||||
fetchBatchDeleteRetryScene,
|
||||
fetchDeleteRetryScene,
|
||||
fetchGetRetryScenePageList,
|
||||
fetchUpdateSceneStatus
|
||||
} from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
@ -47,6 +52,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
},
|
||||
{
|
||||
key: 'sceneName',
|
||||
align: 'center',
|
||||
title: $t('page.retryScene.sceneName'),
|
||||
fixed: 'left',
|
||||
width: 120,
|
||||
@ -161,27 +167,48 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
title: $t('common.operate'),
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 120,
|
||||
width: 100,
|
||||
render: row => (
|
||||
<div class="flex-center gap-8px">
|
||||
<NButton type="primary" text ghost size="small" onClick={() => edit(row.id!)}>
|
||||
{$t('common.edit')}
|
||||
</NButton>
|
||||
<n-divider vertical />
|
||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
||||
{{
|
||||
default: () => $t('common.confirmDelete'),
|
||||
trigger: () => (
|
||||
<NButton type="error" text ghost size="small">
|
||||
{$t('common.delete')}
|
||||
</NButton>
|
||||
)
|
||||
}}
|
||||
</NPopconfirm>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys } = useTableOperate(
|
||||
data,
|
||||
getData
|
||||
);
|
||||
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onDeleted, onBatchDeleted } =
|
||||
useTableOperate(data, getData);
|
||||
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
}
|
||||
|
||||
async function handleDelete(id: string) {
|
||||
const { error } = await fetchDeleteRetryScene(id);
|
||||
if (error) return;
|
||||
onDeleted();
|
||||
}
|
||||
|
||||
async function handleBatchDelete() {
|
||||
const { error } = await fetchBatchDeleteRetryScene(checkedRowKeys.value);
|
||||
if (error) return;
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
function triggerInterval(backOff: number, maxRetryCount: number) {
|
||||
if (backOff !== 1) {
|
||||
return '';
|
||||
@ -223,8 +250,8 @@ function handleExport() {
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-delete="false"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #addAfter>
|
||||
|
@ -54,7 +54,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
{
|
||||
key: 'uniqueId',
|
||||
title: $t('page.retryTask.uniqueId'),
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
@ -149,7 +149,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
width: 260,
|
||||
fixed: 'right',
|
||||
render: row => (
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import { useBoolean } from '@sa/hooks';
|
||||
import { fetchDelUser, fetchGetUserPageList } from '@/service/api';
|
||||
import { fetchBatchDelteUser, fetchDelUser, fetchGetUserPageList } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
@ -30,9 +30,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
columns: () => [
|
||||
{
|
||||
key: 'permissions',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
type: 'expand',
|
||||
minWidth: 10,
|
||||
minWidth: 36,
|
||||
renderExpand: row => {
|
||||
return (
|
||||
<div>
|
||||
@ -57,6 +57,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
key: 'id',
|
||||
title: $t('common.index'),
|
||||
@ -144,10 +147,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
]
|
||||
});
|
||||
|
||||
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onDeleted } = useTableOperate(
|
||||
data,
|
||||
getData
|
||||
);
|
||||
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onDeleted, onBatchDeleted } =
|
||||
useTableOperate(data, getData);
|
||||
|
||||
async function handleDelete(id: string) {
|
||||
const { error } = await fetchDelUser(id as any);
|
||||
@ -155,6 +156,12 @@ async function handleDelete(id: string) {
|
||||
onDeleted();
|
||||
}
|
||||
|
||||
async function handleBatchDelete() {
|
||||
const { error } = await fetchBatchDelteUser(checkedRowKeys.value);
|
||||
if (error) return;
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
}
|
||||
@ -175,8 +182,8 @@ function edit(id: string) {
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-delete="false"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@refresh="getData"
|
||||
/>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user