多监测点
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user