refactor(04): calculate stat
This commit is contained in:
parent
f03eb722b5
commit
d8a6b346ab
2 changed files with 41 additions and 8 deletions
|
|
@ -413,8 +413,18 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
}
|
||||
|
||||
// Service
|
||||
async function fetchStatsService() {
|
||||
const res = await api.get('/service/stats');
|
||||
async function fetchStatsService(opts?: { productGroupId?: string }) {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
for (const [k, v] of Object.entries(opts || {})) {
|
||||
v !== undefined && params.append(k, v.toString());
|
||||
}
|
||||
|
||||
const query = params.toString();
|
||||
|
||||
const res = await api.get(
|
||||
`/service/stats${(params && '?'.concat(query)) || ''}`,
|
||||
);
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue