fill out inspection and inspection plan
This commit is contained in:
parent
23bdde5fc2
commit
1409cf8045
12 changed files with 374 additions and 77 deletions
|
@ -1,7 +1,11 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import type {
|
||||
CreateInspectionViewModel,
|
||||
InspectionViewModel,
|
||||
UpdateInspectionViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
|
||||
export const useInspectionStore = defineStore("inspection", {
|
||||
state: () => {
|
||||
|
@ -27,19 +31,20 @@ export const useInspectionStore = defineStore("inspection", {
|
|||
fetchInspectionById(id: string) {
|
||||
return http.get(`/admin/inspection/${id}`);
|
||||
},
|
||||
async createInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
async createInspection(inspection: CreateInspectionViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspection`, {
|
||||
context: "",
|
||||
inspectionPlanId: "",
|
||||
relatedId: "",
|
||||
assigned: "equipment|vehicle",
|
||||
assigned: inspection.assigned,
|
||||
relatedId: inspection.relatedId,
|
||||
inspectionPlanId: inspection.inspectionPlanId,
|
||||
nextInspection: inspection.nextInspection,
|
||||
context: inspection.context,
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
async updateActiveInspection(inspection: UpdateInspectionViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
||||
context: "",
|
||||
nextInspection: inspection.nextInspection,
|
||||
context: inspection.context,
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue