import { defineStore } from 'pinia'
|
import { ref } from 'vue'
|
import { Session } from '@/utils/storage'
|
import { boolean, string } from 'yargs'
|
interface info {
|
type:string;
|
deviceName:string;
|
result:string;
|
resultTime:string;
|
state:boolean;
|
}
|
|
let weightInfo:info={
|
type:"体重秤",
|
state:false,
|
deviceName:"",
|
result:"",
|
resultTime:""
|
}
|
let xyjInfo:info={
|
type:"血压计",
|
state:false,
|
deviceName:"",
|
result:"",
|
resultTime:""
|
}
|
let dkqInfo:info={
|
type:"读卡器",
|
state:false,
|
deviceName:"",
|
result:"",
|
resultTime:""
|
}
|
export const sockteStore =defineStore('sockteInfo',()=>{
|
const isLink=ref(false) // sockte 链接状态
|
const netLink=ref(false) // 网络链接状态
|
const weightSockte=weightInfo // 体重秤sockte结果
|
const xyjSockte=xyjInfo // 血压计sockte结果
|
const dkqSockte=dkqInfo // 读卡器sockte结果
|
// 更新连接状态
|
function setsockteIsLink(Link:boolean){
|
isLink.value=Link
|
}
|
// 更新连接状态
|
function setnetLink(Link:boolean){
|
netLink.value=Link
|
}
|
/**
|
* 更新体重秤结果
|
* @param roleText 体重结果
|
*/
|
function setweightSockte(info:info){
|
weightSockte.deviceName=info.deviceName
|
weightSockte.result=info.result
|
weightSockte.resultTime=info.resultTime
|
weightSockte.state=info.state
|
}
|
/**
|
* 更新血压计结果
|
* @param roleText 体重结果
|
*/
|
function setxyjSockte(info:info){
|
xyjSockte.deviceName=info.deviceName
|
xyjSockte.result=info.result
|
xyjSockte.resultTime=info.resultTime
|
xyjSockte.state=info.state
|
}
|
/**
|
* 更新血压计结果
|
* @param roleText 体重结果
|
*/
|
function setdkqSockte(info:info){
|
dkqSockte.deviceName=info.deviceName
|
dkqSockte.result=info.result
|
dkqSockte.resultTime=info.resultTime
|
dkqSockte.state=info.state
|
}
|
|
return {isLink,netLink,weightSockte,xyjSockte,dkqSockte,setsockteIsLink,setnetLink,setweightSockte,setxyjSockte,setdkqSockte}
|
})
|