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',
|
fail: 'Fail',
|
||||||
stop: 'Stop',
|
stop: 'Stop',
|
||||||
execute: 'Execute',
|
execute: 'Execute',
|
||||||
|
batchList: 'Batch',
|
||||||
|
copy: 'Copy',
|
||||||
resume: 'Resume',
|
resume: 'Resume',
|
||||||
pause: 'Pause',
|
pause: 'Pause',
|
||||||
finish: 'Finish',
|
finish: 'Finish',
|
||||||
|
@ -49,6 +49,8 @@ const local: App.I18n.Schema = {
|
|||||||
fail: '失败',
|
fail: '失败',
|
||||||
stop: '停止',
|
stop: '停止',
|
||||||
execute: '执行',
|
execute: '执行',
|
||||||
|
copy: '复制',
|
||||||
|
batchList: '批次',
|
||||||
resume: '恢复',
|
resume: '恢复',
|
||||||
pause: '暂停',
|
pause: '暂停',
|
||||||
finish: '完成',
|
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 */
|
/** get namespace list */
|
||||||
export function fetchGetWorkflowNameList(params?: Api.WorkflowBatch.WorkflowBatchSearchParams) {
|
export function fetchGetWorkflowNameList(params?: Api.WorkflowBatch.WorkflowBatchSearchParams) {
|
||||||
return request<Api.Workflow.Workflow[]>({
|
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;
|
fail: string;
|
||||||
stop: string;
|
stop: string;
|
||||||
execute: string;
|
execute: string;
|
||||||
|
batchList: string;
|
||||||
|
copy: string;
|
||||||
resume: string;
|
resume: string;
|
||||||
pause: string;
|
pause: string;
|
||||||
finish: string;
|
finish: string;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onActivated, onMounted, ref } from 'vue';
|
import { onActivated, onMounted, ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { $t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'WorkFlowIframe'
|
name: 'WorkFlowIframe'
|
||||||
@ -23,18 +24,18 @@ const baseUrl = import.meta.env.BASE_URL;
|
|||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
window.removeEventListener('message', handleMessage);
|
window.removeEventListener('message', handleMessage);
|
||||||
window.$message?.info('工作流新增成功');
|
window.$message?.info($t('common.addSuccess'));
|
||||||
router.push({ path: '/job/workflow/list' });
|
router.push({ path: '/workflow/task' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
window.removeEventListener('message', handleMessage);
|
window.removeEventListener('message', handleMessage);
|
||||||
router.push({ path: '/job/workflow/list' });
|
router.push({ path: '/workflow/task' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
window.$message?.info('工作流修改成功');
|
window.$message?.info($t('common.updateSuccess'));
|
||||||
router.push({ path: '/job/workflow/list' });
|
router.push({ path: '/workflow/task' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMessage(e: MessageEvent) {
|
function handleMessage(e: MessageEvent) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { fetchGetWorkflowPageList } from '@/service/api';
|
import { fetchGetWorkflowPageList, fetchTriggerWorkflow } 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';
|
||||||
@ -38,7 +38,18 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
key: 'workflowName',
|
key: 'workflowName',
|
||||||
title: $t('page.workflow.workflowName'),
|
title: $t('page.workflow.workflowName'),
|
||||||
align: 'left',
|
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',
|
key: 'groupName',
|
||||||
@ -102,12 +113,22 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
key: 'operate',
|
key: 'operate',
|
||||||
title: $t('common.operate'),
|
title: $t('common.operate'),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 130,
|
fixed: 'right',
|
||||||
|
width: 300,
|
||||||
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={() => 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')}
|
{$t('common.edit')}
|
||||||
</NButton>
|
</NButton>
|
||||||
|
<NButton type="success" ghost size="small" onClick={() => batch(row.id!)}>
|
||||||
|
{$t('common.batchList')}
|
||||||
|
</NButton>
|
||||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
||||||
{{
|
{{
|
||||||
default: () => $t('common.confirmDelete'),
|
default: () => $t('common.confirmDelete'),
|
||||||
@ -125,7 +146,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
handleEdit,
|
|
||||||
checkedRowKeys,
|
checkedRowKeys,
|
||||||
onBatchDeleted,
|
onBatchDeleted,
|
||||||
onDeleted
|
onDeleted
|
||||||
@ -147,12 +167,32 @@ function handleDelete(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function edit(id: string) {
|
function edit(id: string) {
|
||||||
handleEdit(id);
|
router.push({ path: '/workflow/form/edit', query: { id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
router.push({ path: '/workflow/form/edit' });
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -180,7 +220,7 @@ function handleAdd() {
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="data"
|
:data="data"
|
||||||
:flex-height="!appStore.isMobile"
|
:flex-height="!appStore.isMobile"
|
||||||
:scroll-x="962"
|
:scroll-x="1300"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
remote
|
remote
|
||||||
:row-key="row => row.id"
|
:row-key="row => row.id"
|
||||||
|
Loading…
Reference in New Issue
Block a user