chenyc
2022-07-04 145c0bf73ebd82ca635a1d1c82ca2bd2fb953f92
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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}
})