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'
|
2025-03-18 19:38:27 +08:00
|
|
|
|
import {useAppSceneStore} from "@/stores/modules/mode";
|
2024-12-20 18:19:18 +08:00
|
|
|
|
|
2025-08-07 08:47:56 +08:00
|
|
|
|
export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
2024-12-20 18:19:18 +08:00
|
|
|
|
state: () => ({
|
2025-08-07 08:47:56 +08:00
|
|
|
|
devices: [] as CheckData.Device[],
|
|
|
|
|
|
plan: {} as Plan.ResPlan,
|
|
|
|
|
|
selectTestItems: {preTest: true, timeTest: false, channelsTest: false, test: true} as CheckData.SelectTestItem,
|
|
|
|
|
|
checkType: 1, // 0:手动检测 1:自动检测
|
2025-03-06 15:50:45 +08:00
|
|
|
|
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
2025-08-07 08:47:56 +08:00
|
|
|
|
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2:正式检测
|
2025-05-15 08:57:24 +08:00
|
|
|
|
temperature: 0,
|
2025-08-11 15:59:29 +08:00
|
|
|
|
humidity: 0,
|
2025-08-20 20:02:22 +08:00
|
|
|
|
chnNumList: [],//连线数据
|
2025-08-27 11:17:13 +08:00
|
|
|
|
nodesConnectable: true,//设置是能可以连线
|
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() {
|
2025-08-07 08:47:56 +08:00
|
|
|
|
const appSceneStore = useAppSceneStore()
|
2025-02-25 10:17:33 +08:00
|
|
|
|
this.selectTestItems.preTest = true
|
2025-08-07 08:47:56 +08:00
|
|
|
|
if (appSceneStore.currentScene === '1') {
|
2025-03-18 19:38:27 +08:00
|
|
|
|
this.selectTestItems.channelsTest = true
|
|
|
|
|
|
} else {
|
2025-05-06 10:19:41 +08:00
|
|
|
|
this.selectTestItems.channelsTest = false
|
2025-03-18 19:38:27 +08:00
|
|
|
|
}
|
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) {
|
2025-08-20 20:02:22 +08:00
|
|
|
|
console.log("🚀 ~ setSelectTestItems ~ selectTestItems:", selectTestItems)
|
2025-02-25 10:17:33 +08:00
|
|
|
|
this.selectTestItems = selectTestItems
|
2025-02-25 11:00:04 +08:00
|
|
|
|
},
|
|
|
|
|
|
setCheckType(checkType: number) {
|
|
|
|
|
|
this.checkType = checkType
|
2025-03-03 11:35:12 +08:00
|
|
|
|
},
|
|
|
|
|
|
setReCheckType(reCheckType: number) {
|
|
|
|
|
|
this.reCheckType = reCheckType
|
2025-03-06 15:50:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
setShowDetailType(showDetailType: number) {
|
|
|
|
|
|
this.showDetailType = showDetailType
|
2025-05-15 08:57:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
setTemperature(temperature: number) {
|
|
|
|
|
|
this.temperature = temperature
|
|
|
|
|
|
},
|
|
|
|
|
|
setHumidity(humidity: number) {
|
|
|
|
|
|
this.humidity = humidity
|
2025-08-11 15:59:29 +08:00
|
|
|
|
},
|
2025-08-20 20:02:22 +08:00
|
|
|
|
setChnNum(chnNumList: string[]) {
|
|
|
|
|
|
this.chnNumList = chnNumList
|
|
|
|
|
|
},
|
2025-08-27 11:17:13 +08:00
|
|
|
|
setNodesConnectable(nodesConnectable: boolean) {
|
|
|
|
|
|
this.nodesConnectable = nodesConnectable
|
|
|
|
|
|
},
|
2025-08-15 08:37:35 +08:00
|
|
|
|
|
2024-12-20 18:19:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|