From e6dff096a9e94d1a5323e82f74bc1368ff7a72d6 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 12 九月 2024 13:47:17 +0800
Subject: [PATCH] 装机 作业列表
---
src/views/ecg/callingscreen/bigscreen.vue | 69 +++++++++++++++++++++++++++-------
1 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/src/views/ecg/callingscreen/bigscreen.vue b/src/views/ecg/callingscreen/bigscreen.vue
index c9095e4..63d3f40 100644
--- a/src/views/ecg/callingscreen/bigscreen.vue
+++ b/src/views/ecg/callingscreen/bigscreen.vue
@@ -1,5 +1,6 @@
<script setup lang="ts">
+import dayjs from 'dayjs'
import {ScreenApi, statusMap, CallingVO} from "@/api/ecg/screen";
defineOptions({ name: 'bigscreen' })
@@ -7,6 +8,10 @@
const listReady = ref<CallingVO[]>([]) // 鍒楄〃鐨勬暟鎹�
const listWaiting = ref<CallingVO[]>([]) // 鍒楄〃鐨勬暟鎹�
const listPassed = ref<CallingVO[]>([]) //
+
+let curSpeakPat : CallingVO | undefined = undefined;
+let curSpeakSeqNum : number = 0
+let curWorkDay : Date | undefined = undefined
const getList = async () => {
const data = await ScreenApi.getBigScreenData()
@@ -17,18 +22,52 @@
const startScrolling = () => {
setInterval(() => {
- // console.info("...")
getList();
- }, 3000); // 姣忎袱绉掓粴鍔ㄤ竴娆�
+ if ( curSpeakPat === undefined ) {
+ initiateSpeak()
+ }
+ }, 5000); // 姣廥绉掓粴鍔ㄤ竴娆�
}
onMounted( () => {
startScrolling()
})
+const onSpeachEndEvent = async (event) => {
+ console.log("Speech ended" + event);
+ await ScreenApi.markCalled(curSpeakPat!.patId)
+ initiateSpeak()
+}
+
+const getNextSpeak = () => {
+ if (listReady.value.length === 0) {
+ return undefined;
+ }
+
+ // TODO 澶勭悊姣忓ぉ 鍙嶈浆鐨勬儏鍐�
+ if ( curWorkDay === undefined) {
+ curSpeakSeqNum = 0;
+ curWorkDay = new Date()
+ } else if (!isSameDate(dayjs(listReady.value[0].bookDate).toDate(), curWorkDay)) {
+ curSpeakSeqNum = 0;
+ curWorkDay = dayjs(listReady.value[0].bookDate).toDate()
+ }
+
+ return listReady.value.find( item => item.status === 30 && item.called === 0 && item.seqNum > curSpeakSeqNum)
+}
+
+const initiateSpeak = () => {
+ const queuePat = getNextSpeak()
+ if (queuePat !== undefined) {
+ curSpeakPat = queuePat
+ curSpeakSeqNum = curSpeakPat.seqNum
+ speak(queuePat.patName + queuePat.roomName);
+ } else {
+ curSpeakPat = undefined
+ }
+}
+
const speak = (msg) => {
- //const msg = new SpeechSynthesisUtterance(`璇�${this.currentNumber}鍙峰氨璇奰);
- const repeatNum = 3
var speech = new SpeechSynthesisUtterance()
speech.text = msg
speech.pitch = 1 // 鑾峰彇骞惰缃瘽璇殑闊宠皟(0-2 榛樿1锛屽�艰秺澶ц秺灏栭攼,瓒婁綆瓒婁綆娌�)
@@ -36,17 +75,17 @@
speech.volume = 100 // 鑾峰彇骞惰缃璇濈殑闊抽噺
speech.lang = 'zh-CN' // 璁剧疆鎾斁璇█
- utterance.onend = function() {
- console.log("Speech ended");
- };
-
- // 澧炲姞鎺у埗鎾斁娆℃暟
- let count = 1
+ speech.onend = onSpeachEndEvent
speechSynthesis.speak(speech)
- while (count < repeatNum) {
- speechSynthesis.speak(speech)
- count++
- }
+}
+
+const isSameDate = ( date1: Date, date2 : Date) => {
+ if (date1.getFullYear() === date2.getFullYear()
+ && date1.getMonth() === date2.getMonth()
+ && date1.getDate() === date2.getDate())
+ return true
+ else
+ return false
}
</script>
@@ -90,7 +129,7 @@
</el-table-column>
</el-table>
</el-main>
- <el-footer>
+ <el-footer height="100px">
<el-table
:data="listPassed"
stripe
--
Gitblit v1.9.3