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

View file

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