feat(sj_1.0.0): 完成工作流批次展示
This commit is contained in:
parent
64a4e77ddf
commit
ed9503217c
@ -7,7 +7,8 @@ export * from './system-manage';
|
||||
export * from './notify';
|
||||
export * from './group';
|
||||
export * from './retry-task';
|
||||
export * from './retry';
|
||||
export * from './retry-scene';
|
||||
export * from './retry-log';
|
||||
export * from './retry-dead-letter';
|
||||
export * from './workflow';
|
||||
export * from './job';
|
||||
|
35
src/service/api/retry-log.ts
Normal file
35
src/service/api/retry-log.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { request } from '../request';
|
||||
|
||||
/** get retry log list */
|
||||
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
||||
return request<Api.RetryLog.RetryLogList>({
|
||||
url: '/retry-task-log/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** get retry log list */
|
||||
export function fetchRetryLogById(id: string) {
|
||||
return request<Api.RetryLog.RetryLog>({
|
||||
url: `/retry-task-log/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 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
|
||||
});
|
||||
}
|
@ -43,37 +43,3 @@ export function fetchUpdateSceneStatus(id: string, status: Api.Common.EnableStat
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** get retry log list */
|
||||
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
||||
return request<Api.RetryLog.RetryLogList>({
|
||||
url: '/retry-task-log/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** get retry log list */
|
||||
export function fetchRetryLogById(id: string) {
|
||||
return request<Api.RetryLog.RetryLog>({
|
||||
url: `/retry-task-log/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 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
|
||||
});
|
||||
}
|
@ -34,3 +34,17 @@ export function fetchGetWorkflowBatchList(params?: Api.WorkflowBatch.WorkflowBat
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchUpdateWorkflowStatus(id: string) {
|
||||
return request({
|
||||
url: `/workflow/update/status/${id}`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchDelWorkflow(id: string) {
|
||||
return request({
|
||||
url: `/workflow/${id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
@ -59,7 +59,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
width: 80,
|
||||
render: row => {
|
||||
const fetchFn = async (groupStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
|
||||
const { error } = await fetchUpdateGroupStatus({ groupName: row.groupName, groupStatus: row.groupStatus });
|
||||
const status = row.groupStatus === 1 ? 0 : 1;
|
||||
const { error } = await fetchUpdateGroupStatus({ groupName: row.groupName, groupStatus: status });
|
||||
if (!error) {
|
||||
row.groupStatus = groupStatus;
|
||||
window.$message?.success($t('common.updateSuccess'));
|
||||
|
@ -1,9 +1,10 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { fetchGetWorkflowBatchList } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { operationReasonRecord, taskBatchStatusRecord } from '@/constants/business';
|
||||
import WorkflowBatchSearch from './modules/workflow-batch-search.vue';
|
||||
|
||||
const appStore = useAppStore();
|
||||
@ -53,13 +54,38 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'taskBatchStatus',
|
||||
title: $t('page.workflowBatch.taskBatchStatus'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
if (!row.taskBatchStatus) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const tagMap: Record<number, NaiveUI.ThemeColor> = {
|
||||
1: 'info',
|
||||
2: 'success',
|
||||
3: 'warning',
|
||||
4: 'error',
|
||||
5: 'error',
|
||||
6: 'warning'
|
||||
};
|
||||
|
||||
const label = $t(taskBatchStatusRecord[row.taskBatchStatus!]);
|
||||
return <NTag type={tagMap[row.taskBatchStatus]}>{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'operationReason',
|
||||
title: $t('page.workflowBatch.operationReason'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
if (!row.operationReason) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = $t(operationReasonRecord[row.operationReason!]);
|
||||
return <NTag type="warning">{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'createDt',
|
||||
@ -94,9 +120,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
});
|
||||
|
||||
const {
|
||||
drawerVisible,
|
||||
operateType,
|
||||
editingData,
|
||||
handleAdd,
|
||||
handleEdit,
|
||||
checkedRowKeys,
|
||||
@ -139,6 +162,7 @@ function edit(id: string) {
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-delete="false"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@refresh="getData"
|
||||
@ -156,12 +180,6 @@ function edit(id: string) {
|
||||
:pagination="mobilePagination"
|
||||
class="sm:h-full"
|
||||
/>
|
||||
<WorkflowBatchOperateDrawer
|
||||
v-model:visible="drawerVisible"
|
||||
:operate-type="operateType"
|
||||
:row-data="editingData"
|
||||
@submitted="getData"
|
||||
/>
|
||||
</NCard>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -1,11 +1,18 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { fetchGetWorkflowPageList, fetchTriggerWorkflow } from '@/service/api';
|
||||
import {
|
||||
fetchDelWorkflow,
|
||||
fetchGetWorkflowPageList,
|
||||
fetchTriggerWorkflow,
|
||||
fetchUpdateWorkflowStatus
|
||||
} from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { enableStatusNumberRecord, triggerTypeRecord } from '@/constants/business';
|
||||
import { triggerTypeRecord } from '@/constants/business';
|
||||
import StatusSwitch from '@/components/common/status-switch.vue';
|
||||
import { tagColor } from '@/utils/common';
|
||||
import WorkflowSearch from './modules/workflow-search.vue';
|
||||
|
||||
const router = useRouter();
|
||||
@ -23,11 +30,11 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
workflowStatus: null
|
||||
},
|
||||
columns: () => [
|
||||
{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
width: 48
|
||||
},
|
||||
// {
|
||||
// type: 'selection',
|
||||
// align: 'center',
|
||||
// width: 48
|
||||
// },
|
||||
{
|
||||
key: 'index',
|
||||
title: $t('common.index'),
|
||||
@ -69,12 +76,16 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
align: 'left',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
if (!row.workflowStatus) {
|
||||
return null;
|
||||
}
|
||||
const fetchFn = async (workflowStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
|
||||
const { error } = await fetchUpdateWorkflowStatus(row.id!);
|
||||
if (!error) {
|
||||
row.workflowStatus = workflowStatus;
|
||||
window.$message?.success($t('common.updateSuccess'));
|
||||
}
|
||||
callback();
|
||||
};
|
||||
|
||||
const label = $t(enableStatusNumberRecord[row.workflowStatus!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
return <StatusSwitch v-model:value={row.workflowStatus} onFetch={fetchFn} />;
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -88,7 +99,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
}
|
||||
|
||||
const label = $t(triggerTypeRecord[row.triggerType!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
return <NTag type={tagColor(row.triggerType)}>{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -147,8 +158,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
|
||||
const {
|
||||
checkedRowKeys,
|
||||
onBatchDeleted,
|
||||
onDeleted
|
||||
onBatchDeleted
|
||||
// closeDrawer
|
||||
} = useTableOperate(data, getData);
|
||||
|
||||
@ -159,11 +169,13 @@ async function handleBatchDelete() {
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
function handleDelete(id: string) {
|
||||
async function handleDelete(id: string) {
|
||||
// request
|
||||
console.log(id);
|
||||
|
||||
onDeleted();
|
||||
const { error } = await fetchDelWorkflow(id!);
|
||||
if (!error) {
|
||||
window.$message?.success($t('common.deleteSuccess'));
|
||||
getData();
|
||||
}
|
||||
}
|
||||
|
||||
function edit(id: string) {
|
||||
@ -210,6 +222,7 @@ async function execute(id: string) {
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-delete="false"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@refresh="getData"
|
||||
|
Loading…
Reference in New Issue
Block a user