新增功能
This commit is contained in:
@@ -331,7 +331,9 @@ const formData = reactive({
|
||||
dietary_taboo: [] as string[],
|
||||
usage_notes: '',
|
||||
doctor_name: '',
|
||||
is_shared: 0
|
||||
is_shared: 0,
|
||||
/** 预约开方直接生效,不走消费者处方「待审核」 */
|
||||
audit_status: 1
|
||||
})
|
||||
|
||||
// 表单验证规则
|
||||
@@ -399,6 +401,7 @@ const resetForm = () => {
|
||||
formData.usage_notes = ''
|
||||
formData.doctor_name = ''
|
||||
formData.is_shared = 0
|
||||
formData.audit_status = 0
|
||||
}
|
||||
|
||||
// 打开抽屉
|
||||
|
||||
@@ -106,17 +106,15 @@
|
||||
:data="pager.lists"
|
||||
size="default"
|
||||
class="appointment-table"
|
||||
stripe
|
||||
:row-class-name="getRowClassName"
|
||||
>
|
||||
<el-table-column label="ID" prop="id" width="72" align="center" />
|
||||
|
||||
<el-table-column label="患者信息" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<div class="patient-cell">
|
||||
<div class="patient-avatar">
|
||||
<!-- <div class="patient-avatar">
|
||||
{{ (row.patient_name || '患').charAt(0) }}
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="patient-info">
|
||||
<div class="patient-name">{{ row.patient_name }}</div>
|
||||
<div class="patient-phone">{{ row.patient_phone }}</div>
|
||||
@@ -139,9 +137,14 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="助理" prop="assistant_name" width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.assistant_name || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="预约类型" prop="appointment_type_desc" width="100" show-overflow-tooltip />
|
||||
|
||||
<!-- <el-table-column label="预约类型" prop="appointment_type_desc" width="100" show-overflow-tooltip /> -->
|
||||
|
||||
<el-table-column label="确认诊单" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -172,8 +175,7 @@
|
||||
|
||||
<el-table-column label="备注" prop="remark" min-width="120" show-overflow-tooltip />
|
||||
|
||||
|
||||
|
||||
|
||||
<el-table-column label="操作" width="380" fixed="right" align="left">
|
||||
<template #default="{ row }">
|
||||
<div class="action-btns">
|
||||
@@ -232,7 +234,7 @@
|
||||
size="small"
|
||||
@click="handlePrescription(row)"
|
||||
>
|
||||
开方
|
||||
{{ prescriptionActionLabel(row) }}
|
||||
</el-button>
|
||||
|
||||
<el-dropdown trigger="click" @command="(cmd) => handleAction(cmd, row)" placement="bottom-end">
|
||||
@@ -456,7 +458,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑患者弹窗 -->
|
||||
<edit-popup ref="editRef" @success="loadData" />
|
||||
<edit-popup ref="editRef" @success="() => loadData({ silent: true })" />
|
||||
|
||||
<!-- 中医处方单 -->
|
||||
<tcm-prescription ref="prescriptionRef" @success="onPrescriptionSuccess" />
|
||||
@@ -506,7 +508,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { defineAsyncComponent, onMounted, watch } from 'vue'
|
||||
import { defineAsyncComponent, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { appointmentLists, cancelAppointment, completeAppointment, appointmentDetail } from '@/api/doctor'
|
||||
import { getCallSignature, generateMiniProgramQrcode, tcmDiagnosisDetail, prescriptionGetByAppointment } from '@/api/tcm'
|
||||
import { getDictData } from '@/api/app'
|
||||
@@ -598,11 +600,6 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
// 待接诊行高亮
|
||||
const getRowClassName = ({ row }: { row: any }) => {
|
||||
return row.status === 1 ? 'row-pending' : ''
|
||||
}
|
||||
|
||||
// 切换选项卡
|
||||
const handleTabChange = (tabName: string | number) => {
|
||||
if (tabName === 'all') {
|
||||
@@ -613,11 +610,16 @@ const handleTabChange = (tabName: string | number) => {
|
||||
resetPage()
|
||||
}
|
||||
|
||||
/** 列表静默轮询间隔(毫秒) */
|
||||
const LIST_POLL_MS = 20_000
|
||||
let listPollTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
// 列表 + Tab 角标:一次请求(后端 extend.status_count),翻页等仅 getLists 不重复统计
|
||||
const loadData = async () => {
|
||||
const loadData = async (opts?: { silent?: boolean }) => {
|
||||
const silent = opts?.silent === true
|
||||
formData.include_status_counts = 1
|
||||
try {
|
||||
await getLists()
|
||||
await getLists({ silent })
|
||||
const ext = pager.extend as { status_count?: Record<number | string, number> }
|
||||
const sc = ext?.status_count
|
||||
if (sc) {
|
||||
@@ -628,6 +630,11 @@ const loadData = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
/* 定时静默刷新失败不向外抛,避免未处理的 rejection;手动刷新仍交给上层/拦截器 */
|
||||
if (!silent) {
|
||||
throw e
|
||||
}
|
||||
} finally {
|
||||
formData.include_status_counts = 0
|
||||
}
|
||||
@@ -929,7 +936,18 @@ const onPrescriptionSuccess = () => {
|
||||
editRef.value?.refreshCaseList?.()
|
||||
}
|
||||
|
||||
// 开处方
|
||||
/** 与本预约关联的处方:已通过且未作废 → 与消费者处方「查看」同为只读预览 */
|
||||
function prescriptionActionLabel(row: any) {
|
||||
if (
|
||||
row?.prescription_audit_status === 1 &&
|
||||
Number(row?.prescription_void_status) !== 1
|
||||
) {
|
||||
return '查看'
|
||||
}
|
||||
return '开方'
|
||||
}
|
||||
|
||||
// 开处方 / 查看已通过处方(只读)
|
||||
const handlePrescription = (row: any) => {
|
||||
if (!row.diagnosis_id && !row.patient_id) {
|
||||
feedback.msgWarning('该预约缺少诊单信息,请先编辑患者')
|
||||
@@ -972,6 +990,16 @@ formData.status = 1
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
listPollTimer = setInterval(() => {
|
||||
loadData({ silent: true })
|
||||
}, LIST_POLL_MS)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (listPollTimer !== null) {
|
||||
clearInterval(listPollTimer)
|
||||
listPollTimer = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1113,9 +1141,10 @@ onMounted(() => {
|
||||
|
||||
.action-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 0 8px;
|
||||
row-gap: 6px;
|
||||
column-gap: 8px;
|
||||
|
||||
.action-qrcode {
|
||||
color: var(--el-color-warning) !important;
|
||||
@@ -1135,11 +1164,12 @@ onMounted(() => {
|
||||
:deep(.el-table__row) {
|
||||
cursor: default;
|
||||
}
|
||||
:deep(.el-table__row.row-pending) {
|
||||
background: linear-gradient(90deg, rgba(var(--el-color-success-rgb), 0.06) 0%, transparent 100%) !important;
|
||||
/* 数据行纯白底(不使用 stripe / 行高亮色) */
|
||||
:deep(.el-table__body tr > td) {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
:deep(.el-table__row.row-pending:hover > td) {
|
||||
background: linear-gradient(90deg, rgba(var(--el-color-success-rgb), 0.1) 0%, transparent 100%) !important;
|
||||
:deep(.el-table__body tr:hover > td) {
|
||||
background-color: var(--el-fill-color-light) !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user