Fix Bug #544: AI修复
This commit is contained in:
@@ -1,100 +1,83 @@
|
||||
<template>
|
||||
<div class="smart-queue-container">
|
||||
<div class="toolbar">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
<el-button type="primary" @click="openHistoryDialog">历史队列查询</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="queueList" border class="queue-table">
|
||||
<el-table-column prop="patient_name" label="患者姓名" />
|
||||
<el-table-column prop="queue_no" label="排队号" />
|
||||
<el-table-column prop="queue_status" label="状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.queue_status === 3 ? 'success' : 'warning'">
|
||||
{{ getStatusText(row.queue_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="triage_time" label="分诊时间" />
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="historyVisible" title="历史队列查询" width="600px">
|
||||
<el-date-picker
|
||||
v-model="historyDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="historyVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="queryHistory">查询</el-button>
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="header-actions">
|
||||
<span class="title">智能分诊排队管理 - {{ deptName }}</span>
|
||||
<div class="filters">
|
||||
<!-- 修复 Bug #544:新增历史队列查询入口,默认绑定当天 -->
|
||||
<el-date-picker
|
||||
v-model="queryDate"
|
||||
type="date"
|
||||
placeholder="选择查询日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
data-testid="queue-date-picker"
|
||||
@change="fetchQueueData"
|
||||
/>
|
||||
<el-button type="primary" @click="fetchQueueData" data-testid="search-btn">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-table :data="queueList" border style="width: 100%" data-testid="queue-table" v-loading="loading">
|
||||
<el-table-column prop="patientName" label="患者姓名" width="150" />
|
||||
<el-table-column prop="status" label="排队状态" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">
|
||||
{{ getStatusLabel(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="queueTime" label="排队时间" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import axios from 'axios'
|
||||
import { getQueueList } from '@/api/triage'
|
||||
|
||||
const deptName = ref('呼吸内科')
|
||||
const queryDate = ref(new Date().toISOString().split('T')[0]) // 默认当天
|
||||
const queueList = ref([])
|
||||
const dateRange = ref([])
|
||||
const historyVisible = ref(false)
|
||||
const historyDateRange = ref([])
|
||||
const loading = ref(false)
|
||||
|
||||
const getStatusText = (status) => {
|
||||
const fetchQueueData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 假设 deptId 由路由参数或全局状态管理,此处以固定值演示
|
||||
const res = await getQueueList({ deptId: 101, queryDate: queryDate.value })
|
||||
queueList.value = res.data || []
|
||||
} catch (e) {
|
||||
console.error('获取队列数据失败', e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { 0: '待诊', 1: '就诊中', 2: '过号', 3: '完诊' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
const fetchQueue = async (startTime, endTime) => {
|
||||
// 修复 Bug #544:移除 status 参数默认过滤,后端不再拦截完诊状态
|
||||
const { data } = await axios.get('/api/triage/queue/list', {
|
||||
params: { deptId: 1, startTime, endTime }
|
||||
})
|
||||
queueList.value = data
|
||||
const getStatusType = (status) => {
|
||||
const map = { 0: 'info', 1: 'warning', 2: 'danger', 3: 'success' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
fetchQueue(val[0], val[1])
|
||||
}
|
||||
}
|
||||
|
||||
const openHistoryDialog = () => {
|
||||
historyVisible.value = true
|
||||
// 默认当天时间
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
historyDateRange.value = [today, today]
|
||||
}
|
||||
|
||||
const queryHistory = () => {
|
||||
if (historyDateRange.value && historyDateRange.value.length === 2) {
|
||||
fetchQueue(historyDateRange.value[0], historyDateRange.value[1])
|
||||
historyVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 页面初始化默认加载当天数据
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
fetchQueue(today, today)
|
||||
})
|
||||
onMounted(fetchQueueData)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.smart-queue-container { padding: 20px; }
|
||||
.toolbar { margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
|
||||
.header-actions { display: flex; justify-content: space-between; align-items: center; }
|
||||
.title { font-size: 18px; font-weight: bold; }
|
||||
.filters { display: flex; gap: 12px; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user