feat(sj_1.0.0): 完成工作流批次列表

This commit is contained in:
opensnail 2024-05-02 00:00:28 +08:00
parent ed9503217c
commit cddfa60795
9 changed files with 71 additions and 25 deletions

View File

@ -48,6 +48,7 @@ const local: App.I18n.Schema = {
success: 'Success',
fail: 'Fail',
stop: 'Stop',
confirmStop: 'Confirm Stop?',
execute: 'Execute',
batchList: 'Batch',
copy: 'Copy',
@ -287,6 +288,7 @@ const local: App.I18n.Schema = {
workflow_batch: 'Workflow Batch',
workflow_form: 'Workflow',
workflow_form_copy: 'Copy Workflow',
workflow_form_batch: 'Workflow Batch List',
workflow_form_detail: 'Workflow Detail',
workflow_form_edit: 'Edit Workflow',
job: 'Schedule Task Management',

View File

@ -48,6 +48,7 @@ const local: App.I18n.Schema = {
success: '成功',
fail: '失败',
stop: '停止',
confirmStop: '确认停止吗?',
execute: '执行',
copy: '复制',
batchList: '批次',
@ -288,6 +289,7 @@ const local: App.I18n.Schema = {
workflow_batch: '执行批次',
workflow_form: '工作流',
workflow_form_copy: '复制工作流',
workflow_form_batch: '工作流批次列表',
workflow_form_detail: '工作流详情',
workflow_form_edit: '编辑工作流',
job: '定时任务',

View File

@ -50,6 +50,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
"user-center": () => import("@/views/user-center/index.vue"),
user_manager: () => import("@/views/user/manager/index.vue"),
workflow_batch: () => import("@/views/workflow/batch/index.vue"),
workflow_form_batch: () => import("@/views/workflow/form/batch/index.vue"),
workflow_form_copy: () => import("@/views/workflow/form/copy/index.vue"),
workflow_form_detail: () => import("@/views/workflow/form/detail/index.vue"),
workflow_form_edit: () => import("@/views/workflow/form/edit/index.vue"),

View File

@ -553,6 +553,16 @@ export const generatedRoutes: GeneratedRoute[] = [
i18nKey: 'route.workflow_form'
},
children: [
{
name: 'workflow_form_batch',
path: '/workflow/form/batch',
component: 'view.workflow_form_batch',
meta: {
hideInMenu: true,
title: 'workflow_form_batch',
i18nKey: 'route.workflow_form_batch'
}
},
{
name: 'workflow_form_copy',
path: '/workflow/form/copy',

View File

@ -203,6 +203,7 @@ const routeMap: RouteMap = {
"workflow": "/workflow",
"workflow_batch": "/workflow/batch",
"workflow_form": "/workflow/form",
"workflow_form_batch": "/workflow/form/batch",
"workflow_form_copy": "/workflow/form/copy",
"workflow_form_detail": "/workflow/form/detail",
"workflow_form_edit": "/workflow/form/edit",

View File

@ -48,3 +48,10 @@ export function fetchDelWorkflow(id: string) {
method: 'delete'
});
}
export function fetchStopWorkflowBatch(id: string) {
return request({
url: `/workflow/batch/stop/${id}`,
method: 'post'
});
}

View File

@ -294,6 +294,7 @@ declare namespace App {
success: string;
fail: string;
stop: string;
confirmStop: string;
execute: string;
batchList: string;
copy: string;

View File

@ -1,11 +1,13 @@
<script setup lang="tsx">
import { NButton, NPopconfirm, NTag } from 'naive-ui';
import { fetchGetWorkflowBatchList } from '@/service/api';
import { useRouter } from 'vue-router';
import { fetchGetWorkflowBatchList, fetchStopWorkflowBatch } 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 router = useRouter();
const appStore = useAppStore();
@ -63,9 +65,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
const tagMap: Record<number, NaiveUI.ThemeColor> = {
1: 'info',
2: 'success',
3: 'warning',
3: 'success',
4: 'error',
5: 'error',
5: 'warning',
6: 'warning'
};
@ -100,19 +102,23 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
width: 130,
render: row => (
<div class="flex-center gap-8px">
<NButton type="primary" ghost size="small" onClick={() => edit(row.id!)}>
{$t('common.edit')}
<NButton type="primary" ghost size="small" onClick={() => detail(row.id!)}>
{$t('common.detail')}
</NButton>
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
{{
default: () => $t('common.confirmDelete'),
trigger: () => (
<NButton type="error" ghost size="small">
{$t('common.delete')}
</NButton>
)
}}
</NPopconfirm>
{row?.taskBatchStatus === 1 || row?.taskBatchStatus === 2 ? (
<NPopconfirm onPositiveClick={() => handleStop(row.id!)} v-if="">
{{
default: () => $t('common.confirmStop'),
trigger: () => (
<NButton type="error" ghost size="small">
{$t('common.stop')}
</NButton>
)
}}
</NPopconfirm>
) : (
''
)}
</div>
)
}
@ -121,10 +127,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
const {
handleAdd,
handleEdit,
checkedRowKeys,
onBatchDeleted,
onDeleted
onBatchDeleted
// closeDrawer
} = useTableOperate(data, getData);
@ -135,15 +139,16 @@ async function handleBatchDelete() {
onBatchDeleted();
}
function handleDelete(id: string) {
// request
console.log(id);
onDeleted();
async function handleStop(id: string) {
const { error } = await fetchStopWorkflowBatch(id);
if (!error) {
window.$message?.success($t('common.executeSuccess'));
getData();
}
}
function edit(id: string) {
handleEdit(id);
function detail(id: string) {
router.push({ path: '/workflow/form/batch', query: { id } });
}
</script>

View File

@ -0,0 +1,17 @@
<script setup lang="ts">
import WorkFlowIframe from '../modules/workflow-iframe.vue';
defineOptions({
name: 'WorkFlowDetail'
});
</script>
<template>
<div class="iframe"><WorkFlowIframe value="kaxC8Iml" /></div>
</template>
<style scoped>
.iframe {
padding: 0 !important;
}
</style>