diff --git a/src/components/workflow/modules/drawer/workflow-drawer.vue b/src/components/workflow/modules/drawer/workflow-drawer.vue new file mode 100644 index 0000000..68e2e5e --- /dev/null +++ b/src/components/workflow/modules/drawer/workflow-drawer.vue @@ -0,0 +1,164 @@ + + + diff --git a/src/components/workflow/modules/nodes/add-node.vue b/src/components/workflow/modules/nodes/add-node.vue index 903d415..4762df5 100644 --- a/src/components/workflow/modules/nodes/add-node.vue +++ b/src/components/workflow/modules/nodes/add-node.vue @@ -84,6 +84,26 @@ const addType = (type: number) => { ], childNode: props.modelValue }; + } else if (type === 4) { + // 子流程 + node = { + nodeName: $t('workflow.node.subWorkflow.nodeName'), + nodeType: type, + conditionNodes: [ + { + nodeName: $t('workflow.node.subWorkflow.nodeName'), + failStrategy: 1, + priorityLevel: 1, + workflowNodeStatus: 1, + subWorkflow: { + id: undefined + } + } + ], + childNode: props.modelValue + }; + } else { + throw new Error(`type error:${type}`); } emit('update:modelValue', node); }; @@ -118,6 +138,12 @@ const addType = (type: number) => {

{{ $t('workflow.node.callback.nodeName') }}

+
  • + + + +

    {{ $t('workflow.node.subWorkflow.nodeName') }}

    +
  • diff --git a/src/components/workflow/modules/nodes/node-wrap.vue b/src/components/workflow/modules/nodes/node-wrap.vue index 0363e76..f8db5d2 100644 --- a/src/components/workflow/modules/nodes/node-wrap.vue +++ b/src/components/workflow/modules/nodes/node-wrap.vue @@ -62,5 +62,16 @@ watch( + + + + diff --git a/src/components/workflow/modules/nodes/start-node.vue b/src/components/workflow/modules/nodes/start-node.vue index 9bbbdac..3c755a9 100644 --- a/src/components/workflow/modules/nodes/start-node.vue +++ b/src/components/workflow/modules/nodes/start-node.vue @@ -51,6 +51,7 @@ watch( val => { if (val) { store.setJobList(val); + store.setWorkflowList(val); } }, { immediate: true } diff --git a/src/components/workflow/modules/nodes/workflow-node.vue b/src/components/workflow/modules/nodes/workflow-node.vue new file mode 100644 index 0000000..80051f0 --- /dev/null +++ b/src/components/workflow/modules/nodes/workflow-node.vue @@ -0,0 +1,324 @@ + + + + + diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 265d5d8..d9ed39d 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -985,6 +985,14 @@ const local: App.I18n.Schema = { webhookTip: 'Please configure callback notifications' } }, + subWorkflow: { + nodeName: 'Workflow', + conditionNodes: { + nodeName: 'Workflow', + contentType: 'Workflow', + webhookTip: 'Workflow' + } + }, endNode: 'End Node', log: { title: 'Log Detail' diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index fecc90b..faf53dd 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -991,6 +991,14 @@ const local: App.I18n.Schema = { webhookTip: '请配置回调通知' } }, + subWorkflow: { + nodeName: '工作流', + conditionNodes: { + nodeName: '工作流', + contentType: '工作流', + webhookTip: '工作流' + } + }, endNode: '流程结束', log: { title: '日志详情' diff --git a/src/store/modules/workflow/index.ts b/src/store/modules/workflow/index.ts index 361da0e..6f4fff1 100644 --- a/src/store/modules/workflow/index.ts +++ b/src/store/modules/workflow/index.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia'; import { ref } from 'vue'; -import { fetchGetJobList } from '@/service/api'; +import { fetchGetJobList, fetchGetWorkflowNameList } from '@/service/api'; import { SetupStoreId } from '@/enum'; export const useWorkflowStore = defineStore(SetupStoreId.Workflow, () => { @@ -8,6 +8,7 @@ export const useWorkflowStore = defineStore(SetupStoreId.Workflow, () => { const type = ref(); const groupName = ref(); const jobList = ref[]>([]); + const workflowList = ref[]>([]); function setId(value: string) { id.value = value; @@ -30,6 +31,19 @@ export const useWorkflowStore = defineStore(SetupStoreId.Workflow, () => { } } + async function setWorkflowList(value: string) { + groupName.value = value; + const { data, error } = await fetchGetWorkflowNameList({ groupName: value }); + if (!error) { + workflowList.value = data.map(item => { + return { + id: item.id!, + workflowName: item.workflowName + }; + }); + } + } + function clear() { id.value = undefined; type.value = undefined; @@ -42,7 +56,9 @@ export const useWorkflowStore = defineStore(SetupStoreId.Workflow, () => { type, groupName, jobList, + workflowList, setJobList, + setWorkflowList, setType, setId, clear diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index aa9c259..55258db 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -1194,6 +1194,14 @@ declare namespace App { webhookTip: string; }; }; + subWorkflow: { + nodeName: string; + conditionNodes: { + nodeName: string; + contentType: string; + webhookTip: string; + }; + }; endNode: string; log: { title: string; diff --git a/src/typings/workflow.d.ts b/src/typings/workflow.d.ts index 2862972..afdb0d9 100644 --- a/src/typings/workflow.d.ts +++ b/src/typings/workflow.d.ts @@ -76,6 +76,8 @@ declare namespace Workflow { callback?: CallbackNodeType; /** 子节点 */ childNode?: NodeModelType; + /** 子流程 */ + subWorkflow?: WorkflowNodeType; }; /** 任务节点 */ @@ -85,6 +87,13 @@ declare namespace Workflow { /** 任务名称 */ jobName?: string; }; + /** 子流程 */ + type WorkflowNodeType = { + /** 任务ID */ + id?: string; + /** 任务名称 */ + name?: string; + }; /** 条件节点 */ type BrachNodeType = {