Fix Bug #544: AI修复
This commit is contained in:
@@ -1,132 +1,80 @@
|
||||
<template>
|
||||
<div class="triage-queue-container">
|
||||
<el-card class="filter-card">
|
||||
<el-form :inline="true" :model="queryParams" class="demo-form-inline">
|
||||
<el-form-item label="科室">
|
||||
<el-select v-model="queryParams.deptId" placeholder="请选择科室" clearable>
|
||||
<el-option label="呼吸内科" :value="101" />
|
||||
<el-option label="全科" :value="102" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="queryParams.status" placeholder="全部状态" clearable>
|
||||
<el-option label="待诊" value="0" />
|
||||
<el-option label="就诊中" value="1" />
|
||||
<el-option label="完诊" value="2" />
|
||||
<el-option label="过号" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
class="date-range-picker"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<div class="queue-management-container">
|
||||
<el-form :inline="true" :model="queryParams" class="search-form">
|
||||
<el-form-item label="日期范围">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-card class="table-card">
|
||||
<el-table :data="tableData" border style="width: 100%" class="queue-table">
|
||||
<el-table-column prop="patient_name" label="患者姓名" width="120" />
|
||||
<el-table-column prop="queue_status" label="排队状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.queue_status)">
|
||||
{{ getStatusLabel(row.queue_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_time" label="入队时间" width="180" />
|
||||
<el-table-column prop="update_time" label="状态更新时间" width="180" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default>
|
||||
<el-button link type="primary">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-table :data="queueList" border style="width: 100%">
|
||||
<el-table-column prop="patientName" label="患者姓名" />
|
||||
<el-table-column prop="status" label="排队状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="queueTime" label="排队时间" />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getQueueList } from '@/api/triage'
|
||||
|
||||
const queryParams = reactive({
|
||||
deptId: null,
|
||||
status: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
});
|
||||
const queryParams = ref({ deptId: 1, startDate: null, endDate: null })
|
||||
const dateRange = ref([])
|
||||
const queueList = ref([])
|
||||
|
||||
const dateRange = ref([]);
|
||||
const tableData = ref([]);
|
||||
// 修复 Bug #544:默认加载当天时间范围
|
||||
const initDefaultDate = () => {
|
||||
const today = new Date()
|
||||
const start = new Date(today.getFullYear(), today.getMonth(), today.getDate())
|
||||
const end = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59)
|
||||
queryParams.value.startDate = start
|
||||
queryParams.value.endDate = end
|
||||
dateRange.value = [start.toISOString().split('T')[0], end.toISOString().split('T')[0]]
|
||||
}
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { '0': '待诊', '1': '就诊中', '2': '完诊', '3': '过号' };
|
||||
return map[status] || '未知';
|
||||
};
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryParams.value.startDate = new Date(val[0])
|
||||
queryParams.value.endDate = new Date(val[1] + ' 23:59:59')
|
||||
} else {
|
||||
queryParams.value.startDate = null
|
||||
queryParams.value.endDate = null
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = async () => {
|
||||
const res = await getQueueList(queryParams.value)
|
||||
queueList.value = res.data || []
|
||||
}
|
||||
|
||||
const getStatusType = (status) => {
|
||||
const map = { '0': 'info', '1': 'warning', '2': 'success', '3': 'danger' };
|
||||
return map[status] || 'info';
|
||||
};
|
||||
|
||||
const fetchQueueData = async () => {
|
||||
try {
|
||||
const params = {
|
||||
deptId: queryParams.deptId,
|
||||
status: queryParams.status,
|
||||
startDate: queryParams.startDate,
|
||||
endDate: queryParams.endDate
|
||||
};
|
||||
const res = await axios.get('/triage/queue/list', { params });
|
||||
tableData.value = res.data;
|
||||
} catch (error) {
|
||||
console.error('获取队列数据失败', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.startDate = dateRange.value[0];
|
||||
queryParams.endDate = dateRange.value[1];
|
||||
} else {
|
||||
queryParams.startDate = '';
|
||||
queryParams.endDate = '';
|
||||
}
|
||||
fetchQueueData();
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.deptId = null;
|
||||
queryParams.status = '';
|
||||
dateRange.value = [];
|
||||
queryParams.startDate = '';
|
||||
queryParams.endDate = '';
|
||||
fetchQueueData();
|
||||
};
|
||||
if (status === '完诊') return 'success'
|
||||
if (status === '就诊中') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 默认加载当天数据
|
||||
const today = new Date();
|
||||
const start = new Date(today.setHours(0, 0, 0, 0));
|
||||
const end = new Date(today.setHours(23, 59, 59, 999));
|
||||
dateRange.value = [start.toISOString().slice(0, 19).replace('T', ' '), end.toISOString().slice(0, 19).replace('T', ' ')];
|
||||
handleQuery();
|
||||
});
|
||||
initDefaultDate()
|
||||
handleQuery()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.triage-queue-container { padding: 20px; }
|
||||
.filter-card { margin-bottom: 20px; }
|
||||
.table-card { margin-top: 10px; }
|
||||
.queue-management-container { padding: 20px; }
|
||||
.search-form { margin-bottom: 20px; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user