You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import { sendCmd } from 'apis/system' import { defineStore } from 'pinia' import { ref } from 'vue'
/** * 主页数据管理模块 * @module useHomeStore */ interface gasPathSwitcher { gasPathSwitcher: gasPathSwitcher path: string } interface gasPathSwitcher { isOnline: boolean }
export const useGasStore = defineStore('gas', () => { // 状态定义
const channelSwitcherMap = ['degradation', 'disinfection', 'dehumidification'] const isOnline = ref<true | false>(false) const currentChannel = ref<string | null>(null) /** * 选择通道 */ const selectChannel = async (data: string) => { const defaultParams = { className: 'DMGasPathMgrService', fnName: 'selectChannel', params: { dmGasPath: data, }, } return await sendCmd(defaultParams) } /** * 根据上报的数据更新当前通道和线上状态 */ const updateChannelByReport = (data: gasPathSwitcher) => { isOnline.value = data.gasPathSwitcher.isOnline currentChannel.value = data.path }
return { channelSwitcherMap, currentChannel, isOnline, selectChannel, updateChannelByReport, } })
|