多监测点

This commit is contained in:
仲么了
2024-02-29 09:37:31 +08:00
parent e910584460
commit 6132d63502
4 changed files with 164 additions and 137 deletions

View File

@@ -4,6 +4,8 @@ import { defineStore } from 'pinia'
interface MonitoringPoint {
lineId: string
lineName: string
lineIds: string[]
showCheckBox: boolean
}
export const useMonitoringPoint = defineStore(
@@ -12,11 +14,21 @@ export const useMonitoringPoint = defineStore(
const state: MonitoringPoint = reactive({
lineId: '',
lineName: '',
lineIds: [],
showCheckBox: false
})
const setValue = (key: keyof MonitoringPoint, val: any) => {
const setValue = (key: keyof Pick<MonitoringPoint, 'lineId' | 'lineName' | 'lineIds'>, val: any) => {
state[key] = val
}
return { state, setValue }
const setShowCheckBox = (val: boolean) => {
if (!val) {
state.lineIds = []
} else {
state.lineIds = [state.lineId]
}
state.showCheckBox = val
}
return { state, setValue, setShowCheckBox }
},
{
persist: true