feat(sj_1.0.0): 定义job状态和操作原因
This commit is contained in:
parent
559003f9dc
commit
5ddc9ae69e
@ -35,3 +35,11 @@ export function fetchEditRetryScene(data: Api.RetryScene.Scene) {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/** update retry scene status */
|
||||
export function fetchUpdateSceneStatus(id: number, status: number) {
|
||||
return request<boolean>({
|
||||
url: `/scene-config/${id}/status/${status}`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
3
src/typings/components.d.ts
vendored
3
src/typings/components.d.ts
vendored
@ -91,8 +91,10 @@ declare module 'vue' {
|
||||
NTooltip: typeof import('naive-ui')['NTooltip']
|
||||
NTree: typeof import('naive-ui')['NTree']
|
||||
OperateDrawer: typeof import('./../components/common/operate-drawer.vue')['default']
|
||||
OperationReason: typeof import('./../components/common/operation-reason.vue')['default']
|
||||
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
|
||||
ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
|
||||
RouteKey: typeof import('./../components/common/route-key.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
Search: typeof import('../components/common/search-form.vue')['default']
|
||||
@ -104,6 +106,7 @@ declare module 'vue' {
|
||||
SystemLogo: typeof import('./../components/common/system-logo.vue')['default']
|
||||
TableColumnSetting: typeof import('./../components/advanced/table-column-setting.vue')['default']
|
||||
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
||||
TaskBatchStatus: typeof import('./../components/common/task-batch-status.vue')['default']
|
||||
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
||||
WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { fetchGetRetryScenePageList } from '@/service/api';
|
||||
import { NButton, NPopconfirm, NSwitch, NTag } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import { fetchGetRetryScenePageList, fetchUpdateSceneStatus } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { backOffRecord, enableStatusNumberRecord, routeKeyRecord } from '@/constants/business';
|
||||
import { backOffRecord, routeKeyRecord } from '@/constants/business';
|
||||
import SceneOperateDrawer from './modules/scene-operate-drawer.vue';
|
||||
import SceneSearch from './modules/scene-search.vue';
|
||||
|
||||
const appStore = useAppStore();
|
||||
/** 组状态 Switch 的 loading 状态 */
|
||||
const statusSwitchLoading = ref(false);
|
||||
|
||||
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
||||
apiFn: fetchGetRetryScenePageList,
|
||||
@ -27,12 +30,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
align: 'center',
|
||||
width: 48
|
||||
},
|
||||
{
|
||||
key: 'index',
|
||||
title: $t('common.index'),
|
||||
align: 'center',
|
||||
width: 64
|
||||
},
|
||||
{
|
||||
key: 'groupName',
|
||||
title: $t('page.retryScene.groupName'),
|
||||
@ -51,8 +48,15 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
align: 'left',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
const label = $t(enableStatusNumberRecord[row.sceneStatus!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
return (
|
||||
<NSwitch
|
||||
v-model:value={row.sceneStatus}
|
||||
v-model:loading={statusSwitchLoading.value}
|
||||
checkedValue={1}
|
||||
uncheckedValue={0}
|
||||
onUpdateValue={() => handleUpdateValue(row)}
|
||||
></NSwitch>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -164,6 +168,16 @@ function handleDelete(id: string) {
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
}
|
||||
|
||||
async function handleUpdateValue(scene: Api.RetryScene.Scene) {
|
||||
statusSwitchLoading.value = true;
|
||||
try {
|
||||
await fetchUpdateSceneStatus(scene.id as any, scene.sceneStatus);
|
||||
} finally {
|
||||
await getData();
|
||||
statusSwitchLoading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Loading…
Reference in New Issue
Block a user