2024-12-20 18:19:18 +08:00
|
|
|
import {defineStore} from "pinia";
|
|
|
|
|
import {CHECK_STORE_KEY} from "@/stores/constant";
|
|
|
|
|
import type {CheckData} from "@/api/check/interface";
|
2025-02-25 10:17:33 +08:00
|
|
|
import type {Plan} from '@/api/plan/interface'
|
2024-12-20 18:19:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export const useCheckStore = defineStore("check", {
|
|
|
|
|
id: CHECK_STORE_KEY,
|
|
|
|
|
|
|
|
|
|
state: () => ({
|
2024-12-24 11:29:31 +08:00
|
|
|
devices: Array<CheckData.Device>(),
|
2025-02-25 10:17:33 +08:00
|
|
|
plan: Object<Plan.ResPlan>(),
|
2025-02-26 13:22:01 +08:00
|
|
|
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
|
2025-02-25 11:00:04 +08:00
|
|
|
checkType:1
|
2024-12-20 18:19:18 +08:00
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
getters: {},
|
|
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
|
addDevices(device: CheckData.Device[]) {
|
|
|
|
|
this.devices.push(...device);
|
|
|
|
|
},
|
2025-02-25 10:17:33 +08:00
|
|
|
setPlan(plan: Plan.ResPlan) {
|
|
|
|
|
this.plan = plan
|
|
|
|
|
},
|
2024-12-20 18:19:18 +08:00
|
|
|
clearDevices() {
|
|
|
|
|
this.devices = [];
|
2024-12-24 11:29:31 +08:00
|
|
|
},
|
2025-02-25 10:17:33 +08:00
|
|
|
initSelectTestItems() {
|
|
|
|
|
this.selectTestItems.preTest = true
|
2025-02-26 13:22:01 +08:00
|
|
|
this.selectTestItems.channelsTest = false
|
2025-02-25 10:17:33 +08:00
|
|
|
this.selectTestItems.test = true
|
2025-01-03 11:27:36 +08:00
|
|
|
},
|
2025-02-25 10:17:33 +08:00
|
|
|
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
|
|
|
|
this.selectTestItems = selectTestItems
|
2025-02-25 11:00:04 +08:00
|
|
|
},
|
|
|
|
|
setCheckType(checkType: number) {
|
|
|
|
|
this.checkType = checkType
|
2024-12-20 18:19:18 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|