feat: quotation stats
This commit is contained in:
parent
c5b3e4dbd7
commit
1d73d8084e
4 changed files with 89 additions and 179 deletions
|
|
@ -3,7 +3,12 @@ import { defineStore } from 'pinia';
|
|||
|
||||
import { api } from 'src/boot/axios';
|
||||
|
||||
import { Quotation, QuotationFull, QuotationPayload } from './types';
|
||||
import {
|
||||
Quotation,
|
||||
QuotationFull,
|
||||
QuotationPayload,
|
||||
QuotationStats,
|
||||
} from './types';
|
||||
import { PaginationResult } from 'src/types';
|
||||
|
||||
export const useQuotationStore = defineStore('quotation-store', () => {
|
||||
|
|
@ -11,6 +16,20 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
|||
const page = ref<number>(1);
|
||||
const pageMax = ref<number>(1);
|
||||
const pageSize = ref<number>(30);
|
||||
const stats = ref<QuotationStats>({
|
||||
full: 0,
|
||||
split: 0,
|
||||
billFull: 0,
|
||||
billSplit: 0,
|
||||
});
|
||||
|
||||
async function getQuotationStats() {
|
||||
const res = await api.get<QuotationStats>(`/quotation/stats`);
|
||||
if (res.status < 400) {
|
||||
return res.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function getQuotation(id: string) {
|
||||
const res = await api.get<QuotationFull>(`/quotation/${id}`);
|
||||
|
|
@ -92,6 +111,8 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
|||
page,
|
||||
pageSize,
|
||||
pageMax,
|
||||
stats,
|
||||
getQuotationStats,
|
||||
getQuotation,
|
||||
getQuotationList,
|
||||
createQuotation,
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ type ServiceRelation = {
|
|||
updatedByUserId: string;
|
||||
};
|
||||
|
||||
export type QuotationStats = {
|
||||
full: number;
|
||||
split: number;
|
||||
billFull: number;
|
||||
billSplit: number;
|
||||
};
|
||||
|
||||
export type Quotation = {
|
||||
_count: { worker: number };
|
||||
id: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue