| | |
| | | { |
| | | // See https://go.microsoft.com/fwlink/?LinkId=733558 |
| | | // for the documentation about the tasks.json format |
| | | "version": "2.0.0", |
| | | "tasks": [ |
| | | { |
| | | "label": "start .debug.script.mjs", |
| | | "label": "haas-studio: Config", |
| | | "type": "shell", |
| | | "command": "node .vscode/.debug.script.mjs", |
| | | "isBackground": true, |
| | | "problemMatcher": [] |
| | | "command": "aos", |
| | | "args": [ |
| | | "make", |
| | | "@haaseduk1", |
| | | "-c", |
| | | "config" |
| | | ], |
| | | "presentation": { |
| | | "focus": true |
| | | } |
| | | }, |
| | | { |
| | | "label": "haas-studio: Make", |
| | | "type": "shell", |
| | | "command": "aos", |
| | | "args": [ |
| | | "make" |
| | | ], |
| | | "presentation": { |
| | | "focus": true |
| | | } |
| | | }, |
| | | { |
| | | "label": "haas-studio: Burn", |
| | | "type": "shell", |
| | | "command": "aos", |
| | | "args": [ |
| | | "burn" |
| | | ], |
| | | "presentation": { |
| | | "focus": true |
| | | } |
| | | }, |
| | | { |
| | | "label": "haas-studio: Serial Monitor", |
| | | "type": "shell", |
| | | "command": "aos", |
| | | "args": [ |
| | | "monitor", |
| | | "", |
| | | "1500000" |
| | | ], |
| | | "presentation": { |
| | | "focus": true, |
| | | "panel": "dedicated" |
| | | } |
| | | }, |
| | | { |
| | | "label": "haas-studio: Clean", |
| | | "type": "shell", |
| | | "command": "aos", |
| | | "args": [ |
| | | "make", |
| | | "clean" |
| | | ], |
| | | "presentation": { |
| | | "focus": true |
| | | } |
| | | }, |
| | | { |
| | | "label": "dummy_aos3.3.0", |
| | | "command": "pwd" |
| | | } |
| | | ] |
| | | ], |
| | | "windows": { |
| | | "options": { |
| | | "env": { |
| | | "PATH": "C:\\ProgramData\\aos\\miniconda3;C:\\ProgramData\\aos\\miniconda3\\Scripts;C:\\ProgramData\\aos\\miniconda3\\Library\\bin;${env:PATH}" |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 测试推送消息到Renderer进程 |
| | | win.webContents.on('did-finish-load', () => { |
| | | win?.webContents.send('main-process-message', new Date().toLocaleString()) |
| | | win?.webContents.send('getConfigData',store.get('clientCode'),store.get('deviceList')) |
| | | win?.webContents.send('getConfigData',store.get('clientCode'),store.get('deviceList'),store.path) |
| | | }) |
| | | |
| | | // Make all links open with the browser, not with the application |
| | |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8" /> |
| | | <link rel="icon" href="/favicon.ico" /> |
| | | <link rel="icon" href="/logipc.png" /> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| | | <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> |
| | | <title>自助签到</title> |
| | |
| | | { |
| | | "name": "electron-vue-vite", |
| | | "name": "Device-Communication-UI", |
| | | "version": "2.0.0", |
| | | "main": "dist/electron/main/index.js", |
| | | "author": "", |
| | |
| | | import { ipcRenderer } from 'electron' |
| | | import {creatorClient} from './sockteStomp' |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | import internetAvailable from "internet-available" |
| | | // import internetAvailable from "internet-available" |
| | | var internetAvailable = require("internet-available") |
| | | let deviceList=[] |
| | | let clientCode='' |
| | | // 主进程发送消息到渲染进程 |
| | |
| | | import Stomp from 'stompjs' |
| | | import os from 'os' |
| | | var stompClient: Stomp.Client | null=null |
| | | |
| | | import { userInfoStore } from '@/stores/userInfo' |
| | |
| | | |
| | | let devices:Array<device>=[] |
| | | let clientCode:string='' |
| | | |
| | | /** |
| | | * 保存结果到vuex |
| | | * @param resultInfo 结果写入 |
| | | */ |
| | | const writeResult=(resultInfo:any)=>{ |
| | | if(devices.length>0){ |
| | | const deviceInfo=devices.find(de=>{de.deviceName===resultInfo.deviceName}) |
| | |
| | | type:"读卡器", |
| | | result:resultInfo.result, |
| | | resultTime:resultInfo.resultTime, |
| | | state:true |
| | | state:0 |
| | | } |
| | | ) |
| | | break |
| | |
| | | type:"体重秤", |
| | | result:resultInfo.result, |
| | | resultTime:resultInfo.resultTime, |
| | | state:true |
| | | state:0 |
| | | } |
| | | ) |
| | | break |
| | |
| | | type:"血压计", |
| | | result:resultInfo.result, |
| | | resultTime:resultInfo.resultTime, |
| | | state:true |
| | | state:0 |
| | | } |
| | | ) |
| | | break |
| | | default: |
| | | console.log('有配置类型没有匹配') |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | const writeStatu=(resultInfo:any)=>{ |
| | | if(devices.length>0){ |
| | | const deviceInfo=devices.find(de=>{ |
| | | console.log(de.deviceName,resultInfo.deviceName) |
| | | return de.deviceName===resultInfo.deviceName |
| | | }) |
| | | if(deviceInfo!==undefined){ |
| | | switch(deviceInfo.deviceType){ |
| | | case '读卡器': |
| | | sockteStore().setdkqSockte( |
| | | { |
| | | deviceName:resultInfo.deviceName, |
| | | type:"读卡器", |
| | | result:resultInfo.result, |
| | | resultTime:resultInfo.resultTime, |
| | | state:0 |
| | | } |
| | | ) |
| | | break |
| | | case "体重秤": |
| | | sockteStore().setweightState(resultInfo.status) |
| | | break |
| | | case "血压计": |
| | | sockteStore().setxyjSockte( |
| | | { |
| | | deviceName:resultInfo.deviceName, |
| | | type:"血压计", |
| | | result:resultInfo.result, |
| | | resultTime:resultInfo.resultTime, |
| | | state:0 |
| | | } |
| | | ) |
| | | break |
| | |
| | | alert("接收数据异常"); |
| | | } |
| | | }; |
| | | const callbackState=function(message:any){ |
| | | const callbackState=function(message:any) { |
| | | if (message.body) { |
| | | const data=JSON.parse(message.body) |
| | | if(data.deviceName) |
| | | if(data){ |
| | | writeStatu(data) |
| | | } |
| | | console.log(data,'设备心跳包数据') |
| | | writeResult(data) |
| | | } else { |
| | | alert("接收数据异常"); |
| | | } |
| | | } |
| | | const PatientCallback=function(message:any){ |
| | | if (message.body) { |
| | | const data=JSON.parse(message.body) |
| | | console.log(data,'患者信息读取') |
| | | } |
| | | |
| | | } |
| | | const connectCallback=function(){ |
| | | console.log("链接成功",stompClient) |
| | | const pcName= os.hostname() |
| | | // 订阅患者信息服务 |
| | | stompClient.subscribe(`/queue/patient/info/${pcName}`,PatientCallback) |
| | | console.log("链接成功",stompClient,pcName) |
| | | // 更新sockte链接状态 |
| | | sockteStore().setsockteIsLink(true) |
| | | console.log(sockteStore().isLink) |
| | | if(stompClient!==null){ |
| | | if(devices.length>0){ |
| | | devices.forEach(de=>{ |
| | | console.log(devices) |
| | | if(devices.length>0){ |
| | | devices.forEach(de=>{ |
| | | if(stompClient!==null){ |
| | | stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/result`,callback) |
| | | // /queue/{clientCode}/{deviceName}/keepalive |
| | | stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/keepalive`,callbackState) |
| | | stompClient.send(`/app/device/request/${clientCode}/${de.deviceName}`, {}, JSON.stringify({"deviceNumber":de.deviceName})); |
| | | }) |
| | | } |
| | | |
| | | |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | const error_callback=function(error:any){ |
| | |
| | | stompClient.connect({}, connectCallback,error_callback) |
| | | |
| | | } |
| | | export {creatorClient} |
| | | const sendPationCode=(codeStr:string)=>{ |
| | | if(stompClient!==null){ |
| | | stompClient.send(`/app/patient/info/get/${os.hostname()}`,{},codeStr) |
| | | } |
| | | } |
| | | export {creatorClient,sendPationCode} |
| | |
| | | deviceName:string; |
| | | result:string; |
| | | resultTime:string; |
| | | state:boolean; |
| | | state:0; |
| | | } |
| | | |
| | | let weightInfo:info={ |
| | | type:"体重秤", |
| | | state:false, |
| | | state:0, |
| | | deviceName:"", |
| | | result:"", |
| | | result:"0", |
| | | resultTime:"" |
| | | } |
| | | let xyjInfo:info={ |
| | | type:"血压计", |
| | | state:false, |
| | | state:0, |
| | | deviceName:"", |
| | | result:"", |
| | | resultTime:"" |
| | | } |
| | | let dkqInfo:info={ |
| | | type:"读卡器", |
| | | state:false, |
| | | state:0, |
| | | 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结果 |
| | | const netLink=ref(true) // 网络链接状态 |
| | | const weightSockte=ref(weightInfo) // 体重秤sockte结果 |
| | | const xyjSockte=ref(xyjInfo) // 血压计sockte结果 |
| | | const dkqSockte=ref(dkqInfo) // 读卡器sockte结果 |
| | | // 更新连接状态 |
| | | function setsockteIsLink(Link:boolean){ |
| | | isLink.value=Link |
| | | } |
| | | // 更新连接状态 |
| | | // 更新网络连接状态 |
| | | function setnetLink(Link:boolean){ |
| | | netLink.value=Link |
| | | } |
| | | /** |
| | | * 更新体重秤结果 |
| | | * @param roleText 体重结果 |
| | | * @param info 体重结果 |
| | | */ |
| | | function setweightSockte(info:info){ |
| | | weightSockte.deviceName=info.deviceName |
| | | weightSockte.result=info.result |
| | | weightSockte.resultTime=info.resultTime |
| | | weightSockte.state=info.state |
| | | weightSockte.value.deviceName=info.deviceName |
| | | weightSockte.value.result=info.result |
| | | weightSockte.value.resultTime=info.resultTime |
| | | } |
| | | /** |
| | | * 更新体重秤工作状态 |
| | | * @param state 体重秤运行状态 |
| | | */ |
| | | function setweightState(state:any){ |
| | | weightSockte.value.state=state |
| | | } |
| | | /** |
| | | * 更新血压计结果 |
| | | * @param roleText 体重结果 |
| | | * @param info 体重结果 |
| | | */ |
| | | function setxyjSockte(info:info){ |
| | | xyjSockte.deviceName=info.deviceName |
| | | xyjSockte.result=info.result |
| | | xyjSockte.resultTime=info.resultTime |
| | | xyjSockte.state=info.state |
| | | xyjSockte.value.deviceName=info.deviceName |
| | | xyjSockte.value.result=info.result |
| | | xyjSockte.value.resultTime=info.resultTime |
| | | } |
| | | /** |
| | | * 更新血压计结果 |
| | | * @param roleText 体重结果 |
| | | * @param info 体重结果 |
| | | */ |
| | | function setdkqSockte(info:info){ |
| | | dkqSockte.deviceName=info.deviceName |
| | | dkqSockte.result=info.result |
| | | dkqSockte.resultTime=info.resultTime |
| | | dkqSockte.state=info.state |
| | | dkqSockte.value.deviceName=info.deviceName |
| | | dkqSockte.value.result=info.result |
| | | dkqSockte.value.resultTime=info.resultTime |
| | | } |
| | | |
| | | return {isLink,netLink,weightSockte,xyjSockte,dkqSockte,setsockteIsLink,setnetLink,setweightSockte,setxyjSockte,setdkqSockte} |
| | | return {isLink,netLink,weightSockte,xyjSockte,dkqSockte,setsockteIsLink,setnetLink,setweightSockte, |
| | | setweightState, |
| | | setxyjSockte,setdkqSockte} |
| | | }) |
| | |
| | | import { userInfoStore } from '@/stores/userInfo' |
| | | import { sockteStore } from '@/stores/sockteInfo' |
| | | import { ipcRenderer } from 'electron' |
| | | import { reactive,computed, toRefs } from "vue" |
| | | import { reactive,computed, toRefs,onMounted ,ref} from "vue" |
| | | import{sendPationCode} from '../../samples/sockteStomp' |
| | | import {formatDate} from '@/utils/formatTime' |
| | | import { popper } from '@popperjs/core' |
| | | export default { |
| | | setup() { |
| | | const user = userInfoStore() |
| | | const sockte= sockteStore() |
| | | const inputRef=ref() |
| | | const isLink= computed(()=>{ |
| | | return sockte.isLink |
| | | return !sockte.isLink |
| | | }) |
| | | const netLink= computed(()=>{ |
| | | return sockte.netLink |
| | | return !sockte.netLink |
| | | }) |
| | | const weightInfo= computed(()=>{ |
| | | return sockte.weightSockte |
| | | }) |
| | | const state=reactive({ |
| | | dialogVisible:false, |
| | | isActive:false, |
| | | inputCode:"", |
| | | Newdate:"" |
| | | }) |
| | | const ubtCilert=()=>{ |
| | | console.log('ss') |
| | | // console.log(user.userInfo) |
| | | // console.log(sockteStore().isLink) |
| | | // ipcRenderer.send('main-process-message2', { 'param1': "hello" }); |
| | | // console.log(window.myApi.fun('陈银城')) |
| | | const inputChabge=()=>{ |
| | | sendPationCode(state.inputCode) |
| | | } |
| | | return{ ...toRefs(state), ubtCilert,isLink,netLink |
| | | onMounted(() => { |
| | | console.log('Component is mounted!') |
| | | inputRef.value.focus(); |
| | | console.log(inputRef) |
| | | setTimeout(function(){ |
| | | // state.inputCode="3434" |
| | | console.log('-----------sdsds') |
| | | inputRef.value.focus(); |
| | | },10000) |
| | | setInterval(function(){ |
| | | state.Newdate=formatDate(new Date(),"YYYY-mm-dd HH:MM:SS") |
| | | console.log(state.Newdate,'----ss') |
| | | },1000) |
| | | }) |
| | | return{ ...toRefs(state),isLink,netLink,weightInfo,inputRef,inputChabge |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <template> |
| | | <div class="home"> |
| | | <!-- <el-button @click="ubtCilert"> |
| | | test |
| | | </el-button> --> |
| | | <el-dialog |
| | | title="提示" |
| | | v-model="netLink" |
| | | width="30%"> |
| | | <span>无法链接到网络!</span> |
| | | </el-dialog> |
| | | <el-dialog |
| | | title="提示" |
| | | v-model="isLink" |
| | | width="30%"> |
| | | <span>sockte连接失败正在重连。。。。。。</span> |
| | | </el-dialog> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <div class="tale"> |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div> sockte连接状态{{isLink}}</div> |
| | | <div> 网络连接状态{{netLink}}</div> |
| | | <!-- <div> sockte连接状态{{isLink}}</div> |
| | | <div> 网络连接状态{{netLink}}</div> --> |
| | | <el-input id="inputCode" @change="inputChabge" v-model="inputCode" ref="inputRef" placeholder="" /> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="grid-container"> |
| | |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="lableText">当前时间:</div> |
| | | <div class="conText">2022-06-21 14:10</div> |
| | | <div class="conText">{{Newdate}}</div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="lableText">当前时间:</div> |
| | | <div class="conText">2022-06-21 14:10</div> |
| | | <div class="lableText">透析号:</div> |
| | | <div class="conText">123456</div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="lableText">机号:</div> |
| | |
| | | <div class="lableText">干体重(kg):</div> |
| | | <div class="conText">88</div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="lableText">透前称重(kg):</div> |
| | | <div class="conText">90</div> |
| | | <div class="grid-item" > |
| | | <div> |
| | | <div class="lableText" v-if="weightInfo.state===2">透前称重(kg):</div> |
| | | <div class="lableText" v-if="weightInfo.state===1" style="color:red">体重秤通讯服务正常运行但未联通设备</div> |
| | | <div class="lableText" v-if="weightInfo.state===0" style="color:red">体重秤通讯服务不正常 </div> |
| | | <div class="conText">{{weightInfo.result}}</div> |
| | | </div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="lableText">目标脱水量:</div> |
| | |
| | | margin-top: 15pt; |
| | | color: #769aff; |
| | | } |
| | | .active{ |
| | | background: #c1c2c6; |
| | | color: black; |
| | | } |
| | | </style> |