Fix Bug #570: AI修复

This commit is contained in:
2026-05-27 08:43:35 +08:00
parent 74cd551e2b
commit fd7ee53a97
4 changed files with 226 additions and 26 deletions

View File

@@ -0,0 +1,104 @@
<template>
<div class="appointment-container">
<el-card class="filter-card">
<el-form :inline="true" class="query-form">
<el-form-item label="预约状态" class="status-filter">
<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>
<el-button type="primary" @click="handleQuery">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="table-card">
<template #header>
<div class="card-header">
<span>门诊预约挂号列表</span>
</div>
</template>
<el-table :data="slotList" border v-loading="loading">
<el-table-column prop="slotNo" label="号源编号" width="120" />
<el-table-column prop="doctorName" label="医生" width="120" />
<el-table-column prop="scheduleTime" label="就诊时间" width="180" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">{{ getStatusName(row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template #default="{ row }">
<el-button
v-if="row.status === 0"
type="primary"
size="small"
@click="handleBook(row.id)"
>预约</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import { getSlotList, bookSlot } from '@/api/outpatient';
const loading = ref(false);
const slotList = ref([]);
const queryParams = reactive({ status: null });
const statusMap = {
0: { name: '可预约', type: 'success' },
1: { name: '已预约', type: 'primary' },
2: { name: '已取消', type: 'info' },
3: { name: '已就诊', type: 'warning' }
};
const getStatusName = (code) => statusMap[code]?.name || '未知';
const getStatusType = (code) => statusMap[code]?.type || 'info';
const fetchList = async () => {
loading.value = true;
try {
const res = await getSlotList(queryParams);
slotList.value = res.data || [];
} catch (e) {
ElMessage.error('查询失败');
} finally {
loading.value = false;
}
};
const handleQuery = () => fetchList();
const resetQuery = () => {
queryParams.status = null;
fetchList();
};
const handleBook = async (slotId) => {
try {
await bookSlot(slotId);
ElMessage.success('预约成功');
fetchList();
} catch (e) {
ElMessage.error(e.message || '预约失败');
}
};
onMounted(() => fetchList());
</script>
<style scoped>
.appointment-container { padding: 20px; }
.filter-card { margin-bottom: 20px; }
.table-card { margin-top: 10px; }
</style>