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.
64 lines
1.5 KiB
64 lines
1.5 KiB
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
|
|
import { DEVICE_STATES } from '@/libs/utils'
|
|
|
|
const initDeviceInfo = {
|
|
appVersion: '',
|
|
deviceId: '',
|
|
deviceType: '',
|
|
deviceTypeInited: '',
|
|
ip: '',
|
|
projectType: '',
|
|
}
|
|
|
|
const initState = {
|
|
appEvents: [],
|
|
loginUser: {
|
|
isLogin: true,
|
|
name: '',
|
|
roleType: '',
|
|
},
|
|
state: DEVICE_STATES.IDLE,
|
|
}
|
|
|
|
const deviceTypeMap = {
|
|
LargeSpaceDM: 'DT600N', // 大空间
|
|
SmallSpaceDM: 'DT300N', // 小空间
|
|
PipeDM: 'DT300W', // 管道式
|
|
DrawBarDM: 'DT100N', // 拉杆箱
|
|
LargeSpaceDM_B: 'DT600B', // 大空间标准(低成本)
|
|
}
|
|
|
|
export const useDeviceStore = defineStore('device', () => {
|
|
const deviceInfo = ref<Device.DeviceInfo>(initDeviceInfo)
|
|
// 使用deviceType区分是什么消毒机。低成本消毒机部署在移动pad,不显示软件键盘的开关。 拉杆消毒机是上位机显示软键盘
|
|
// 暂时使用 deviceType : ture 表示 为低成本。
|
|
const deviceState = ref<Device.State>(initState) // 设备状态
|
|
|
|
/**
|
|
* @function setDeviceState
|
|
* @desc 更新设备信息
|
|
* @param info
|
|
*/
|
|
const updateDeviceInfo = (info: Device.DeviceInfo) => {
|
|
deviceInfo.value = info
|
|
}
|
|
|
|
/**
|
|
* @function setDeviceState
|
|
* @desc 更新设备状态
|
|
* @param state
|
|
*/
|
|
const setDeviceState = (state: Device.State) => {
|
|
deviceState.value = state
|
|
}
|
|
|
|
return {
|
|
deviceTypeMap,
|
|
deviceInfo,
|
|
deviceState,
|
|
updateDeviceInfo,
|
|
setDeviceState,
|
|
}
|
|
})
|