From 9e2c02c96954a07d35b4c9fa698a6bfa74e832e2 Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期三, 20 十一月 2024 18:28:08 +0800 Subject: [PATCH] 显示患者条码 --- src/components/Barcode/src/Barcode.vue | 43 +++++++++++++++++++++ src/components/Barcode/index.ts | 3 + package.json | 3 + src/store/modules/checkType.ts | 23 +++++++---- src/views/ecg/doctor/components/DevInstallPanel.vue | 7 +++ pnpm-lock.yaml | 7 +++ src/views/ecg/doctor/components/DevReadyPanel.vue | 8 ++-- 7 files changed, 80 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 7788eb6..0bdc0cb 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,8 @@ "web-storage-cache": "^1.1.1", "xml-js": "^1.6.11", "vue3-scroll-seamless": "^1.0.6", - "vue-plugin-hiprint": "^0.0.18" + "vue-plugin-hiprint": "^0.0.18", + "jsbarcode": "^3.11.6" }, "devDependencies": { "@commitlint/cli": "^19.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60602c1..dd7e21b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,6 +80,9 @@ highlight.js: specifier: ^11.9.0 version: 11.9.0 + jsbarcode: + specifier: ^3.11.6 + version: 3.11.6 jsencrypt: specifier: ^3.3.2 version: 3.3.2 @@ -6578,6 +6581,10 @@ argparse: 2.0.1 dev: true + /jsbarcode@3.11.6: + resolution: {integrity: sha512-G5TKGyKY1zJo0ZQKFM1IIMfy0nF2rs92BLlCz+cU4/TazIc4ZH+X1GYeDRt7TKjrYqmPfTjwTBkU/QnQlsYiuA==} + dev: false + /jsencrypt@3.3.2: resolution: {integrity: sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==} dev: false diff --git a/src/components/Barcode/index.ts b/src/components/Barcode/index.ts new file mode 100644 index 0000000..a1c7fbb --- /dev/null +++ b/src/components/Barcode/index.ts @@ -0,0 +1,3 @@ +import Barcode from './src/Barcode.vue' + +export { Barcode } diff --git a/src/components/Barcode/src/Barcode.vue b/src/components/Barcode/src/Barcode.vue new file mode 100644 index 0000000..18bbc03 --- /dev/null +++ b/src/components/Barcode/src/Barcode.vue @@ -0,0 +1,43 @@ +<template> +<div> + <svg class="barcode" /> +</div> +</template> + +<script lang="ts" setup> + +import { ref, onMounted, nextTick } from 'vue' +import JsBarcode from 'jsbarcode' + +defineOptions({ name: 'Barcode' }) + +const props = defineProps({ + // 鏁版嵁 + // 褰撳墠鐨勫�� + value: String +}); + +onMounted(() => { + nextTick(() => { + JsBarcode('.barcode', String(props.value), { + format: "CODE39",//閫夋嫨瑕佷娇鐢ㄧ殑鏉″舰鐮佺被鍨� + width:1,//璁剧疆鏉′箣闂寸殑瀹藉害 + height:40,//楂樺害 + displayValue:true,//鏄惁鍦ㄦ潯褰㈢爜涓嬫柟鏄剧ず鏂囧瓧 +// text:"456",//瑕嗙洊鏄剧ず鐨勬枃鏈� +// fontOptions:"bold italic",//浣挎枃瀛楀姞绮椾綋鎴栧彉鏂滀綋 +// font:"fantasy",//璁剧疆鏂囨湰鐨勫瓧浣� +// textAlign:"left",//璁剧疆鏂囨湰鐨勬按骞冲榻愭柟寮� +// textPosition:"top",//璁剧疆鏂囨湰鐨勫瀭鐩翠綅缃� +// textMargin:5,//璁剧疆鏉″舰鐮佸拰鏂囨湰涔嬮棿鐨勯棿璺� + fontSize:15,//璁剧疆鏂囨湰鐨勫ぇ灏� +// background:"#eee",//璁剧疆鏉″舰鐮佺殑鑳屾櫙 +// lineColor:"#2196f3",//璁剧疆鏉″拰鏂囨湰鐨勯鑹层�� + margin:15//璁剧疆鏉″舰鐮佸懆鍥寸殑绌虹櫧杈硅窛 + }); + }) +}) +</script> + +<style lang="scss" scoped> +</style> \ No newline at end of file diff --git a/src/store/modules/checkType.ts b/src/store/modules/checkType.ts index 82ca6f2..54b50fd 100644 --- a/src/store/modules/checkType.ts +++ b/src/store/modules/checkType.ts @@ -8,15 +8,16 @@ export interface CheckTypeSimpleVO { value: number name: string + displayBarcode: number } export interface CheckTypeState { - checkTypeMap: Map<number, string> + checkTypeMap: Map<number, CheckTypeSimpleVO> isSetCheckType: boolean } export const useCheckTypeStore = defineStore('checktype ', { state: (): CheckTypeState => ({ - checkTypeMap: new Map<number, string>(), + checkTypeMap: new Map<number, CheckTypeSimpleVO>(), isSetCheckType: false }), getters: { @@ -40,12 +41,12 @@ } else { const res = await CheckTypeApi.getSimpleCheckTypeList() // 璁剧疆鏁版嵁 - const checkTypeMap = new Map<number, string>() + const checkTypeMap = new Map<number, CheckTypeSimpleVO>() res.forEach((simpleVO: CheckTypeSimpleVO) => { // 鑾峰緱 dictType 灞傜骇 const enumValueObj = checkTypeMap[simpleVO.value] if (!enumValueObj) { - checkTypeMap[simpleVO.value] = simpleVO.name + checkTypeMap[simpleVO.value] = simpleVO } }) this.checkTypeMap = checkTypeMap @@ -57,7 +58,7 @@ if (!this.isSetCheckType) { this.setCheckTypeMap() } - return this.checkTypeMap[type] + return this.checkTypeMap[type].name }, getCheckTypeOptions() { if (!this.isSetCheckType) { @@ -66,20 +67,26 @@ return Object.keys(this.checkTypeMap).map((key) => { return { value: parseInt(key, 10), - label: this.checkTypeMap[key] + label: this.checkTypeMap[key].name } }); + }, + getCheckTypeDispBarCode(type: number) { + if (!this.isSetCheckType) { + this.setCheckTypeMap() + } + return this.checkTypeMap[type].displayBarcode }, async resetCheckTypeInfo() { wsCache.delete(CACHE_KEY.CHECKTYPE_CACHE) const res = await CheckTypeApi.getSimpleCheckTypeList() // 璁剧疆鏁版嵁 - const checkTypeMap = new Map<number, string>() + const checkTypeMap = new Map<number, CheckTypeSimpleVO>() res.forEach((simpleVO: CheckTypeSimpleVO) => { // 鑾峰緱 dictType 灞傜骇 const enumValueObj = checkTypeMap[simpleVO.value] if (!enumValueObj) { - checkTypeMap[simpleVO.value] = simpleVO.name + checkTypeMap[simpleVO.value] = simpleVO } }) this.checkTypeMap = checkTypeMap diff --git a/src/views/ecg/doctor/components/DevInstallPanel.vue b/src/views/ecg/doctor/components/DevInstallPanel.vue index 58ceb23..7808dbd 100644 --- a/src/views/ecg/doctor/components/DevInstallPanel.vue +++ b/src/views/ecg/doctor/components/DevInstallPanel.vue @@ -10,7 +10,8 @@ <el-col :span="12"> <el-form-item label="鎮h�呯紪鍙�" prop="patId"> <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" @input="getRentInfoByPatId" /> - <Qrcode v-if="formData.patId !== undefined && formData.patId !== ''" :text="formData.patId" logo="/logo.gif" width=100 /> +<!-- <Qrcode v-if="formData.patId !== undefined && formData.patId !== ''" :text="formData.patId" logo="/logo.gif" width=100 />--> + <Barcode v-if="!isStringEmpty(formData.patId) && 1 === checkTypeStore.getCheckTypeDispBarCode(formData.checkType)" :value="formData.patId" :width=100 /> </el-form-item> <el-form-item label="鎮h�呭悕绉�" prop="patName"> <el-input v-model="formData.patName" placeholder="璇疯緭鍏ユ偅鑰呭悕绉�" /> @@ -119,6 +120,8 @@ import {DeviceApi} from "@/api/ecg/devmanage"; import {QueueVO} from "@/api/ecg/queue"; import {RoomBedVO} from "@/api/ecg/doctor"; +import {Barcode} from "@/components/Barcode"; +import {useCheckTypeStore} from "@/store/modules/checkType"; /** 璁惧瑁呮満 琛ㄥ崟 */ defineComponent({ name: 'DevInstallPanel' }) @@ -132,6 +135,8 @@ const emit = defineEmits(['event_dev_install']) // 瀹氫箟 success 浜嬩欢锛岀敤浜庢搷浣滄垚鍔熷悗鐨勫洖璋� +const checkTypeStore = useCheckTypeStore() + const setPatient = (queueVO: QueueVO | undefined) => { resetForm() formData.value.patId = queueVO?.patId diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue index 21d046b..7188a76 100644 --- a/src/views/ecg/doctor/components/DevReadyPanel.vue +++ b/src/views/ecg/doctor/components/DevReadyPanel.vue @@ -12,7 +12,7 @@ > <el-form-item label="鎮h�呯紪鍙�" prop="patId"> <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" @input="getRentInfoByPatId" /> - <Qrcode v-if="formData.patId !== undefined && formData.patId !== ''" :text="formData.patId" logo="/logo.gif" :width=100 /> + <Barcode v-if="!isStringEmpty(formData.patId) && 1 === checkTypeStore.getCheckTypeDispBarCode(formData.checkType)" :value="formData.patId" :width=100 /> </el-form-item> <el-form-item label="鎮h�呭悕绉�" prop="patName"> <el-input v-model="formData.patName" placeholder="璇疯緭鍏ユ偅鑰呭悕绉�" /> @@ -126,6 +126,7 @@ <script setup lang="ts"> import {defineComponent, PropType} from "vue"; +import {Barcode} from "@/components/Barcode"; import { DevRentApi, DevRentVO } from '@/api/ecg/devrent' import {QueueVO} from "@/api/ecg/queue"; import {isStringEmpty} from "@/utils/stringUtil"; @@ -136,8 +137,7 @@ import {RoomBedVO} from "@/api/ecg/doctor"; import {hiprint} from "vue-plugin-hiprint"; import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment"; -import { useCheckTypeStoreWithOut } from '@/store/modules/checkType' -import {PrefixInteger} from "@/utils/formatter"; +import {useCheckTypeStore} from '@/store/modules/checkType' import {calGender, getBookBeginTime} from "@/utils"; /** 璁惧棰嗙敤 琛ㄥ崟 */ @@ -161,7 +161,7 @@ const autoPrint = ref<boolean>(true); -const checkTypeStore = useCheckTypeStoreWithOut() +const checkTypeStore = useCheckTypeStore() const formData = ref<DevRentVO>({ id: undefined, -- Gitblit v1.9.3