demo data
This commit is contained in:
parent
5faa4b7906
commit
36ca3d90a7
29 changed files with 304 additions and 99 deletions
|
@ -6,6 +6,8 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { VehicleViewModel } from "../../../../viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { damageReportDemoData } from "../../../../demodata/damageReport";
|
||||
|
||||
export const useDamageReportStore = defineStore("damageReport", {
|
||||
state: () => {
|
||||
|
@ -13,11 +15,14 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
damageReports: [] as Array<DamageReportViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchDamageReports(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.damageReports = damageReportDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,9 +68,6 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
fetchDamageReportById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}`);
|
||||
},
|
||||
fetchDamageReportStatisticsById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}/statistics`);
|
||||
},
|
||||
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/damageReport`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentDemoData } from "../../../../demodata/equipment";
|
||||
|
||||
export const useEquipmentStore = defineStore("equipment", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipments(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipments = equipmentDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipments.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipments = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,6 +68,9 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
});
|
||||
},
|
||||
fetchEquipmentByActiveId() {
|
||||
this.activeEquipmentObj = equipmentDemoData.find((e) => e.id == this.activeEquipment) as EquipmentViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipment/${this.activeEquipment}`)
|
||||
|
@ -77,14 +85,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
fetchEquipmentById(id: string) {
|
||||
return http.get(`/admin/equipment/${id}`);
|
||||
},
|
||||
async printEquipmentByActiveId() {
|
||||
return http.get(`/admin/equipment/${this.activeEquipment}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchEquipmentStatisticsById(id: string) {
|
||||
return http.get(`/admin/equipment/${id}/statistics`);
|
||||
},
|
||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipment`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "../../../../demodata/equipmentType";
|
||||
|
||||
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipmentTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipmentTypes = equipmentTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipmentTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipmentTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -48,21 +53,17 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
return { ...res, data: res.data.equipments };
|
||||
});
|
||||
},
|
||||
async getEquipmentTypesByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/equipmentType/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
});
|
||||
},
|
||||
async searchEquipmentTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/equipmentType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
});
|
||||
},
|
||||
fetchEquipmentTypeByActiveId() {
|
||||
this.activeEquipmentTypeObj = equipmentTypeDemoData.find(
|
||||
(e) => e.id == this.activeEquipmentType
|
||||
) as EquipmentTypeViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryGearDemoData } from "../../../../demodata/respiratoryGear";
|
||||
|
||||
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryGears(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryGears = respiratoryGearDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryGears.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryGears = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -48,21 +53,17 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
async getRespiratoryGearsByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryGear/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryGears(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryGear?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
fetchRespiratoryGearByActiveId() {
|
||||
this.activeRespiratoryGearObj = respiratoryGearDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryGear
|
||||
) as RespiratoryGearViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}`)
|
||||
|
@ -77,14 +78,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
fetchRespiratoryGearById(id: string) {
|
||||
return http.get(`/admin/respiratoryGear/${id}`);
|
||||
},
|
||||
async printRespiratoryGearByActiveId() {
|
||||
return http.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryGearStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryGear/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryGear(respiratoryGear: CreateRespiratoryGearViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/respiratoryGear`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryMissionDemoData } from "../../../../demodata/respiratoryMission";
|
||||
|
||||
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryMissions(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryMissions = respiratoryMissionDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryMissions.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryMissions = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -52,21 +57,17 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
async getRespiratoryMissionsByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryMission/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryMissions(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryMission?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
fetchRespiratoryMissionByActiveId() {
|
||||
this.activeRespiratoryMissionObj = this.respiratoryMissions.find(
|
||||
(e) => e.id == this.activeRespiratoryMission
|
||||
) as RespiratoryMissionViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}`)
|
||||
|
@ -81,14 +82,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
fetchRespiratoryMissionById(id: string) {
|
||||
return http.get(`/admin/respiratoryMission/${id}`);
|
||||
},
|
||||
async printRespiratoryMissionByActiveId() {
|
||||
return http.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryMissionStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryMission/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryMission(
|
||||
respiratoryMission: CreateRespiratoryMissionViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryWearerDemoData } from "../../../../demodata/respiratoryWearer";
|
||||
|
||||
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryWearers(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryWearers = respiratoryWearerDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryWearers.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryWearers = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -52,21 +57,17 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
async getRespiratoryWearersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryWearer/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryWearers(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryWearer?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
fetchRespiratoryWearerByActiveId() {
|
||||
this.activeRespiratoryWearerObj = respiratoryWearerDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryWearer
|
||||
) as RespiratoryWearerViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}`)
|
||||
|
@ -81,14 +82,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
fetchRespiratoryWearerById(id: string) {
|
||||
return http.get(`/admin/respiratoryWearer/${id}`);
|
||||
},
|
||||
async printRespiratoryWearerByActiveId() {
|
||||
return http.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryWearerStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryWearer/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryWearer(
|
||||
respiratoryWearer: CreateRespiratoryWearerViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleDemoData } from "../../../../demodata/vehicle";
|
||||
|
||||
export const useVehicleStore = defineStore("vehicle", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
actions: {
|
||||
fetchVehicles(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.vehicles = vehicleDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.vehicles.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.vehicles = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,6 +68,9 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
});
|
||||
},
|
||||
fetchVehicleByActiveId() {
|
||||
this.activeVehicleObj = vehicleDemoData.find((e) => e.id == this.activeVehicle) as VehicleViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicle/${this.activeVehicle}`)
|
||||
|
@ -77,14 +85,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
fetchVehicleById(id: string) {
|
||||
return http.get(`/admin/vehicle/${id}`);
|
||||
},
|
||||
async printVehicleByActiveId() {
|
||||
return http.get(`/admin/vehicle/${this.activeVehicle}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchVehicleStatisticsById(id: string) {
|
||||
return http.get(`/admin/vehicle/${id}/statistics`);
|
||||
},
|
||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicle`, {
|
||||
// TODO: data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue