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

View File

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

View File

@ -50,6 +50,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
"user-center": () => import("@/views/user-center/index.vue"), "user-center": () => import("@/views/user-center/index.vue"),
user_manager: () => import("@/views/user/manager/index.vue"), user_manager: () => import("@/views/user/manager/index.vue"),
workflow_batch: () => import("@/views/workflow/batch/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_copy: () => import("@/views/workflow/form/copy/index.vue"),
workflow_form_detail: () => import("@/views/workflow/form/detail/index.vue"), workflow_form_detail: () => import("@/views/workflow/form/detail/index.vue"),
workflow_form_edit: () => import("@/views/workflow/form/edit/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' i18nKey: 'route.workflow_form'
}, },
children: [ 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', name: 'workflow_form_copy',
path: '/workflow/form/copy', path: '/workflow/form/copy',

View File

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

View File

@ -48,3 +48,10 @@ export function fetchDelWorkflow(id: string) {
method: 'delete' 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; success: string;
fail: string; fail: string;
stop: string; stop: string;
confirmStop: string;
execute: string; execute: string;
batchList: string; batchList: string;
copy: string; copy: string;

View File

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