feat: add getGroupList function and responsibleGroup to workflow types

This commit is contained in:
puriphatt 2025-04-24 12:52:47 +07:00
parent 63036b03fd
commit 8cf93d0016
2 changed files with 21 additions and 3 deletions

View file

@ -2,7 +2,7 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
import { api } from 'src/boot/axios';
import { PaginationResult } from 'src/types';
import { WorkflowTemplate, WorkflowTemplatePayload } from './types';
import { WorkflowTemplate, WorkflowTemplatePayload, Group } from './types';
import { Status } from '../types';
export const useWorkflowTemplate = defineStore('workflow-store', () => {
@ -38,7 +38,7 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
return res.data;
}
async function creatWorkflowTemplate(data: WorkflowTemplatePayload) {
async function createWorkflowTemplate(data: WorkflowTemplatePayload) {
const res = await api.post<WorkflowTemplate>('/workflow-template', data);
if (res.status >= 400) return null;
return res;
@ -64,6 +64,12 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
return res;
}
async function getGroupList() {
const res = await api.get<Group[]>('/keycloak/group');
if (res.status >= 400) return null;
return res.data;
}
return {
data,
page,
@ -72,8 +78,9 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
getWorkflowTemplate,
getWorkflowTemplateList,
creatWorkflowTemplate,
createWorkflowTemplate,
editWorkflowTemplate,
deleteWorkflowTemplate,
getGroupList,
};
});

View file

@ -23,6 +23,7 @@ export type WorkflowStep = {
user: CreatedBy;
}[];
responsibleInstitution: (string | { group: string })[];
responsibleGroup: string[];
attributes: WorkFlowAttributes;
};
@ -49,6 +50,7 @@ export type WorkflowTemplatePayload = {
export type WorkflowUserInTable = {
name: string;
responsibleGroup: Group[];
responsiblePerson: {
id: string;
selectedImage?: string;
@ -73,6 +75,15 @@ export type WorkFlowPayloadStep = {
value?: string[];
responsiblePersonId?: string[];
responsibleInstitution?: string[];
responsibleGroup?: string[];
attributes: WorkFlowAttributes;
messengerByArea?: boolean;
};
export type Group = {
id: string;
name: string;
path: string;
subGroupCount: number;
subGroups: Group[];
};