diff --git a/src/stores/branch/index.ts b/src/stores/branch/index.ts index d270d850..c2b91b4f 100644 --- a/src/stores/branch/index.ts +++ b/src/stores/branch/index.ts @@ -2,17 +2,19 @@ import { ref } from 'vue'; import { defineStore } from 'pinia'; import { Pagination } from '../types'; import { api } from 'src/boot/axios'; -import { Branch, BranchCreate } from './types'; +import { Branch, BranchCreate, BranchWithChildren } from './types'; const useBranchStore = defineStore('api-branch', () => { const data = ref>(); - async function fetchList( + async function fetchList( opts?: { page?: number; pageSize?: number; zipCode?: string; query?: string; + tree?: boolean; + filter?: 'head' | 'sub'; }, flow?: { sessionId: string; @@ -28,10 +30,11 @@ const useBranchStore = defineStore('api-branch', () => { if (opts?.page && opts.page > 0) params.append('page', `${opts.page}`); if (opts?.zipCode) params.append('zipCode', opts.zipCode); if (opts?.query) params.append('query', opts.query); + if (opts?.tree) params.append('tree', 'true'); const query = params.toString(); - const res = await api.get>( + const res = await api.get>( `/branch${(params && '?'.concat(query)) || ''}`, { headers: { @@ -44,7 +47,7 @@ const useBranchStore = defineStore('api-branch', () => { if (res && res.status === 200) { data.value = res.data; - return data.value; + return data.value as Pagination; } return false; }