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