From be27214928a43cacff975265a7c67e2e2461fd0c Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期六, 28 十一月 2026 19:39:01 +0800
Subject: [PATCH] 打印小票
---
src/router/modules/remaining.ts | 11
src/store/modules/app.ts | 2
src/layout/components/ToolHeader.vue | 3
src/views/Login/Login.vue | 25 ++
src/components/DoctorPageLayout/src/DoctorPageLayout.vue | 58 ++++
src/layout/components/Setting/src/components/InterfaceDisplay.vue | 11
src/layout/components/ClientDownloadTag.vue | 38 +++
src/styles/var.css | 8
src/api/ecg/clientfile/index.ts | 61 +++++
src/views/ecg/clientfile/index.vue | 288 ++++++++++++++++++++++++
src/layout/components/AppView.vue | 33 +-
src/views/ecg/doctor/components/DevReadyPanel.vue | 167 ++++++++++++-
12 files changed, 650 insertions(+), 55 deletions(-)
diff --git a/src/api/ecg/clientfile/index.ts b/src/api/ecg/clientfile/index.ts
new file mode 100644
index 0000000..3188ebf
--- /dev/null
+++ b/src/api/ecg/clientfile/index.ts
@@ -0,0 +1,61 @@
+import request from '@/config/axios'
+
+/**
+ * 銆愭湰闇�姹偮峰唴缃戝垎鍙戙�戞墦鍗板鎴风瀹夎鍖咃紙electron-hiprint锛夌浉鍏虫帴鍙c��
+ *
+ * 璇存槑锛�
+ * 路 涓婁紶璧� **娴佸紡**锛坅pplication/octet-stream锛夛紝涓嶈蛋 multipart锛屽洜姝や笉鍙� 16MB 闄愬埗锛�
+ * 路 涓嬭浇鐩存帴缁欐祻瑙堝櫒涓�涓� URL锛堝厤鐧诲綍銆佹敮鎸佹柇鐐圭画浼狅級锛屼笉瑕佺敤 axios blob锛�90MB 浼氳杩涘唴瀛橈級銆�
+ */
+export interface ClientFileVO {
+ /** 鏂囦欢鍚嶏紝渚嬪 hiprint_win_x64-1.0.15.exe */
+ name: string
+ /** 瀛楄妭鏁� */
+ size: number
+ /** 鍙澶у皬锛屼緥濡� 86.4 MB */
+ sizeText: string
+ /** 鏈�鍚庝慨鏀规椂闂达紙姣鏃堕棿鎴筹級 */
+ lastModified: number
+}
+
+/** 鍚庣鎺ュ彛鍓嶇紑锛堜笌 axios 鐨� baseURL 瑙勫垯涓�鑷达細VITE_BASE_URL + VITE_API_URL锛� */
+const API_BASE = `${import.meta.env.VITE_BASE_URL || ''}${import.meta.env.VITE_API_URL || '/admin-api'}`
+
+export const ClientFileApi = {
+ /** 瀹夎鍖呭垪琛� */
+ getList: async () => {
+ return await request.get<ClientFileVO[]>({ url: '/ecg/client-file/list' })
+ },
+
+ /**
+ * 娴佸紡涓婁紶瀹夎鍖呫��
+ * @param name 淇濆瓨鐨勬枃浠跺悕锛堝惈鎵╁睍鍚嶏級
+ * @param file 娴忚鍣ㄩ�夋嫨鐨勬枃浠�
+ * @param onProgress 涓婁紶杩涘害鍥炶皟锛堝ぇ鏂囦欢鏄剧ず杩涘害鏉$敤锛�
+ */
+ upload: async (
+ name: string,
+ file: File,
+ onProgress?: (evt: ProgressEvent) => void
+ ) => {
+ return await request.post<ClientFileVO>({
+ url: '/ecg/client-file/upload',
+ params: { name },
+ data: file,
+ headersType: 'application/octet-stream',
+ // 澶ф枃浠讹細鍏抽棴瓒呮椂锛坅xios 榛樿 timeout 浼氬湪闀夸紶杈撴椂涓柇锛�
+ timeout: 0,
+ onUploadProgress: onProgress
+ })
+ },
+
+ /** 鍒犻櫎瀹夎鍖� */
+ remove: async (name: string) => {
+ return await request.delete<boolean>({ url: `/ecg/client-file/${encodeURIComponent(name)}` })
+ },
+
+ /** 涓嬭浇鍦板潃锛堝厤鐧诲綍锛涚洿鎺ョ粰 <a href> 鐢紝鏀寔鏂偣缁紶锛� */
+ downloadUrl: (name: string) => {
+ return `${API_BASE}/ecg/client-file/download/${encodeURIComponent(name)}`
+ }
+}
diff --git a/src/components/DoctorPageLayout/src/DoctorPageLayout.vue b/src/components/DoctorPageLayout/src/DoctorPageLayout.vue
index e247bb5..87ba476 100644
--- a/src/components/DoctorPageLayout/src/DoctorPageLayout.vue
+++ b/src/components/DoctorPageLayout/src/DoctorPageLayout.vue
@@ -302,13 +302,34 @@
if (!el || !parent) return
const cs = getComputedStyle(parent)
- const inner =
- parent.clientHeight -
- parseFloat(cs.paddingTop || '0') -
- parseFloat(cs.paddingBottom || '0')
+ const pb = parseFloat(cs.paddingBottom || '0')
- // 鐖剁骇楂樺害涓嶅彲娴嬶紙auto/0锛夋椂淇濈暀 CSS 鍥為��锛屼笉璁惧唴鑱旈珮搴�
- measuredHeight.value = inner > 0 ? `${inner}px` : undefined
+ /*
+ * 銆�2026-11-28 淇路1600脳900 鐪嬩笉鍒板簳閮ㄦ寜閽紙鍙彿/杩囧彿/閲嶅彨/鏆傚仠/鍋滄鍊欒瘖锛夈��
+ *
+ * 鏃у疄鐜帮細鍙敤楂樺害 = parent.clientHeight 鈭� 鐖剁骇涓婁笅 padding銆�
+ * 浣嗙埗绾э紙AppView 鐨� <section>锛夐珮搴︽槸 **min-height + 鐢卞唴瀹规拺寮�**锛�
+ * 浜庢槸褰㈡垚寰幆渚濊禆锛氬唴瀹癸紙鍚� footer锛夋妸鐖剁骇鎾戦珮 鈫� 鎴戜滑鍐嶆妸鏍瑰厓绱犺鎴�"鐖剁骇閭d箞楂�"
+ * 鈬� 鏍瑰厓绱犳案杩� 鈮� 鍐呭楂樺害锛岄〉闈㈡瘮瑙嗗彛楂橈紝footer 琚帹鍒版姌鍙犵嚎浠ヤ笅锛�
+ * 鍖荤敓蹇呴』婊氬姩鎵嶈兘鐪嬪埌鎸夐挳锛堢揣鍑戞ā寮忎篃鏁戜笉浜嗭紝鍥犱负鍘嬬缉鐨勬槸鍐呭涓嶆槸鏍归珮搴︼級銆�
+ *
+ * 鐜板湪鏀逛负**浠ヨ鍙d负鍩哄噯**锛堜笌鐖剁骇褰撳墠楂樺害鏃犲叧锛屼笉寰幆锛夛細
+ * 鍙敤楂樺害 = window.innerHeight 鈭� 鏈〉鍦ㄦ枃妗d腑鐨勯《绔� 鈭� 鐖剁骇 padding-bottom
+ * 杩欐牱 1600脳900锛堟祻瑙堝櫒鍙楂樼害 780锛変篃涓�瀹氳兘鎶� footer 鏀捐繘灞忓箷鍐呫��
+ */
+ const rect = el.getBoundingClientRect()
+ const docTop = rect.top + (window.scrollY || document.documentElement.scrollTop || 0)
+
+ // 甯冨眬搴曢儴鐨勫簲鐢ㄩ〉鑴氾紙AppView 閲� <Footer> 涓庡唴瀹� section 鏄厔寮熻妭鐐癸級涔熶細鍗犻珮搴︼紝
+ // 涓嶆墸鎺夊氨浼氬鍑轰竴鏉� 20~40px 鐨勯〉闈㈡粴鍔紝鎶婃垜浠殑搴曢儴鎸夐挳鍘嬪埌鎶樺彔绾夸互涓嬨��
+ // 閫氳繃"鍐呭 section 鐨勪笅涓�涓厔寮�"鏉ヨ瘑鍒紝璇嗗埆涓嶅埌灏卞綋娌℃湁锛堜笉鎵o級銆�
+ const nextSibling = parent.nextElementSibling as HTMLElement | null
+ const hasFooter = !!nextSibling && /footer/i.test(nextSibling.className || '')
+ const footerH = hasFooter ? nextSibling!.getBoundingClientRect().height : 0
+
+ const available = window.innerHeight - docTop - pb - footerH
+ // 鏋佺灏忚鍙e厹搴� 240px锛堝啀灏忓氨娌℃湁鍙敤绌洪棿浜嗭級
+ measuredHeight.value = available > 0 ? `${Math.max(240, Math.round(available))}px` : undefined
// 瀹藉害鍙樺寲锛堝惈绐楀彛缂╂斁锛夋椂閲嶆柊澶逛竴娆″彸鏍忓搴︼紝
// 鍚﹀垯鎷栧鍚庢妸绐楀彛缂╁皬锛屽彸渚ф爮鍙兘鎶婂乏渚у唴瀹规尋娌°��
@@ -336,9 +357,13 @@
if (parent && typeof ResizeObserver !== 'undefined') {
ro = new ResizeObserver(scheduleMeasure)
ro.observe(parent)
- } else {
- window.addEventListener('resize', scheduleMeasure)
}
+ // 銆�2026-11-28銆戠獥鍙e昂瀵�/娴忚鍣ㄧ缉鏀惧彉鍖�**涓�瀹�**瑕侀噸绠楋細鐖剁骇楂樺害鍙兘娌″彉锛坢in-height 鎾戞弧锛夛紝
+ // 浣嗚鍙e彉浜� 鈫� 鍙敤楂樺害灏卞彉浜嗐�傛棫瀹炵幇鍙湪娌℃湁 ResizeObserver 鏃舵墠鐩戝惉 resize锛�
+ // 浜庢槸"鏈�澶у寲/杩樺師绐楀彛"鍚庨珮搴︿笉鍒锋柊锛宖ooter 鍙堣窇鍒板睆骞曞銆�
+ window.addEventListener('resize', scheduleMeasure)
+ // 渚ц竟鏍忔姌鍙�/灞曞紑锛堣彍鍗曞搴﹀彉鍖栵級鎴� TagsView 寮�鍏冲悓鏍蜂細鏀瑰彉鍙敤楂樺害
+ window.addEventListener('orientationchange', scheduleMeasure)
})
onBeforeUnmount(() => {
@@ -346,6 +371,7 @@
ro?.disconnect()
ro = undefined
window.removeEventListener('resize', scheduleMeasure)
+ window.removeEventListener('orientationchange', scheduleMeasure)
})
</script>
@@ -705,7 +731,7 @@
}
.doctor-page__header {
- height: 36px;
+ height: 32px;
}
.doctor-page__readonly-tip {
@@ -714,7 +740,19 @@
}
.doctor-page__footer {
- padding: 2px 0 2px 8px;
+ padding: 1px 0 1px 8px;
+ }
+
+ /* 銆�2026-11-28銆戠揣鍑戞ā寮忎笅搴曢儴鎸夐挳鍐嶇煯涓�妗o細1600脳900 涓婃妸楂樺害杩樼粰鍐呭鍖� */
+ .doctor-page__footer :deep(.el-button),
+ .doctor-page__footer :deep(.el-button--small) {
+ height: 28px;
+ padding: 0 10px;
+ font-size: 14px;
+ }
+
+ .doctor-page__content {
+ padding: 4px 8px;
}
}
</style>
diff --git a/src/layout/components/AppView.vue b/src/layout/components/AppView.vue
index 4434187..b461240 100644
--- a/src/layout/components/AppView.vue
+++ b/src/layout/components/AppView.vue
@@ -1,7 +1,6 @@
<script lang="ts" setup>
import { useTagsViewStore } from '@/store/modules/tagsView'
import { useAppStore } from '@/store/modules/app'
-import { Footer } from '@/layout/components/Footer'
defineOptions({ name: 'AppView' })
@@ -10,8 +9,6 @@
const layout = computed(() => appStore.getLayout)
const fixedHeader = computed(() => appStore.getFixedHeader)
-
-const footer = computed(() => appStore.getFooter)
const tagsViewStore = useTagsViewStore()
@@ -34,29 +31,34 @@
</script>
<template>
+ <!--
+ 銆愭湰闇�姹傘�戝幓鎺夊簳閮ㄣ�孋opyright 漏2024-蹇冪數鎺掗槦瑁呮満绯荤粺銆嶉〉鑴氾紙鍘熼珮 50px锛夛紝
+ 鎶婅繖鍧楅珮搴﹀畬鏁磋缁欏伐浣滃尯銆傚洜姝わ細
+ 路 涓嶅啀娓叉煋 <Footer>锛�
+ 路 `min-h` 璁$畻鍏紡閲屼篃鍘绘帀浜� `--app-footer-height`锛堣鍙橀噺宸茬疆 0px锛屽弻淇濋櫓锛夈��
+ -->
<section
:class="[
'p-[var(--app-content-padding)] w-[calc(100%-var(--app-content-padding)-var(--app-content-padding))] bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]',
{
- '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
+ '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding))]':
(fixedHeader &&
- (layout === 'classic' || layout === 'topLeft' || layout === 'top') &&
- footer) ||
- (!tagsView && layout === 'top' && footer),
- '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height)-var(--tags-view-height))]':
- tagsView && layout === 'top' && footer,
+ (layout === 'classic' || layout === 'topLeft' || layout === 'top')) ||
+ (!tagsView && layout === 'top'),
+ '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]':
+ tagsView && layout === 'top',
- '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height)-var(--app-footer-height))]':
- !fixedHeader && layout === 'classic' && footer,
+ '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height))]':
+ !fixedHeader && layout === 'classic',
- '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
- !fixedHeader && layout === 'topLeft' && footer,
+ '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding))]':
+ !fixedHeader && layout === 'topLeft',
'!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding))]':
- fixedHeader && layout === 'cutMenu' && footer,
+ fixedHeader && layout === 'cutMenu',
'!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]':
- !fixedHeader && layout === 'cutMenu' && footer
+ !fixedHeader && layout === 'cutMenu'
}
]"
>
@@ -68,5 +70,4 @@
</template>
</router-view>
</section>
- <Footer v-if="footer" />
</template>
diff --git a/src/layout/components/ClientDownloadTag.vue b/src/layout/components/ClientDownloadTag.vue
new file mode 100644
index 0000000..97ed7ef
--- /dev/null
+++ b/src/layout/components/ClientDownloadTag.vue
@@ -0,0 +1,38 @@
+<!--
+ 銆愭湰闇�姹偮峰唴缃戝垎鍙戙�戦《鏍忋�屾墦鍗板鎴风涓嬭浇銆嶅叆鍙�
+
+ 涓轰粈涔堟斁椤舵爮锛氬尰鐢熺鐢佃剳涓嶅厑璁告嫹鏂囦欢锛岄渶瑕�"鎵撳紑缃戠珯灏辫兘涓嬪畨瑁呭寘"銆�
+ 杩欓噷鍙仛鍏ュ彛锛岄〉闈㈠湪 /client-download锛坴iews/ecg/clientfile/index.vue锛岀櫥褰曞嵆鍙闂級銆�
+-->
+<template>
+ <el-tooltip content="鎵撳嵃瀹㈡埛绔笅杞斤紙hiprint 瀹夎鍖咃級" placement="bottom">
+ <el-button link class="client-download-tag" @click="go">
+ <Icon icon="ep:download" :size="18" />
+ </el-button>
+ </el-tooltip>
+</template>
+
+<script setup lang="ts">
+import { useRouter } from 'vue-router'
+
+defineOptions({ name: 'ClientDownloadTag' })
+
+const router = useRouter()
+
+const go = () => {
+ router.push({ path: '/client-download' })
+}
+</script>
+
+<style scoped lang="scss">
+.client-download-tag {
+ margin-right: 8px;
+ padding: 0 6px;
+ height: 30px;
+ color: var(--el-text-color-regular);
+
+ &:hover {
+ color: var(--el-color-primary);
+ }
+}
+</style>
diff --git a/src/layout/components/Setting/src/components/InterfaceDisplay.vue b/src/layout/components/Setting/src/components/InterfaceDisplay.vue
index d482916..b7b19c9 100644
--- a/src/layout/components/Setting/src/components/InterfaceDisplay.vue
+++ b/src/layout/components/Setting/src/components/InterfaceDisplay.vue
@@ -95,11 +95,9 @@
}
// 椤佃剼
-const footer = ref(appStore.getFooter)
-const footerChange = (show: boolean) => {
- appStore.setFooter(show)
-}
+
+
// 鐏拌壊妯″紡
const greyMode = ref(appStore.getGreyMode)
@@ -189,10 +187,7 @@
<ElSwitch v-model="fixedHeader" @change="fixedHeaderChange" />
</div>
- <div class="flex items-center justify-between">
- <span class="text-14px">{{ t('setting.footer') }}</span>
- <ElSwitch v-model="footer" @change="footerChange" />
- </div>
+ <!-- 銆愭湰闇�姹傘�戦〉鑴氾紙Copyright 漏2024-蹇冪數鎺掗槦瑁呮満绯荤粺锛夊凡鍏ㄥ眬鍘绘帀锛岃繖閲屼笉鍐嶆彁渚涘紑鍏� -->
<div class="flex items-center justify-between">
<span class="text-14px">{{ t('setting.greyMode') }}</span>
diff --git a/src/layout/components/ToolHeader.vue b/src/layout/components/ToolHeader.vue
index 0c860d3..b12f60c 100644
--- a/src/layout/components/ToolHeader.vue
+++ b/src/layout/components/ToolHeader.vue
@@ -8,6 +8,7 @@
import { LocaleDropdown } from '@/layout/components/LocaleDropdown'
import RouterSearch from '@/components/RouterSearch/index.vue'
import CurrentRoomTag from '@/layout/components/CurrentRoomTag.vue'
+import ClientDownloadTag from '@/layout/components/ClientDownloadTag.vue'
import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign'
@@ -59,6 +60,8 @@
</div>
) : undefined}
<div class="h-full flex items-center">
+ {/* 銆愬唴缃戝垎鍙戙�戞墦鍗板鎴风瀹夎鍖呬笅杞藉叆鍙o紙鍖荤敓绔笉鍏佽鎷锋枃浠讹紝鐢ㄦ祻瑙堝櫒涓嬭浇锛� */}
+ <ClientDownloadTag />
{/* 褰撳墠鍏ュ骇鐨勮瘖瀹ゅ伐浣嶏紙闇�姹傦細椤舵爮鍙锛屾湭鍏ュ骇鍙偣鍑诲幓閫夛級 */}
<CurrentRoomTag />
{screenfull.value ? (
diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts
index 7e600ac..5606500 100644
--- a/src/router/modules/remaining.ts
+++ b/src/router/modules/remaining.ts
@@ -193,6 +193,17 @@
}
},
{
+ // 銆愭湰闇�姹偮峰唴缃戝垎鍙戙�戞墦鍗板鎴风涓嬭浇椤碉細鐧诲綍鍗冲彲璁块棶锛堜笉闇�瑕佽彍鍗�/鏉冮檺锛屽厤 SQL锛�
+ path: '/client-download',
+ component: () => import('@/views/ecg/clientfile/index.vue'),
+ name: 'EcgClientDownload',
+ meta: {
+ hidden: true,
+ title: '鎵撳嵃瀹㈡埛绔笅杞�',
+ noTagsView: true
+ }
+ },
+ {
path: '/roomselect',
component: () => import('@/views/ecg/room/RoomLoginSelect.vue'),
name: 'LoginRoomSelect',
diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index 7245d03..be07943 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -59,7 +59,7 @@
tagsViewIcon: true, // 鏄惁鏄剧ず鏍囩鍥炬爣
logo: true, // logo
fixedHeader: true, // 鍥哄畾toolheader
- footer: true, // 鏄剧ず椤佃剼
+ footer: false, // 銆愭湰闇�姹傘�戜笉鍐嶆樉绀哄簳閮ㄧ増鏉冮〉鑴氾紙鎶� 50px 楂樺害璁╃粰宸ヤ綔鍖猴級
greyMode: false, // 鏄惁寮�濮嬬伆鑹叉ā寮忥紝鐢ㄤ簬鐗规畩鎮煎康鏃�
fixedMenu: wsCache.get('fixedMenu') || false, // 鏄惁鍥哄畾鑿滃崟
diff --git a/src/styles/var.css b/src/styles/var.css
index 63459ba..f3769e5 100644
--- a/src/styles/var.css
+++ b/src/styles/var.css
@@ -50,7 +50,13 @@
--app-content-bg-color: #f5f7f9;
- --app-footer-height: 50px;
+ /*
+ 銆愭湰闇�姹傘�戝幓鎺夊簳閮ㄣ�孋opyright 漏2024-蹇冪數鎺掗槦瑁呮満绯荤粺銆嶉〉鑴氾紝鎶� 50px 楂樺害杩樼粰宸ヤ綔鍖恒��
+ 路 缃� 0 鍚庯紝AppView 閲岄偅浜� `calc(100% - ... - var(--app-footer-height))` 鐨� min-h 璁$畻鑷姩鍙樺噯锛�
+ 路 椤佃剼缁勪欢锛堣嫢杩樻覆鏌擄級楂樺害涓� 0銆佷笉鍙锛�
+ 路 宸ヤ綔鍙帮紙DoctorPageLayout锛夊湪娴嬮噺鍙敤楂樺害鏃朵篃涓嶅繀鍐嶆墸椤佃剼楂樺害銆�
+ */
+ --app-footer-height: 0px;
--transition-time-02: 0.2s;
}
diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue
index 94b9c9c..9c11efd 100644
--- a/src/views/Login/Login.vue
+++ b/src/views/Login/Login.vue
@@ -58,6 +58,13 @@
<!-- <SSOLoginVue class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />-->
</div>
</Transition>
+ <!-- 銆愭湰闇�姹偮峰唴缃戝垎鍙戙�戞柊瑁呯殑鐢佃剳杩樻病鐧诲綍鏃朵篃鑳戒笅杞芥墦鍗板鎴风瀹夎鍖� -->
+ <div class="login-client-download">
+ <a href="/client-download" target="_blank" rel="noopener">
+ <Icon icon="ep:download" class="mr-4px" />
+ 鎵撳嵃瀹㈡埛绔笅杞斤紙hiprint 瀹夎鍖咃級
+ </a>
+ </div>
</div>
</div>
</div>
@@ -86,6 +93,24 @@
.#{$prefix-cls} {
overflow: auto;
+ /* 銆愬唴缃戝垎鍙戙�戠櫥褰曢〉搴曢儴鐨勩�屾墦鍗板鎴风涓嬭浇銆嶉摼鎺� */
+ .login-client-download {
+ margin-top: 10px;
+ text-align: center;
+ font-size: 13px;
+
+ a {
+ display: inline-flex;
+ align-items: center;
+ color: var(--el-color-primary);
+ text-decoration: none;
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+ }
+
&__left {
&::before {
position: absolute;
diff --git a/src/views/ecg/clientfile/index.vue b/src/views/ecg/clientfile/index.vue
new file mode 100644
index 0000000..4c5f9d9
--- /dev/null
+++ b/src/views/ecg/clientfile/index.vue
@@ -0,0 +1,288 @@
+<!--
+ 銆愭湰闇�姹偮峰唴缃戝垎鍙戙�戞墦鍗板鎴风涓嬭浇椤�
+
+ 鑳屾櫙锛氬尰闄㈠唴缃戯紝鍖荤敓绔數鑴戜笉鍏佽鎷疯礉鏂囦欢銆傝繍缁存妸 electron-hiprint 瀹夎鍖�
+ 涓婁紶鍒版湰绯荤粺锛堟垨鐩存帴 scp 鍒版湇鍔″櫒鐩綍锛夛紝鍖荤敓鐢ㄦ祻瑙堝櫒鎵撳紑鏈〉鍗冲彲涓嬭浇瀹夎銆�
+
+ 鍏ュ彛锛�
+ 路 椤舵爮銆屼笅杞姐�嶅浘鏍囷紙ToolHeader 鈫� ClientDownloadTag锛�
+ 路 鐧诲綍椤靛簳閮ㄣ�屾墦鍗板鎴风涓嬭浇銆嶉摼鎺�
+
+ 鏉冮檺锛�
+ 路 鍒楄〃/涓嬭浇锛氱櫥褰曞嵆鍙紙涓嬭浇鍦板潃鏈韩鍏嶇櫥褰曪紝渚夸簬娴忚鍣ㄧ洿杩�/鏂偣缁紶锛�
+ 路 涓婁紶/鍒犻櫎锛氫粎绠$悊鍛橈紙鍓嶇鎸� super_admin 瑙掕壊鏄剧ず锛屽悗绔帴鍙f湰韬彧瑕佹眰鐧诲綍锛�
+-->
+<template>
+ <div class="client-file-page">
+ <div class="client-file-page__head">
+ <div class="client-file-page__title">
+ <Icon icon="ep:download" class="mr-6px" />
+ 鎵撳嵃瀹㈡埛绔笅杞�
+ </div>
+ <div class="client-file-page__desc">
+ 瀹夎鍚� <b>鎵撳嵃灏忕エ涓嶅啀寮瑰嚭鎵撳嵃瀵硅瘽妗�</b>锛堥潤榛樻墦鍗帮級銆傚畨瑁呮椂璇峰彸閿�屼互绠$悊鍛樿韩浠借繍琛屻�嶏紝
+ 瀹夎瀹屾垚鍚庡湪瀹㈡埛绔缃噷鍏抽棴銆岃繛鎺ヤ腑杞湇鍔°�嶏紝骞舵妸榛樿鎵撳嵃鏈鸿涓�
+ <b>寰楀疄 DL-210</b>銆�
+ </div>
+ </div>
+
+ <ContentWrap>
+ <div class="client-file-page__toolbar">
+ <el-button :icon="Refresh" :loading="loading" @click="loadList">鍒锋柊</el-button>
+ <el-button
+ v-if="isAdmin"
+ type="primary"
+ :icon="Upload"
+ :loading="uploading"
+ @click="pickFile"
+ >
+ 涓婁紶瀹夎鍖�
+ </el-button>
+ <span v-if="isAdmin" class="client-file-page__hint">
+ 绠$悊鍛樺彲鐢細涔熷彲璁╄繍缁寸洿鎺ユ妸瀹夎鍖呮斁鍒版湇鍔″櫒 <code>ecg.client-file.dir</code> 鐩綍锛屽埛鏂板嵆鏄剧ず
+ </span>
+ <input
+ ref="fileInputRef"
+ type="file"
+ class="client-file-page__file-input"
+ @change="onFileChange"
+ />
+ </div>
+
+ <!-- 涓婁紶杩涘害 -->
+ <div v-if="uploading" class="client-file-page__progress">
+ <el-progress :percentage="uploadPercent" :stroke-width="14" text-inside />
+ <span class="client-file-page__progress-text">{{ uploadingName }}锛坽{ uploadPercent }}%锛�</span>
+ </div>
+
+ <el-table :data="list" v-loading="loading" stripe empty-text="鏆傛棤瀹夎鍖�">
+ <el-table-column label="鏂囦欢鍚�" prop="name" min-width="320" show-overflow-tooltip>
+ <template #default="{ row }">
+ <Icon icon="ep:document" class="mr-4px" />
+ <span class="client-file-page__name">{{ row.name }}</span>
+ <el-tag v-if="isLatest(row)" size="small" type="success" class="ml-6px">鏈�鏂�</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="澶у皬" prop="sizeText" width="120" align="center" />
+ <el-table-column label="涓婁紶/鏇存柊鏃堕棿" width="180" align="center">
+ <template #default="{ row }">{{ formatTime(row.lastModified) }}</template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="260" align="center" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" :icon="Download" @click="download(row.name)">
+ 涓嬭浇
+ </el-button>
+ <el-button link type="primary" :icon="Link" @click="copyLink(row.name)">
+ 澶嶅埗閾炬帴
+ </el-button>
+ <el-button
+ v-if="isAdmin"
+ link
+ type="danger"
+ :icon="Delete"
+ :loading="deleting === row.name"
+ @click="remove(row.name)"
+ >
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </ContentWrap>
+
+ <div class="client-file-page__foot">
+ 瀹夎姝ラ锛氣憼 鐐广�屼笅杞姐�嶁啋 鈶� 鍙抽敭瀹夎鍖� 鈫掋�屼互绠$悊鍛樿韩浠借繍琛屻�嶁啋 鈶� 瀹夎瀹屾垚鍚庢墭鐩樺嚭鐜板浘鏍� 鈫�
+ 鈶� 瀹㈡埛绔缃噷鍏抽棴銆岃繛鎺ヤ腑杞湇鍔°�嶃�侀粯璁ゆ墦鍗版満閫� DL-210 鈫� 鈶� 鍥� ECG 鐐广�屾墦鍗板皬绁ㄣ�嶉獙璇併��
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { computed, onMounted, ref } from 'vue'
+import dayjs from 'dayjs'
+import { Delete, Download, Link, Refresh, Upload } from '@element-plus/icons-vue'
+import { ClientFileApi, type ClientFileVO } from '@/api/ecg/clientfile'
+import { useUserStore } from '@/store/modules/user'
+import { useMessage } from '@/hooks/web/useMessage'
+import { copyText } from '@/utils/copyText'
+
+defineOptions({ name: 'EcgClientFile' })
+
+const message = useMessage()
+const userStore = useUserStore()
+
+const list = ref<ClientFileVO[]>([])
+const loading = ref(false)
+const deleting = ref<string>('')
+const fileInputRef = ref<HTMLInputElement>()
+
+const uploading = ref(false)
+const uploadingName = ref('')
+const uploadPercent = ref(0)
+
+/** 鏄惁绠$悊鍛橈紙涓婁紶/鍒犻櫎鎸夐挳鍙鎬э級 */
+const isAdmin = computed(() => {
+ const roles = (userStore.getRoles || []) as string[]
+ return roles.includes('super_admin') || roles.includes('admin')
+})
+
+/** 鏈�鏂扮増鏈爣璁帮細鍒楄〃鎸夋椂闂村�掑簭锛岀涓�鏉″嵆鏈�鏂� */
+const isLatest = (row: ClientFileVO) => {
+ return list.value.length > 0 && list.value[0].name === row.name
+}
+
+const formatTime = (ts: number) => (ts ? dayjs(ts).format('YYYY-MM-DD HH:mm') : '-')
+
+const loadList = async () => {
+ loading.value = true
+ try {
+ const data = await ClientFileApi.getList()
+ list.value = Array.isArray(data) ? data : []
+ } catch (e) {
+ console.error('[client-file] 鍔犺浇瀹夎鍖呭垪琛ㄥけ璐�', e)
+ message.error('鍔犺浇瀹夎鍖呭垪琛ㄥけ璐�')
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 涓嬭浇锛堝厤鐧诲綍鐩撮摼锛屾祻瑙堝櫒鍘熺敓涓嬭浇/鏀寔鏂偣缁紶锛� */
+const download = (name: string) => {
+ const url = ClientFileApi.downloadUrl(name)
+ const a = document.createElement('a')
+ a.href = url
+ a.download = name
+ a.rel = 'noopener'
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+}
+
+/** 澶嶅埗涓嬭浇閾炬帴锛堜究浜庡彂缁欏埆鐨勭數鑴� / 缇ゅ彂锛� */
+const copyLink = async (name: string) => {
+ const url = `${window.location.origin}${ClientFileApi.downloadUrl(name)}`
+ const ok = await copyText(url)
+ if (ok) {
+ message.success('涓嬭浇閾炬帴宸插鍒讹紝鍙洿鎺ュ彂缁欏叾瀹冪數鑴�')
+ } else {
+ message.warning('褰撳墠娴忚鍣ㄤ笉鏀寔鑷姩澶嶅埗锛岃鎵嬪姩澶嶅埗鍦板潃鏍忛摼鎺�')
+ }
+}
+
+// ==================== 涓婁紶锛堢鐞嗗憳锛� ====================
+
+const pickFile = () => {
+ fileInputRef.value?.click()
+}
+
+const onFileChange = async (e: Event) => {
+ const input = e.target as HTMLInputElement
+ const file = input.files?.[0]
+ // 娓呯┖锛屼繚璇佸悓涓�涓枃浠惰兘鍐嶆閫夋嫨瑙﹀彂 change
+ input.value = ''
+ if (!file) return
+
+ uploading.value = true
+ uploadingName.value = file.name
+ uploadPercent.value = 0
+ try {
+ await ClientFileApi.upload(file.name, file, (evt) => {
+ if (evt.total) {
+ uploadPercent.value = Math.min(99, Math.round((evt.loaded / evt.total) * 100))
+ }
+ })
+ uploadPercent.value = 100
+ message.success(`涓婁紶鎴愬姛锛�${file.name}`)
+ await loadList()
+ } catch (err) {
+ console.error('[client-file] 涓婁紶澶辫触', err)
+ message.error('涓婁紶澶辫触锛岃纭鏂囦欢澶у皬鏈秴杩囬檺鍒讹紙榛樿 500MB锛�')
+ } finally {
+ uploading.value = false
+ uploadingName.value = ''
+ setTimeout(() => (uploadPercent.value = 0), 1500)
+ }
+}
+
+const remove = async (name: string) => {
+ deleting.value = name
+ try {
+ await ClientFileApi.remove(name)
+ message.success(`宸插垹闄わ細${name}`)
+ await loadList()
+ } catch (e) {
+ console.error('[client-file] 鍒犻櫎澶辫触', e)
+ message.error('鍒犻櫎澶辫触')
+ } finally {
+ deleting.value = ''
+ }
+}
+
+onMounted(loadList)
+</script>
+
+<style scoped lang="scss">
+.client-file-page {
+ padding: 12px 16px 24px;
+
+ &__head {
+ margin-bottom: 12px;
+ }
+
+ &__title {
+ display: flex;
+ align-items: center;
+ font-size: 18px;
+ font-weight: 700;
+ color: var(--el-text-color-primary);
+ }
+
+ &__desc {
+ margin-top: 6px;
+ font-size: 13px;
+ line-height: 1.6;
+ color: var(--el-text-color-secondary);
+ }
+
+ &__toolbar {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 10px;
+ flex-wrap: wrap;
+ }
+
+ &__hint {
+ font-size: 12px;
+ color: var(--el-text-color-secondary);
+ }
+
+ &__file-input {
+ display: none;
+ }
+
+ &__progress {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 10px;
+ }
+
+ &__progress-text {
+ font-size: 12px;
+ color: var(--el-text-color-secondary);
+ white-space: nowrap;
+ }
+
+ &__name {
+ font-family: Consolas, Monaco, monospace;
+ }
+
+ &__foot {
+ margin-top: 12px;
+ font-size: 12px;
+ line-height: 1.8;
+ color: var(--el-text-color-secondary);
+ }
+}
+</style>
diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index 8ff6cef..654e3a2 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -361,7 +361,12 @@
await DevRentApi.devReady(formData.value)
if (autoPrint.value && formData.value.patId && formData.value.checkType) {
- printBill(formData.value.patDetails?.appointmentId)
+ const apptId = formData.value.patDetails?.appointmentId
+ // 銆愭湰娆′慨澶嶃�戣嚜鍔ㄦ墦鍗版椂鑻ユ病鏈夐绾﹀崟鍙峰氨**闈欓粯璺宠繃**锛�
+ // 鎵嬪姩鐐广�屾墦鍗板皬绁ㄣ�嶄細缁欏嚭"鏃犻绾﹀崟"鐨勬彁绀猴紝浣嗛鐢ㄥ畬鎴愬悗鐨勮嚜鍔ㄦ墦鍗颁笉璇ュ脊璀﹀憡鎵撴柇娴佺▼銆�
+ if (apptId != null) {
+ printBill(apptId)
+ }
}
// 鑷姩纭垂
@@ -583,9 +588,34 @@
devInfo.value.state = data.devState
}
+/**
+ * 銆愭湰娆′慨澶嶃�戠瓑寰� hiprint 鎵撳嵃瀹㈡埛绔氨缁紙鏈�澶氱害 800ms锛夈��
+ *
+ * 鎵撳嵃瀹㈡埛绔槸**鏈満** websocket 鏈嶅姟锛堥粯璁� http://localhost:17521锛夛紝
+ * `print2()`锛堥潤榛樻墦鍗帮級瑕佹眰瀹冨凡杩炴帴锛涢娆$偣鍑绘椂 socket 鍙兘杩樺湪杩炴帴涓紝
+ * 杩欓噷鐭殏杞锛岄伩鍏�"鏈満鏄庢槑瑁呬簡瀹㈡埛绔紝鍗村洜涓烘病杩炰笂鑰屾墦涓嶅嚭绁�"銆�
+ *
+ * @returns true = 瀹㈡埛绔彲鐢紝鍙潤榛樻墦鍗帮紱false = 涓嶅彲鐢紝搴斿洖閫�娴忚鍣ㄦ墦鍗�
+ */
+const waitPrintClientOpened = async (tpl: any, timeoutMs = 800): Promise<boolean> => {
+ if (typeof tpl?.clientIsOpened !== 'function') return false
+ if (tpl.clientIsOpened()) return true
+ const step = 100
+ for (let waited = 0; waited < timeoutMs; waited += step) {
+ // eslint-disable-next-line no-await-in-loop
+ await new Promise((resolve) => setTimeout(resolve, step))
+ if (tpl.clientIsOpened()) return true
+ }
+ return false
+}
+
const printBill = async (appointmentId: number | null | undefined, printMode?: number) => {
- if ( appointmentId == null )
+ // 銆愭湰娆′慨澶嶃�戝師鏉ヨ繖閲岀洿鎺� return锛岀幇鍦鸿〃鐜版槸"鐐广�屾墦鍗板皬绁ㄣ�嶅畬鍏ㄦ病鍙嶅簲"銆�
+ // 灏忕エ鍐呭鍙栬嚜**棰勭害鍗�**锛屾病鏈夐绾﹀崟鍙峰氨娌℃湁鍙墦鍗扮殑鍐呭 鈥斺�� 杩欓噷鏄庣‘鎻愮ず銆�
+ if (appointmentId == null) {
+ message.warning('璇ユ偅鑰呮病鏈夊叧鑱旂殑棰勭害鍗曪紙缂哄皯棰勭害鍗曞彿锛夛紝鏃犳硶鎵撳嵃灏忕エ')
return
+ }
const curAppointment: AppointmentVO = await AppointmentApi.getAppointment( appointmentId )
@@ -597,27 +627,126 @@
// 涓嬪垪鏂规硶閮芥槸娌℃湁鎷栨嫿璁捐椤甸潰鐨�, 鐩稿綋浜庝唬鐮佹ā寮�, 浣跨敤浠g爜璁捐椤甸潰
// 鎯宠瀹炵幇鎷栨嫿璁捐椤甸潰,璇峰線涓嬬湅 '鑷畾涔夎璁�'
var hiprintTemplate = new hiprint.PrintTemplate(); // 鍙紶鍙傛暟
- //var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); 瀵艰嚧璧颁笁椤�
- var panel = hiprintTemplate.addPrintPanel({ width: 140, height: 130, paperNumberDisabled:true});
-//鏂囨湰
+
+// ============================================================================
+// 銆愭湰娆¤皟鏁绰烽�傞厤寰楀疄 DL-210 + 鐑晱绾� 50脳30mm銆�
+//
+// 鎵撳嵃鏈猴細寰楀疄 DL-210锛�203dpi = 8 dots/mm锛屽彲鎵撳嵃瀹藉害 108mm锛孶SB 鍙o級
+// 鑰楁潗 锛氱儹鏁忔爣绛剧焊 50mm(瀹�) 脳 30mm(楂�)
+//
+// 涔嬪墠妯℃澘鏄� 140脳130mm锛堢粰 A4/澶ч潰鍗曠敤鐨勶級锛屾瘮 50mm 绾稿鍑� 90mm 鈬� 椹卞姩鎸� 50mm 缂╂斁锛�
+// 瀛椾笌鏉$爜浼氳鍘嬪緱寰堝皬/瑁佸垏銆傝繖閲屾暣浣撴敼涓� 50脳30mm锛屽苟鎸夊皬绾搁噸鎺掍负 **5 琛� + 1 鏉$爜**锛�
+//
+// y 0.8mm 鈹�鈹� 妫�鏌ラ」鐩紙10pt 鍔犵矖灞呬腑锛�
+// y 5.6mm 鈹�鈹� 濮撳悕 鎬у埆 骞撮緞锛�9pt 鍔犵矖灞呬腑锛�
+// y10.0mm 鈹�鈹� 鐥呭尯-搴婂彿锛堝乏鍗婏級 | 棰勭害 11-28 08:00锛堝彸鍗婏級 7.5pt
+// y14.0mm 鈹�鈹� 鎮h�呯紪鍙凤紙宸﹀崐锛� | 鎵嬫満鍙凤紙鍙冲崐锛� 7.5pt
+// y18.4mm 鈹�鈹� 鏉″舰鐮侊紙楂� 10.8mm锛屽 46mm锛涘唴瀹� = 灏辫瘖娴佹按鍙� episodeId锛�
+//
+// 鈿狅笍銆愬崟浣嶅潙路2026-11-28 瀹炴祴銆慼iprint 鐨� **闈㈡澘**灏哄 `addPrintPanel({width,height})` 鐢� **mm**锛�
+// 浣�**鍏冪礌**鐨� `top/left/width/height` 鐢� **pt**锛堟簮鐮侊細`options.displayLeft()` 杩斿洖 `left+"pt"`锛�
+// 鍏冪礌榛樿 height=9.75 / width=120 涔熼兘鏄� pt锛夈�傜涓�鐗堟妸鍏冪礌鍧愭爣涔熷綋 mm 浼犲叆锛�0.6/5/8.8鈥︼級锛�
+// 缁撴灉 27.4"mm" 瀹為檯鍙湁 27.4pt鈮�9.7mm 鈬� 鎵�鏈夋枃瀛�/鏉$爜鎸ゅ湪鏍囩椤堕儴銆佷簰鐩搁噸鍙犮��
+// 鐜板湪缁熶竴锛�**甯冨眬浠嶆寜 mm 鍐�**锛岃繘鍏� hiprint 鍓嶇敤 mm2pt() 鎹㈢畻锛�1mm = 72/25.4 pt锛夈��
+// ============================================================================
+ const PAPER_W = 50 // 鏍囩绾稿 mm锛堥潰鏉垮崟浣�=mm锛�
+ const PAPER_H = 30 // 鏍囩绾搁珮 mm锛堥潰鏉垮崟浣�=mm锛�
+ /** 1mm = 2.83465pt */
+ const PT_PER_MM = 72 / 25.4
+ /** mm 鈫� pt锛堝厓绱犲潗鏍�/灏哄鐢級 */
+ const mm2pt = (v: number) => Math.round(v * PT_PER_MM * 100) / 100
+ // 銆愭墦鍗颁唤鏁般�戞寮忓彛寰� = 2 寮狅紙鎮h�� 1 寮� + 绉戝鐣欏瓨 1 寮狅級銆�
+ // 鎯虫敼浠芥暟鍙敼杩欎竴涓暟瀛楋細鏀� 1 = 娴嬭瘯鐪佺焊锛涙敼 3 = 涓夎仈銆�
+ const PRINT_COPIES = 2
+ var panel = hiprintTemplate.addPrintPanel({ width: PAPER_W, height: PAPER_H, paperNumberDisabled:true});
+
+ const FONT = '寰蒋闆呴粦'
+ /**
+ * 鍔犱竴琛屾枃鏈紙缁熶竴瀛椾綋/灞呬腑锛夈��
+ * 鍏ュ弬鍗曚綅锛�**mm**锛堝唴閮ㄦ崲绠楁垚 hiprint 闇�瑕佺殑 pt锛夛紱fontSize 鍗曚綅鏄� **pt**銆�
+ */
+ const addLine = (opts: {
+ top: number; left?: number; width?: number; height?: number;
+ title: string; fontSize?: number; bold?: boolean; align?: string;
+ }) => {
+ panel.addPrintText({
+ options: {
+ left: mm2pt(opts.left ?? 1),
+ top: mm2pt(opts.top),
+ width: mm2pt(opts.width ?? PAPER_W - 2),
+ height: mm2pt(opts.height ?? 3.6),
+ title: opts.title ?? '',
+ textAlign: opts.align ?? 'center',
+ fontSize: opts.fontSize ?? 8,
+ fontFamily: FONT,
+ fontWeight: opts.bold === false ? '400' : '700'
+ }
+ })
+ }
+
+// 鈶� 妫�鏌ラ」鐩紙y 0.8~5.4mm锛�
const checkTypeName = getCheckTypeName(curAppointment.bookCheckType)
- panel.addPrintText({ options: { width: 140, height: 12, top: 2, left: 20, title: checkTypeName, textAlign: 'center', fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
+ addLine({ top: 0.8, height: 4.6, title: checkTypeName, fontSize: 10 })
+// 鈶� 濮撳悕 鎬у埆 骞撮緞锛坹 5.6~9.6mm锛�
const patientBaisc = curAppointment.patName + " " + calGender(curAppointment.patGender) + " " + calculateAge(curAppointment.patBirthday) + "宀�"
- panel.addPrintText({ options: { width: 140, height: 12, top: 16, left: 20, title: patientBaisc, textAlign: 'center' , fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
- const ward_bed = curAppointment.patWardDesc + "-" + curAppointment.patBedNo
- panel.addPrintText({ options: { width: 140, height: 12, top: 30, left: 20, title: ward_bed, textAlign: 'center', fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
- const bookTime = formatTimestamp(curAppointment.bookDate) + " " + getBookBeginTime(curAppointment.bookTimeslot)
- panel.addPrintText({ options: { width: 140, height: 12, top: 44, left: 20, title: bookTime, textAlign: 'center', fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
- panel.addPrintText({ options: { width: 140, height: 12, top: 58, left: 20, title: curAppointment.patId, textAlign: 'center', fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
- panel.addPrintText({ options: { width: 140, height: 12, top: 72, left: 20, title: curAppointment.patMobile, textAlign: 'center', fontSize: 10, fontFamily: '寰蒋闆呴粦', fontWeight: '700', } });
- //鏉″舰鐮�
- panel.addPrintText({ options: { width: 140, height: 22, top: 86, left: 20, title: curAppointment.episodeId, textType: 'barcode' } });
+ addLine({ top: 5.6, height: 4.0, title: patientBaisc, fontSize: 9 })
+// 鈶� 鐥呭尯-搴婂彿 | 棰勭害鏃堕棿锛坹 10.0~13.6mm锛�"2026-11-28 08:00" 缂╂垚 "11-28 08:00"锛�
+ const ward_bed = (curAppointment.patWardDesc || '') + (curAppointment.patBedNo ? "-" + curAppointment.patBedNo : '')
+ addLine({ top: 10.0, height: 3.6, left: 1.5, width: 22, title: ward_bed, fontSize: 7.5 })
+ const bookTime = formatTimestamp(curAppointment.bookDate).slice(5) + " " + getBookBeginTime(curAppointment.bookTimeslot)
+ addLine({ top: 10.0, height: 3.6, left: 24, width: 25, title: bookTime, fontSize: 7.5 })
+// 鈶� 鎮h�呯紪鍙� | 鎵嬫満鍙凤紙y 14.0~17.6mm锛�
+ addLine({ top: 14.0, height: 3.6, left: 1.5, width: 22, title: curAppointment.patId ?? '', fontSize: 7.5 })
+ addLine({ top: 14.0, height: 3.6, left: 24, width: 25, title: curAppointment.patMobile ?? '', fontSize: 7.5 })
+// 鈶� 鏉″舰鐮侊紙鍐呭 = 灏辫瘖娴佹按鍙凤紱鍧愭爣鍚屾牱 mm鈫抪t锛�
+//
+// 銆�"娌″眳涓�"銆戔憼 鍏冪礌鎸夊唴瀹圭畻瀹藉悗 `left = (50-w)/2` 绮剧‘灞呬腑锛�
+// 鈶� hiprint 鐨勬潯褰� svg 鏄� `width:100%`锛屽搴﹂殢鍏冪礌璧帮紝鎵�浠ュ厓绱犲搴︿笉鑳介殢鎵嬬粰銆�
+// 銆�"鏁板�煎お浣�"銆慼iprint 鏉$爜鍏冪礌鍐呴儴鏄細
+// <svg class="hibarcode_imgcode" width=100% height=100%> + <div class="hibarcode_displayValue">鏁板��</div>
+// 鏉″舰鍗犳弧鍏冪礌楂樺害锛屾暟鍊� div 鎺掑湪鍏冪礌鐩掑瓙**涔嬩笅**锛屽厓绱犱竴楂樻暟鍊煎氨琚帹鍒扮焊杈癸紙鐢氳嚦浼氭帀鍒扮浜岄〉/琚锛夈��
+// 鍥犳杩欓噷锛�**鍏虫帀瀹冭嚜甯︾殑鏁板�硷紙hideTitle锛�**锛屾敼鐢辨垜浠嚜宸辩揣璐存潯鐮佺敾涓�琛屽眳涓暟鍊硷紙浣嶇疆鍙帶锛夈��
+ const barcodeText = curAppointment.episodeId ?? ''
+ const isPureDigits = /^\d+$/.test(barcodeText)
+ // CODE128 妯″潡鏁帮細璧峰 11 + 鏁版嵁 + 鏍¢獙 11 + 缁堟 13锛�
+ // 绾暟瀛楀伓鏁颁綅璧� CODE128-C锛�2 浣�/绗﹀彿锛夛紝鍚﹀垯璧� CODE128-B锛�1 浣�/绗﹀彿锛�
+ const barcodeModules = isPureDigits && barcodeText.length % 2 === 0
+ ? 11 + (barcodeText.length / 2) * 11 + 11 + 13
+ : 11 + barcodeText.length * 11 + 11 + 13
+ // JsBarcode 閲� 1 妯″潡 = 1px 鈮� 0.2646mm锛�+1mm 浣欓噺锛屽苟闄愬埗鍦� 18~40mm锛堝お绐勪細绯娿�佸お瀹借秴鍑虹焊闈級
+ const barcodeWidthMm = Math.min(40, Math.max(18, barcodeModules * 0.2646 + 1))
+ const barcodeLeftMm = (PAPER_W - barcodeWidthMm) / 2
+ const BARCODE_TOP = 17.4 // 鏉″舰璧峰
+ const BARCODE_H = 8.2 // 鏉″舰楂樺害锛�203dpi 鈮� 66 鐐归珮锛屾壂鐮佽冻澶燂級
+ panel.addPrintText({
+ options: {
+ left: mm2pt(barcodeLeftMm),
+ top: mm2pt(BARCODE_TOP),
+ width: mm2pt(barcodeWidthMm),
+ height: mm2pt(BARCODE_H),
+ title: barcodeText,
+ textType: 'barcode',
+ hideTitle: true // 涓嶈 hiprint 鑷甫鐨勬暟鍊硷紙瀹冨湪鍏冪礌涓嬫柟锛屼細鎶婂唴瀹归《鍑虹焊闈級
+ }
+ });
+ // 鈶�-2 鏁板�硷細绱ц创鏉$爜涓嬫柟 0.9mm锛屽眳涓紙涓庢潯鐮佸悓瀹斤紝瓒呭嚭浼氳鎴柇锛�
+ addLine({ top: BARCODE_TOP + BARCODE_H + 0.9, height: 3.0, title: barcodeText, fontSize: 7.5 })
//鎵撳嵃
- if (printMode == null)
- hiprintTemplate.print2([{},{},{}]); // 棰勮鏂瑰紡 鍙互浼� [瀹氫綅鍙傛暟] http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
- else
- hiprintTemplate.print([{},{},{}]);
+// 銆愭湰娆′慨澶嶃�戜紭鍏�"闈欓粯鎵撳嵃"锛堥渶瑕佹湰鏈� hiprint 鎵撳嵃瀹㈡埛绔級锛�
+// 瀹㈡埛绔湭杩炴帴/鏈畨瑁呮椂**鍥為��娴忚鍣ㄦ墦鍗�**锛堝脊鎵撳嵃瀵硅瘽妗嗭級锛岄伩鍏嶅彧鎶ャ�岃繛鎺ュ鎴风澶辫触銆嶈�屾墦涓嶅嚭绁ㄣ��
+// 路 printMode == null 鈫� 鏈熸湜闈欓粯鎵撳嵃锛堟湰鏈烘湁瀹㈡埛绔椂锛�
+// 路 printMode != null 鈫� 鏄庣‘瑕佹眰娴忚鍣ㄦ墦鍗帮紙鍘熼�昏緫淇濈暀锛�
+//
+// 銆愭墦鍗颁唤鏁般�慼iprint 鐨勫叆鍙傛暟缁勯暱搴� = 椤垫暟锛堟瘡鍏冪礌涓�椤碉級銆�
+// 姝e紡鍙e緞 = 2 寮狅紱浠芥暟鍙湪 PRINT_COPIES 涓�澶勭淮鎶わ紙1=娴嬭瘯鐪佺焊锛�3=涓夎仈锛夈��
+ const pages: any[] = Array.from({ length: PRINT_COPIES }, () => ({}))
+ if (printMode == null && (await waitPrintClientOpened(hiprintTemplate))) {
+ hiprintTemplate.print2(pages); // 闈欓粯鎵撳嵃锛堟湰鏈哄鎴风锛� 鍙紶 [瀹氫綅鍙傛暟] http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
+ } else {
+ console.info('[printBill] 鎵撳嵃瀹㈡埛绔湭灏辩华锛屽洖閫�涓烘祻瑙堝櫒鎵撳嵃锛屼唤鏁�=' + PRINT_COPIES)
+ hiprintTemplate.print(pages);
+ }
}
/* hiprint 绀轰緥
// 寮曞叆鍚庝娇鐢ㄧず渚�
--
Gitblit v1.9.3