| | |
| | | import { join } from 'path' |
| | | import fs from 'fs' |
| | | import iconv from 'iconv-lite' |
| | | //koa---- |
| | | import Koa from 'koa'; |
| | | import Router from 'koa-router'; |
| | | const koaBody = require('koa-body'); |
| | | |
| | | const creatorKoa=(win)=>{ |
| | | const app = new Koa(); |
| | | const router = new Router(); |
| | | app.use(koaBody({ |
| | | multipart: true |
| | | })); |
| | | |
| | | router.get('/', async (ctx) => { |
| | | ctx.body = 'Hello World!'; |
| | | }); |
| | | router.post('/postResult', async (ctx)=>{ |
| | | const body=ctx.request.body |
| | | win?.webContents.send('message-koa',body) |
| | | ctx.body={ |
| | | "code": 200, |
| | | "data": body, |
| | | "message": "接收成功" |
| | | } |
| | | // writeResult(body) |
| | | }) |
| | | |
| | | app.use(router.routes()); |
| | | |
| | | app.listen(3131,()=>{ |
| | | console.log('koa Service start, port:3131') |
| | | }); |
| | | } |
| | | |
| | | // 配制文件的读写实例 |
| | | const Store = require('electron-store'); |
| | |
| | | // Test active push message to Renderer-process |
| | | // 测试推送消息到Renderer进程 |
| | | win.webContents.on('did-finish-load', () => { |
| | | // win?.webContents.send('main-process-message', new Date().toLocaleString()) |
| | | creatorKoa(win) |
| | | win?.webContents.send('message-koa','nihao0-----') |
| | | win?.webContents.send('getScreenTimeout',store.get('screenTimeout')) |
| | | win?.webContents.send('getPcName',store.get('machineName')) |
| | | win?.webContents.send('getConfigData',store.get('clientCode'),store.get('devices'),store.path) |
| | |
| | | |
| | | app.on('second-instance', () => { |
| | | if (win) { |
| | | // Focus on the main window if the user tried to open another |
| | | // 如果用户试图打开另一个窗口,则将焦点放在主窗口上 |
| | | if (win.isMinimized()) win.restore() |
| | | win.focus() |
| | | } |
| | |
| | | } |
| | | }) |
| | | |
| | | // new window example arg: new windows url |
| | | // 新窗口示例arg:新的Windows url |
| | | ipcMain.handle("open-win", (event, arg) => { |
| | | const childWindow = new BrowserWindow({ |
| | | webPreferences: { |
| | |
| | | { |
| | | "name": "sign-tool", |
| | | "version": "2.1.0", |
| | | "version": "2.2.0", |
| | | "icon": "public/favicon.ico", |
| | | "main": "dist/electron/main/index.js", |
| | | "author": "", |
| | |
| | | "private": true, |
| | | "scripts": { |
| | | "dev": "vite", |
| | | "build": "vue-tsc --noEmit && vite build && electron-builder" |
| | | "build": "vite build && electron-builder" |
| | | }, |
| | | "engines": { |
| | | "node": ">=14.17.0" |
| | |
| | | </template> |
| | | |
| | | <style> |
| | | #app { |
| | | /* font-family: Avenir, Helvetica, Arial, sans-serif; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | text-align: center; |
| | | color: #2c3e50; |
| | | margin-top: 60px; */ |
| | | } |
| | | </style> |
| | |
| | | import { createPinia } from 'pinia' |
| | | import App from './App.vue' |
| | | import './samples/node-api' |
| | | import './samples/httpServer' |
| | | |
| | | createApp(App) |
| | | .use(createPinia()) |
| | |
| | | const routes: Array<RouteRecordRaw> = [ |
| | | // { path: '/', name: 'Home', component: () => import('@/views/home/index.vue')}, |
| | | { path: '/', name: 'test', component: () => import('@/views/home/index.vue')}, |
| | | { path: '/test', name: 'Home', component: () => import('@/views/test/index.vue')}, |
| | | ] |
| | | |
| | | const router = createRouter({ |
| | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { on } from 'events' |
| | | |
| | | interface ResultInfo{ |
| | | clientCode:string; |
| | | commCode :string; |
| | | deviceType:string; |
| | | deviceName :string; |
| | | result :string; |
| | | resultTime :string |
| | | } |
| | | let deviceList=[] |
| | | let clientCode='' |
| | | // 主进程发送消息到渲染进程 |
| | | ipcRenderer.on('message-koa', (_event, ...args) => { |
| | | |
| | | console.log('koa返回http请求消息', ...args) |
| | | const Result:ResultInfo=args[0] |
| | | writeResult(Result) |
| | | }) |
| | | ipcRenderer.on('main-process-message', (_event, ...args) => { |
| | | console.log('[Receive Main-process message]:', ...args) |
| | | }) |
| | | ipcRenderer.on('main-process-message', (_event, ...args) => { |
| | | console.log('[Receive Main-process message]:', ...args) |
| | | }) |
| | |
| | | console.log("网路链接失败") |
| | | }) |
| | | },10000) |
| | | const writeResult=(res: ResultInfo)=>{ |
| | | console.log(res) |
| | | console.log(`写入结果类型${res.deviceType},写入结果=${res.result}`) |
| | | switch(res.deviceType){ |
| | | case '读卡器': |
| | | console.log('读卡器收到消息') |
| | | if(res.clientCode!==null){ |
| | | sockteStore().setdkqSockte( |
| | | { |
| | | deviceName:res.deviceName, |
| | | type:"读卡器", |
| | | result:res.result, |
| | | resultTime:res.resultTime, |
| | | state:2 |
| | | } |
| | | ) |
| | | } |
| | | break |
| | | case "体重秤": |
| | | sockteStore().setweightSockte( |
| | | { |
| | | deviceName:res.deviceName, |
| | | type:"体重秤", |
| | | result:Number(res.result).toString(), |
| | | resultTime:res.resultTime, |
| | | state:2 |
| | | } |
| | | ) |
| | | break |
| | | case "血压计": |
| | | sockteStore().setxyjSockte( |
| | | { |
| | | deviceName:res.deviceName, |
| | | type:"血压计", |
| | | result:res.result, |
| | | resultTime:res.resultTime, |
| | | state:2 |
| | | } |
| | | ) |
| | | break |
| | | default: |
| | | console.log('有配置类型没有匹配') |
| | | } |
| | | } |
| | | |
| | |
| | | * 更新体重秤结果 |
| | | * @param info 体重结果 |
| | | */ |
| | | function setweightSockte(info:info){ |
| | | function setweightSockte(info:weightInfo){ |
| | | console.log(info,'入参') |
| | | weightSockte.value.deviceName=info.deviceName |
| | | weightSockte.value.result=info.result |
| | | weightSockte.value.resultTime=info.resultTime |
| | | weightSockte.value.state=info.state |
| | | console.debug('体重秤更新') |
| | | console.log('体重秤更新') |
| | | } |
| | | /** |
| | | * 更新体重秤工作状态 |
| | |
| | | () => patientInfo.value.datetime, |
| | | () => { |
| | | console.log('患者信息变化',patientInfo.value) |
| | | if(patientInfo.value.isScheduled===0){ |
| | | AudioRef5.value.play(); |
| | | return |
| | | } |
| | | if (patientInfo.value.id !== 0) { |
| | | AudioRef.value.play(); |
| | | sockteStore().setweightSockte({ |
| | |
| | | }) |
| | | settime() |
| | | |
| | | }else{ |
| | | if(patientInfo.value.name===''){ |
| | | } |
| | | else if(patientInfo.value.name===''){ |
| | | AudioRef4.value.play(); |
| | | return |
| | | } |
| | | |
| | | else if(patientInfo.value.isScheduled===0){ |
| | | AudioRef5.value.play(); |
| | | return |
| | | } |
| | | } |
| | | ) |
| | | ); |
| | | watch( |
| | | () => weightInfo.value.result, |
| | | () => weightInfo.value.resultTime, |
| | | () => { |
| | | settime() |
| | | console.log("体重变化了",weightInfo.value) |
| | | // AudioRef2.value.play() |
| | | if (patientInfo.value.id === 0) { |
| | | AudioRef0.value.play() |
| | | inputRef.value.focus(); |
| | | |
| | | } |
| | | else { |
| | | AudioRef2.value.play() |
| | |
| | | } |
| | | } |
| | | } |
| | | ) |
| | | ); |
| | | watch( |
| | | () => xyjInfo.value.resultTime, |
| | | () => { |
| | |
| | | state.mai_bu = "" |
| | | } |
| | | } |
| | | ) |
| | | ); |
| | | watch( |
| | | () => dkqInfo.value.resultTime, |
| | | () => { |
| | |
| | | sendPationCode(code) |
| | | } |
| | | } |
| | | ) |
| | | ); |
| | | watch(() => viewNumber, |
| | | () => { |
| | | state.clockNum = viewNumber.value |
| | | } |
| | | ) |
| | | ); |
| | | const inputChabge = () => { |
| | | sendPationCode(state.inputCode) |
| | | setTimeout(function () { |
| | |
| | | state.haodu=(document.documentElement.clientHeight-180)/2+'px' |
| | | |
| | | state.clockNum = patientInfoStore().viewNumber |
| | | setTimeout(function () { |
| | | console.log('7秒后操作') |
| | | inputRef.value.focus(); |
| | | }, 7000) |
| | | setInterval(function () { |
| | | state.Newdate = formatDate(new Date(), "YYYY-mm-dd HH:MM:SS") |
| | | inputRef.value.focus(); |
| | | }, 1000) |
| | | |
| | | }) |
| | | return { |
| | | ...toRefs(state), guyanbi,isLink, netLink, weightInfo, patientInfo, xyjInfo, inputRef, AudioRef0, AudioRef, AudioRef4,AudioRef5, AudioRef2, AudioRef3, inputChabge |
| | |
| | | <template> |
| | | <div class="pagehome"> |
| | | <!-- 提醒刷卡 --> |
| | | <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step1.mp3" ref="AudioRef0" id="eventAudio2"></audio> |
| | | <audio :src="step1" ref="AudioRef0" id="eventAudio1"></audio> |
| | | <!-- 患者信息读取成功 --> |
| | | <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step2.mp3" ref="AudioRef" id="eventAudio2"></audio> |
| | | <audio :src="step2" ref="AudioRef" id="eventAudio2"></audio> |
| | | <!-- 体重结果回传成功 --> |
| | | <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step3.mp3" ref="AudioRef2" id="eventAudio3"></audio> |
| | | <audio :src="step3" ref="AudioRef2" id="eventAudio3"></audio> |
| | | <!-- 血压结果回传成功 --> |
| | | <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step4.mp3" ref="AudioRef3" id="eventAudio4"></audio> |
| | | <audio :src="step4" ref="AudioRef3" id="eventAudio4"></audio> |
| | | <!-- 没有找到患者 --> |
| | | <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step5.mp3" ref="AudioRef4" id="eventAudio5"></audio> |
| | | <audio :src="step5" ref="AudioRef4" id="eventAudio5"></audio> |
| | | <!-- 没有找到排班 --> |
| | | <audio :src="step6" ref="AudioRef5" id="eventAudio6"></audio> |
| | | <!-- <el-dialog title="提示" v-model="netLink" width="30%"> |
| | |
| | | renderer(), |
| | | ], |
| | | base:'./', |
| | | server: { |
| | | host: '127.0.0.1', |
| | | port: 8991, |
| | | // 是否开启 https |
| | | https: false, |
| | | }, |
| | | proxy: { |
| | | '/api1': { |
| | | // 后台地址 |
| | | target: 'http://127.0.0.1:3131/', |
| | | changeOrigin: true, |
| | | }, |
| | | '/api2': { |
| | | // 后台地址 |
| | | target: 'http://127.0.0.1:3132/', |
| | | changeOrigin: true, |
| | | } |
| | | }, |
| | | resolve:{ |
| | | alias: { |
| | | '@': pathResolve('./src'), // 设置 `@` 指向 `src` 目录 |