更新
This commit is contained in:
@@ -152,7 +152,7 @@
|
|||||||
<div >{{ row.gender_desc || '-' }} · {{ row.age ?? '-' }}岁</div>
|
<div >{{ row.gender_desc || '-' }} · {{ row.age ?? '-' }}岁</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="挂号" min-width="150">
|
<el-table-column label="挂号" min-width="175">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div
|
<div
|
||||||
class="appointment-cell"
|
class="appointment-cell"
|
||||||
@@ -169,6 +169,17 @@
|
|||||||
<div class="apt-badge">{{ appointmentStatusLabelByStatus(apt.status) }}</div>
|
<div class="apt-badge">{{ appointmentStatusLabelByStatus(apt.status) }}</div>
|
||||||
<div class="apt-doctor">{{ apt.doctor_name || '-' }}</div>
|
<div class="apt-doctor">{{ apt.doctor_name || '-' }}</div>
|
||||||
<div class="apt-time">{{ apt.time_text || '-' }}</div>
|
<div class="apt-time">{{ apt.time_text || '-' }}</div>
|
||||||
|
<div v-if="canCancelAppointmentItem(apt)" class="apt-actions">
|
||||||
|
<el-button
|
||||||
|
v-perms="['tcm.diagnosis/guahao']"
|
||||||
|
type="danger"
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleCancelAppointmentItem(row, apt)"
|
||||||
|
>
|
||||||
|
取消挂号
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -304,7 +315,12 @@
|
|||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="isAppointmentActiveForVideo(row) && hasPermission(['tcm.diagnosis/videoQr'])" command="videoQr"><el-icon><Picture /></el-icon>视频二维码</el-dropdown-item>
|
<el-dropdown-item v-if="isAppointmentActiveForVideo(row) && hasPermission(['tcm.diagnosis/videoQr'])" command="videoQr"><el-icon><Picture /></el-icon>视频二维码</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahao']) && isAppointmentActiveForVideo(row)" command="confirmQr"><el-icon><Picture /></el-icon>二维码</el-dropdown-item>
|
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahao']) && isAppointmentActiveForVideo(row)" command="confirmQr"><el-icon><Picture /></el-icon>二维码</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="canCancelAppointmentRow(row) && hasPermission(['tcm.diagnosis/guahao'])" command="cancelApt"><el-icon><CircleClose /></el-icon>取消挂号</el-dropdown-item>
|
<el-dropdown-item
|
||||||
|
v-if="canCancelAppointmentFromDropdown(row) && hasPermission(['tcm.diagnosis/guahao'])"
|
||||||
|
command="cancelApt"
|
||||||
|
>
|
||||||
|
<el-icon><CircleClose /></el-icon>取消挂号
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahaoLogList'])" command="guahaoLogs"><el-icon><List /></el-icon>挂号日志</el-dropdown-item>
|
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahaoLogList'])" command="guahaoLogs"><el-icon><List /></el-icon>挂号日志</el-dropdown-item>
|
||||||
<el-dropdown-item command="order" v-if="hasPermission(['tcm.diagnosis/order'])"><el-icon><Document /></el-icon>创建订单</el-dropdown-item>
|
<el-dropdown-item command="order" v-if="hasPermission(['tcm.diagnosis/order'])"><el-icon><Document /></el-icon>创建订单</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/delete'])" command="delete" divided><el-icon><Delete /></el-icon><span class="text-danger">删除</span></el-dropdown-item>
|
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/delete'])" command="delete" divided><el-icon><Delete /></el-icon><span class="text-danger">删除</span></el-dropdown-item>
|
||||||
@@ -1408,13 +1424,29 @@ const appointmentCellClasses = (row: any) => {
|
|||||||
const isAppointmentActiveForVideo = (row: any) =>
|
const isAppointmentActiveForVideo = (row: any) =>
|
||||||
row.has_appointment && Number(row.appointment_status) === 1
|
row.has_appointment && Number(row.appointment_status) === 1
|
||||||
|
|
||||||
/** 已预约、已过号可取消(后端同步限制) */
|
/** 已预约、已过号可取消(后端同步限制),针对行上主字段 */
|
||||||
const canCancelAppointmentRow = (row: any) => {
|
const canCancelAppointmentRow = (row: any) => {
|
||||||
const s = Number(row.appointment_status)
|
const s = Number(row.appointment_status)
|
||||||
return !!(row.has_appointment && row.appointment_id && (s === 1 || s === 4))
|
return !!(row.has_appointment && row.appointment_id && (s === 1 || s === 4))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消挂号
|
/** 单条挂号记录是否允许取消(已预约 1 / 已过号 4) */
|
||||||
|
const canCancelAppointmentItem = (apt: any) => {
|
||||||
|
const s = Number(apt?.status)
|
||||||
|
return !!(apt?.id && (s === 1 || s === 4))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「更多」里行级取消:仅当列表只展示一条挂号时可点,避免多条时与主键 appointment_id 不对齐
|
||||||
|
* 多条时在「挂号」列每条旁单独取消
|
||||||
|
*/
|
||||||
|
const canCancelAppointmentFromDropdown = (row: any) => {
|
||||||
|
if (!canCancelAppointmentRow(row)) return false
|
||||||
|
const rows = appointmentRows(row)
|
||||||
|
return rows.length <= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消挂号(行级,唯一一条时)
|
||||||
const handleCancelAppointment = async (row: any) => {
|
const handleCancelAppointment = async (row: any) => {
|
||||||
if (!canCancelAppointmentRow(row)) {
|
if (!canCancelAppointmentRow(row)) {
|
||||||
const s = Number(row.appointment_status)
|
const s = Number(row.appointment_status)
|
||||||
@@ -1425,9 +1457,39 @@ const handleCancelAppointment = async (row: any) => {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const rows = appointmentRows(row)
|
||||||
|
const target = rows.length === 1 ? rows[0] : null
|
||||||
|
const aptId = target?.id && canCancelAppointmentItem(target) ? target.id : row.appointment_id
|
||||||
try {
|
try {
|
||||||
await feedback.confirm(`确定要取消患者「${row.patient_name}」的挂号吗?`)
|
await feedback.confirm(`确定要取消患者「${row.patient_name}」的挂号吗?`)
|
||||||
await cancelAppointment({ id: row.appointment_id })
|
await cancelAppointment({ id: aptId })
|
||||||
|
feedback.msgSuccess('取消挂号成功')
|
||||||
|
getLists()
|
||||||
|
fetchDateCounts()
|
||||||
|
if (guahaoLogDrawerVisible.value && guahaoLogContextRow.value?.id === row.id) {
|
||||||
|
await fetchGuahaoLogs(row.id)
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
if (e !== 'cancel') feedback.msgError(e?.msg || '取消挂号失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消指定挂号(多条展示时用) */
|
||||||
|
const handleCancelAppointmentItem = async (row: any, apt: any) => {
|
||||||
|
if (!canCancelAppointmentItem(apt)) {
|
||||||
|
const s = Number(apt?.status)
|
||||||
|
if (s === 3) {
|
||||||
|
feedback.msgWarning('已完成就诊,无法取消挂号')
|
||||||
|
} else {
|
||||||
|
feedback.msgWarning('该挂号无法取消')
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const doc = apt.doctor_name || '—'
|
||||||
|
const t = apt.time_text || '—'
|
||||||
|
try {
|
||||||
|
await feedback.confirm(`确定取消「${doc}」${t} 的挂号吗?(患者:${row.patient_name || '—'})`)
|
||||||
|
await cancelAppointment({ id: apt.id })
|
||||||
feedback.msgSuccess('取消挂号成功')
|
feedback.msgSuccess('取消挂号成功')
|
||||||
getLists()
|
getLists()
|
||||||
fetchDateCounts()
|
fetchDateCounts()
|
||||||
@@ -2061,6 +2123,11 @@ onUnmounted(() => {
|
|||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.apt-actions {
|
||||||
|
margin-top: 4px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
&.apt-item-active {
|
&.apt-item-active {
|
||||||
.apt-badge {
|
.apt-badge {
|
||||||
color: #3a4acc;
|
color: #3a4acc;
|
||||||
|
|||||||
Reference in New Issue
Block a user