feat(sj_1.0.0): 完成工作流的复制、新增、更新、操作
This commit is contained in:
parent
f2a03043ab
commit
64a4e77ddf
@ -49,6 +49,8 @@ const local: App.I18n.Schema = {
|
||||
fail: 'Fail',
|
||||
stop: 'Stop',
|
||||
execute: 'Execute',
|
||||
batchList: 'Batch',
|
||||
copy: 'Copy',
|
||||
resume: 'Resume',
|
||||
pause: 'Pause',
|
||||
finish: 'Finish',
|
||||
|
@ -49,6 +49,8 @@ const local: App.I18n.Schema = {
|
||||
fail: '失败',
|
||||
stop: '停止',
|
||||
execute: '执行',
|
||||
copy: '复制',
|
||||
batchList: '批次',
|
||||
resume: '恢复',
|
||||
pause: '暂停',
|
||||
finish: '完成',
|
||||
|
@ -9,6 +9,14 @@ export function fetchGetWorkflowPageList(params?: Api.Workflow.WorkflowSearchPar
|
||||
});
|
||||
}
|
||||
|
||||
/** trigger workflow */
|
||||
export function fetchTriggerWorkflow(id: string) {
|
||||
return request({
|
||||
url: `/workflow/trigger/${id}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
||||
/** get namespace list */
|
||||
export function fetchGetWorkflowNameList(params?: Api.WorkflowBatch.WorkflowBatchSearchParams) {
|
||||
return request<Api.Workflow.Workflow[]>({
|
||||
|
2
src/typings/app.d.ts
vendored
2
src/typings/app.d.ts
vendored
@ -295,6 +295,8 @@ declare namespace App {
|
||||
fail: string;
|
||||
stop: string;
|
||||
execute: string;
|
||||
batchList: string;
|
||||
copy: string;
|
||||
resume: string;
|
||||
pause: string;
|
||||
finish: string;
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onActivated, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { $t } from '@/locales';
|
||||
|
||||
defineOptions({
|
||||
name: 'WorkFlowIframe'
|
||||
@ -23,18 +24,18 @@ const baseUrl = import.meta.env.BASE_URL;
|
||||
|
||||
function save() {
|
||||
window.removeEventListener('message', handleMessage);
|
||||
window.$message?.info('工作流新增成功');
|
||||
router.push({ path: '/job/workflow/list' });
|
||||
window.$message?.info($t('common.addSuccess'));
|
||||
router.push({ path: '/workflow/task' });
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
window.removeEventListener('message', handleMessage);
|
||||
router.push({ path: '/job/workflow/list' });
|
||||
router.push({ path: '/workflow/task' });
|
||||
}
|
||||
|
||||
function update() {
|
||||
window.$message?.info('工作流修改成功');
|
||||
router.push({ path: '/job/workflow/list' });
|
||||
window.$message?.info($t('common.updateSuccess'));
|
||||
router.push({ path: '/workflow/task' });
|
||||
}
|
||||
|
||||
function handleMessage(e: MessageEvent) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { fetchGetWorkflowPageList } from '@/service/api';
|
||||
import { fetchGetWorkflowPageList, fetchTriggerWorkflow } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
@ -38,7 +38,18 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'workflowName',
|
||||
title: $t('page.workflow.workflowName'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
function showDetailDrawer() {
|
||||
detail(row.id!);
|
||||
}
|
||||
|
||||
return (
|
||||
<n-button text tag="a" type="primary" onClick={showDetailDrawer} class="ws-normal">
|
||||
{row.workflowName}
|
||||
</n-button>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'groupName',
|
||||
@ -102,12 +113,22 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
align: 'center',
|
||||
width: 130,
|
||||
fixed: 'right',
|
||||
width: 300,
|
||||
render: row => (
|
||||
<div class="flex-center gap-8px">
|
||||
<NButton type="primary" ghost size="small" onClick={() => edit(row.id!)}>
|
||||
<NButton type="primary" ghost size="small" onClick={() => execute(row.id!)}>
|
||||
{$t('common.execute')}
|
||||
</NButton>
|
||||
<NButton type="primary" ghost size="small" onClick={() => copy(row.id!)}>
|
||||
{$t('common.copy')}
|
||||
</NButton>
|
||||
<NButton type="warning" ghost size="small" onClick={() => edit(row.id!)}>
|
||||
{$t('common.edit')}
|
||||
</NButton>
|
||||
<NButton type="success" ghost size="small" onClick={() => batch(row.id!)}>
|
||||
{$t('common.batchList')}
|
||||
</NButton>
|
||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
||||
{{
|
||||
default: () => $t('common.confirmDelete'),
|
||||
@ -125,7 +146,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
});
|
||||
|
||||
const {
|
||||
handleEdit,
|
||||
checkedRowKeys,
|
||||
onBatchDeleted,
|
||||
onDeleted
|
||||
@ -147,12 +167,32 @@ function handleDelete(id: string) {
|
||||
}
|
||||
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
router.push({ path: '/workflow/form/edit', query: { id } });
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
router.push({ path: '/workflow/form/edit' });
|
||||
}
|
||||
|
||||
function detail(id: string) {
|
||||
router.push({ path: '/workflow/form/detail', query: { id } });
|
||||
}
|
||||
|
||||
function copy(id: string) {
|
||||
router.push({ path: '/workflow/form/copy', query: { id } });
|
||||
}
|
||||
|
||||
function batch(id: string) {
|
||||
router.push({ path: '/workflow/batch', query: { workflowId: id } });
|
||||
}
|
||||
|
||||
async function execute(id: string) {
|
||||
const { error } = await fetchTriggerWorkflow(id);
|
||||
if (!error) {
|
||||
window.$message?.success($t('common.executeSuccess'));
|
||||
getData();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -180,7 +220,7 @@ function handleAdd() {
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
:flex-height="!appStore.isMobile"
|
||||
:scroll-x="962"
|
||||
:scroll-x="1300"
|
||||
:loading="loading"
|
||||
remote
|
||||
:row-key="row => row.id"
|
||||
|
Loading…
Reference in New Issue
Block a user