fix(web): Phase 3 前端 UX/i18n 修复 — 名称解析/确认对话框/日历切换/删除替换
- ConsultationList: 批量解析患者/医生名称替代截断 UUID - PointsOrderList: 使用 product_name + 批量解析患者/核销人名称 - AppointmentList: 破坏性状态变更添加 Modal.confirm + 取消原因收集 - CalendarView: 添加 onPanelChange 回调支持月份切换 - DoctorSchedule: 日历视图切换月份自动刷新数据 - PointsRuleList: 移除无效删除按钮,Switch 添加启用/停用文字 - PointsProductList: 删除按钮替换为上架/下架 Switch - PatientSelect: 性别显示中文化 (male→男, female→女) - VitalSignsChart: API 失败时显示 Alert 错误提示 - PointsOrder 类型: 添加 product_name 字段
This commit is contained in:
@@ -108,16 +108,60 @@ export default function AppointmentList() {
|
||||
}, [fetchData]);
|
||||
|
||||
// ---- 状态变更 ----
|
||||
const handleStatusChange = async (record: Appointment, newStatus: string) => {
|
||||
try {
|
||||
await appointmentApi.updateStatus(record.id, {
|
||||
status: newStatus,
|
||||
version: record.version,
|
||||
const DESTRUCTIVE_STATUSES = new Set(['cancelled', 'no_show']);
|
||||
|
||||
const handleStatusChange = (record: Appointment, newStatus: string) => {
|
||||
const transition = STATUS_TRANSITIONS[record.status]?.find((t) => t.value === newStatus);
|
||||
if (!transition) return;
|
||||
|
||||
if (DESTRUCTIVE_STATUSES.has(newStatus)) {
|
||||
let cancelReason = '';
|
||||
Modal.confirm({
|
||||
title: `确认${transition.label}`,
|
||||
content: newStatus === 'cancelled' ? (
|
||||
<Input.TextArea
|
||||
rows={3}
|
||||
placeholder="请输入取消原因"
|
||||
onChange={(e) => { cancelReason = e.target.value; }}
|
||||
/>
|
||||
) : (
|
||||
<span>确定将此预约标记为"{transition.label}"?</span>
|
||||
),
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await appointmentApi.updateStatus(record.id, {
|
||||
status: newStatus,
|
||||
version: record.version,
|
||||
...(newStatus === 'cancelled' && { cancel_reason: cancelReason }),
|
||||
});
|
||||
message.success('状态更新成功');
|
||||
fetchData(page, pageSize);
|
||||
} catch {
|
||||
message.error('状态更新失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
Modal.confirm({
|
||||
title: `确认${transition.label}`,
|
||||
content: `确定将此预约状态变更为"${transition.label}"?`,
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await appointmentApi.updateStatus(record.id, {
|
||||
status: newStatus,
|
||||
version: record.version,
|
||||
});
|
||||
message.success('状态更新成功');
|
||||
fetchData(page, pageSize);
|
||||
} catch {
|
||||
message.error('状态更新失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
message.success('状态更新成功');
|
||||
fetchData(page, pageSize);
|
||||
} catch {
|
||||
message.error('状态更新失败');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user