From 1a5d6c5ac5f1d3903c2ed04b30e3a43a2d170f94 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 12 八月 2024 14:13:57 +0800
Subject: [PATCH] 新增 排队 查看功能
---
src/views/ecg/queue/queueForm.vue | 158 +++++++++++++++++
src/views/ecg/queue/index.vue | 302 +++++++++++++++++++++++++++++++++
src/api/ecg/queue/index.ts | 50 +++++
3 files changed, 510 insertions(+), 0 deletions(-)
diff --git a/src/api/ecg/queue/index.ts b/src/api/ecg/queue/index.ts
new file mode 100644
index 0000000..e702590
--- /dev/null
+++ b/src/api/ecg/queue/index.ts
@@ -0,0 +1,50 @@
+import request from '@/config/axios'
+
+// 鎺掗槦 VO
+export interface queueVO {
+ id: number // id
+ patId: string // 鎮h�呯紪鍙�
+ patName: string // 鎮h�呭鍚�
+ patGender: boolean // 鎮h�呮�у埆
+ bookTimeslot: number // 棰勭害鏃堕棿娈�
+ bookCheckType: boolean // 棰勭害妫�鏌ョ被鍨�
+ seqNum: number // 鎺掗槦搴忓彿
+ status: boolean // 10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡
+ passed: boolean // 杩囧彿鏍囪
+ expired: boolean // 棰勭害杩囨湡鏍囪
+ roomNum: string // 璇婂缂栧彿
+ bedNum: string // 璇婄枟搴婄紪鍙�
+}
+
+// 鎺掗槦 API
+export const queueApi = {
+ // 鏌ヨ鎺掗槦鍒嗛〉
+ getqueuePage: async (params: any) => {
+ return await request.get({ url: `/ecg/queue/page`, params })
+ },
+
+ // 鏌ヨ鎺掗槦璇︽儏
+ getqueue: async (id: number) => {
+ return await request.get({ url: `/ecg/queue/get?id=` + id })
+ },
+
+ // 鏂板鎺掗槦
+ createqueue: async (data: queueVO) => {
+ return await request.post({ url: `/ecg/queue/create`, data })
+ },
+
+ // 淇敼鎺掗槦
+ updatequeue: async (data: queueVO) => {
+ return await request.put({ url: `/ecg/queue/update`, data })
+ },
+
+ // 鍒犻櫎鎺掗槦
+ deletequeue: async (id: number) => {
+ return await request.delete({ url: `/ecg/queue/delete?id=` + id })
+ },
+
+ // 瀵煎嚭鎺掗槦 Excel
+ exportqueue: async (params) => {
+ return await request.download({ url: `/ecg/queue/export-excel`, params })
+ }
+}
\ No newline at end of file
diff --git a/src/views/ecg/queue/index.vue b/src/views/ecg/queue/index.vue
new file mode 100644
index 0000000..426d6f9
--- /dev/null
+++ b/src/views/ecg/queue/index.vue
@@ -0,0 +1,302 @@
+<template>
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ class="-mb-15px"
+ :model="queryParams"
+ ref="queryFormRef"
+ :inline="true"
+ label-width="68px"
+ >
+ <el-form-item label="鎮h�呯紪鍙�" prop="patId">
+ <el-input
+ v-model="queryParams.patId"
+ placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="鎮h�呭鍚�" prop="patName">
+ <el-input
+ v-model="queryParams.patName"
+ placeholder="璇疯緭鍏ユ偅鑰呭鍚�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="鎮h�呮�у埆" prop="patGender">
+ <el-select
+ v-model="queryParams.patGender"
+ placeholder="璇烽�夋嫨鎮h�呮�у埆"
+ clearable
+ class="!w-240px"
+ >
+ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="棰勭害鏃堕棿娈�" prop="bookTimeslot">
+ <el-input
+ v-model="queryParams.bookTimeslot"
+ placeholder="璇疯緭鍏ラ绾︽椂闂存"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="棰勭害妫�鏌ョ被鍨�" prop="bookCheckType">
+ <el-select
+ v-model="queryParams.bookCheckType"
+ placeholder="璇烽�夋嫨棰勭害妫�鏌ョ被鍨�"
+ clearable
+ class="!w-240px"
+ >
+ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鎺掗槦搴忓彿" prop="seqNum">
+ <el-input
+ v-model="queryParams.seqNum"
+ placeholder="璇疯緭鍏ユ帓闃熷簭鍙�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡" prop="status">
+ <el-select
+ v-model="queryParams.status"
+ placeholder="璇烽�夋嫨10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡"
+ clearable
+ class="!w-240px"
+ >
+ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="杩囧彿鏍囪" prop="passed">
+ <el-select
+ v-model="queryParams.passed"
+ placeholder="璇烽�夋嫨杩囧彿鏍囪"
+ clearable
+ class="!w-240px"
+ >
+ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="棰勭害杩囨湡鏍囪" prop="expired">
+ <el-select
+ v-model="queryParams.expired"
+ placeholder="璇烽�夋嫨棰勭害杩囨湡鏍囪"
+ clearable
+ class="!w-240px"
+ >
+ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="璇婂缂栧彿" prop="roomNum">
+ <el-input
+ v-model="queryParams.roomNum"
+ placeholder="璇疯緭鍏ヨ瘖瀹ょ紪鍙�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="璇婄枟搴婄紪鍙�" prop="bedNum">
+ <el-input
+ v-model="queryParams.bedNum"
+ placeholder="璇疯緭鍏ヨ瘖鐤楀簥缂栧彿"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿" prop="createTime">
+ <el-date-picker
+ v-model="queryParams.createTime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ type="daterange"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+ class="!w-220px"
+ />
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+ <el-button
+ type="primary"
+ plain
+ @click="openForm('create')"
+ v-hasPermi="['ecg:queue:create']"
+ >
+ <Icon icon="ep:plus" class="mr-5px" /> 鏂板
+ </el-button>
+ <el-button
+ type="success"
+ plain
+ @click="handleExport"
+ :loading="exportLoading"
+ v-hasPermi="['ecg:queue:export']"
+ >
+ <Icon icon="ep:download" class="mr-5px" /> 瀵煎嚭
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+ <el-table-column label="id" align="center" prop="id" />
+ <el-table-column label="鎮h�呯紪鍙�" align="center" prop="patId" />
+ <el-table-column label="鎮h�呭鍚�" align="center" prop="patName" />
+ <el-table-column label="鎮h�呮�у埆" align="center" prop="patGender" />
+ <el-table-column label="棰勭害鏃堕棿娈�" align="center" prop="bookTimeslot" />
+ <el-table-column label="棰勭害妫�鏌ョ被鍨�" align="center" prop="bookCheckType" />
+ <el-table-column label="鎺掗槦搴忓彿" align="center" prop="seqNum" />
+ <el-table-column label="10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡" align="center" prop="status" />
+ <el-table-column label="杩囧彿鏍囪" align="center" prop="passed" />
+ <el-table-column label="棰勭害杩囨湡鏍囪" align="center" prop="expired" />
+ <el-table-column label="璇婂缂栧彿" align="center" prop="roomNum" />
+ <el-table-column label="璇婄枟搴婄紪鍙�" align="center" prop="bedNum" />
+ <el-table-column
+ label="鍒涘缓鏃堕棿"
+ align="center"
+ prop="createTime"
+ :formatter="dateFormatter"
+ width="180px"
+ />
+ <el-table-column label="鎿嶄綔" align="center" min-width="120px">
+ <template #default="scope">
+ <el-button
+ link
+ type="primary"
+ @click="openForm('update', scope.row.id)"
+ v-hasPermi="['ecg:queue:update']"
+ >
+ 缂栬緫
+ </el-button>
+ <el-button
+ link
+ type="danger"
+ @click="handleDelete(scope.row.id)"
+ v-hasPermi="['ecg:queue:delete']"
+ >
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+ <queueForm ref="formRef" @success="getList" />
+</template>
+
+<script setup lang="ts">
+import { dateFormatter } from '@/utils/formatTime'
+import download from '@/utils/download'
+import { queueApi, queueVO } from '@/api/ecg/queue'
+import queueForm from './queueForm.vue'
+
+/** 鎺掗槦 鍒楄〃 */
+defineOptions({ name: 'queue' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const list = ref<queueVO[]>([]) // 鍒楄〃鐨勬暟鎹�
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ patId: undefined,
+ patName: undefined,
+ patGender: undefined,
+ bookTimeslot: undefined,
+ bookCheckType: undefined,
+ seqNum: undefined,
+ status: undefined,
+ passed: undefined,
+ expired: undefined,
+ roomNum: undefined,
+ bedNum: undefined,
+ createTime: []
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await queueApi.getqueuePage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+ formRef.value.open(type, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+ try {
+ // 鍒犻櫎鐨勪簩娆$‘璁�
+ await message.delConfirm()
+ // 鍙戣捣鍒犻櫎
+ await queueApi.deletequeue(id)
+ message.success(t('common.delSuccess'))
+ // 鍒锋柊鍒楄〃
+ await getList()
+ } catch {}
+}
+
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+const handleExport = async () => {
+ try {
+ // 瀵煎嚭鐨勪簩娆$‘璁�
+ await message.exportConfirm()
+ // 鍙戣捣瀵煎嚭
+ exportLoading.value = true
+ const data = await queueApi.exportqueue(queryParams)
+ download.excel(data, '鎺掗槦.xls')
+ } catch {
+ } finally {
+ exportLoading.value = false
+ }
+}
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+ getList()
+})
+</script>
\ No newline at end of file
diff --git a/src/views/ecg/queue/queueForm.vue b/src/views/ecg/queue/queueForm.vue
new file mode 100644
index 0000000..b36225c
--- /dev/null
+++ b/src/views/ecg/queue/queueForm.vue
@@ -0,0 +1,158 @@
+<template>
+ <Dialog :title="dialogTitle" v-model="dialogVisible">
+ <el-form
+ ref="formRef"
+ :model="formData"
+ :rules="formRules"
+ label-width="100px"
+ v-loading="formLoading"
+ >
+ <el-form-item label="鎮h�呯紪鍙�" prop="patId">
+ <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" />
+ </el-form-item>
+ <el-form-item label="鎮h�呭鍚�" prop="patName">
+ <el-input v-model="formData.patName" placeholder="璇疯緭鍏ユ偅鑰呭鍚�" />
+ </el-form-item>
+ <el-form-item label="鎮h�呮�у埆" prop="patGender">
+ <el-radio-group v-model="formData.patGender">
+ <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="棰勭害鏃堕棿娈�" prop="bookTimeslot">
+ <el-input v-model="formData.bookTimeslot" placeholder="璇疯緭鍏ラ绾︽椂闂存" />
+ </el-form-item>
+ <el-form-item label="棰勭害妫�鏌ョ被鍨�" prop="bookCheckType">
+ <el-radio-group v-model="formData.bookCheckType">
+ <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="鎺掗槦搴忓彿" prop="seqNum">
+ <el-input v-model="formData.seqNum" placeholder="璇疯緭鍏ユ帓闃熷簭鍙�" />
+ </el-form-item>
+ <el-form-item label="10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡" prop="status">
+ <el-radio-group v-model="formData.status">
+ <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="杩囧彿鏍囪" prop="passed">
+ <el-radio-group v-model="formData.passed">
+ <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="棰勭害杩囨湡鏍囪" prop="expired">
+ <el-radio-group v-model="formData.expired">
+ <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="璇婂缂栧彿" prop="roomNum">
+ <el-input v-model="formData.roomNum" placeholder="璇疯緭鍏ヨ瘖瀹ょ紪鍙�" />
+ </el-form-item>
+ <el-form-item label="璇婄枟搴婄紪鍙�" prop="bedNum">
+ <el-input v-model="formData.bedNum" placeholder="璇疯緭鍏ヨ瘖鐤楀簥缂栧彿" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="submitForm" type="primary" :disabled="formLoading">纭� 瀹�</el-button>
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ </template>
+ </Dialog>
+</template>
+<script setup lang="ts">
+import { queueApi, queueVO } from '@/api/ecg/queue'
+
+/** 鎺掗槦 琛ㄥ崟 */
+defineOptions({ name: 'queueForm' })
+
+const { t } = useI18n() // 鍥介檯鍖�
+const message = useMessage() // 娑堟伅寮圭獥
+
+const dialogVisible = ref(false) // 寮圭獥鐨勬槸鍚﹀睍绀�
+const dialogTitle = ref('') // 寮圭獥鐨勬爣棰�
+const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤
+const formType = ref('') // 琛ㄥ崟鐨勭被鍨嬶細create - 鏂板锛泆pdate - 淇敼
+const formData = ref({
+ id: undefined,
+ patId: undefined,
+ patName: undefined,
+ patGender: undefined,
+ bookTimeslot: undefined,
+ bookCheckType: undefined,
+ seqNum: undefined,
+ status: undefined,
+ passed: undefined,
+ expired: undefined,
+ roomNum: undefined,
+ bedNum: undefined
+})
+const formRules = reactive({
+ patId: [{ required: true, message: '鎮h�呯紪鍙蜂笉鑳戒负绌�', trigger: 'blur' }],
+ patName: [{ required: true, message: '鎮h�呭鍚嶄笉鑳戒负绌�', trigger: 'blur' }],
+ bookTimeslot: [{ required: true, message: '棰勭害鏃堕棿娈典笉鑳戒负绌�', trigger: 'blur' }],
+ seqNum: [{ required: true, message: '鎺掗槦搴忓彿涓嶈兘涓虹┖', trigger: 'blur' }],
+ status: [{ required: true, message: '10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡涓嶈兘涓虹┖', trigger: 'blur' }],
+ passed: [{ required: true, message: '杩囧彿鏍囪涓嶈兘涓虹┖', trigger: 'blur' }],
+ expired: [{ required: true, message: '棰勭害杩囨湡鏍囪涓嶈兘涓虹┖', trigger: 'blur' }]
+})
+const formRef = ref() // 琛ㄥ崟 Ref
+
+/** 鎵撳紑寮圭獥 */
+const open = async (type: string, id?: number) => {
+ dialogVisible.value = true
+ dialogTitle.value = t('action.' + type)
+ formType.value = type
+ resetForm()
+ // 淇敼鏃讹紝璁剧疆鏁版嵁
+ if (id) {
+ formLoading.value = true
+ try {
+ formData.value = await queueApi.getqueue(id)
+ } finally {
+ formLoading.value = false
+ }
+ }
+}
+defineExpose({ open }) // 鎻愪緵 open 鏂规硶锛岀敤浜庢墦寮�寮圭獥
+
+/** 鎻愪氦琛ㄥ崟 */
+const emit = defineEmits(['success']) // 瀹氫箟 success 浜嬩欢锛岀敤浜庢搷浣滄垚鍔熷悗鐨勫洖璋�
+const submitForm = async () => {
+ // 鏍¢獙琛ㄥ崟
+ await formRef.value.validate()
+ // 鎻愪氦璇锋眰
+ formLoading.value = true
+ try {
+ const data = formData.value as unknown as queueVO
+ if (formType.value === 'create') {
+ await queueApi.createqueue(data)
+ message.success(t('common.createSuccess'))
+ } else {
+ await queueApi.updatequeue(data)
+ message.success(t('common.updateSuccess'))
+ }
+ dialogVisible.value = false
+ // 鍙戦�佹搷浣滄垚鍔熺殑浜嬩欢
+ emit('success')
+ } finally {
+ formLoading.value = false
+ }
+}
+
+/** 閲嶇疆琛ㄥ崟 */
+const resetForm = () => {
+ formData.value = {
+ id: undefined,
+ patId: undefined,
+ patName: undefined,
+ patGender: undefined,
+ bookTimeslot: undefined,
+ bookCheckType: undefined,
+ seqNum: undefined,
+ status: undefined,
+ passed: undefined,
+ expired: undefined,
+ roomNum: undefined,
+ bedNum: undefined
+ }
+ formRef.value?.resetFields()
+}
+</script>
\ No newline at end of file
--
Gitblit v1.9.3