更新
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
<div class="filter-group">
|
||||
<span class="filter-label">日期</span>
|
||||
<el-radio-group v-model="formData.date_preset" size="small" @change="handleDatePresetChange" class="filter-radio">
|
||||
<el-radio-button value="yesterday">昨天挂号</el-radio-button>
|
||||
<el-radio-button value="day_before">前天挂号</el-radio-button>
|
||||
<el-radio-button value="today">当天挂号</el-radio-button>
|
||||
<el-radio-button value="tomorrow">明天挂号</el-radio-button>
|
||||
<el-radio-button value="day_after">后天挂号</el-radio-button>
|
||||
@@ -153,10 +155,20 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="开方" width="80" align="center">
|
||||
<el-table-column label="开方" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.has_prescription" type="success" size="small" effect="plain">已开方</el-tag>
|
||||
<el-tag v-else type="info" size="small" effect="plain">未开方</el-tag>
|
||||
<div class="prescription-tags">
|
||||
<el-tag v-if="row.has_prescription" type="success" size="small" effect="plain">已开方</el-tag>
|
||||
<el-tag v-else type="info" size="small" effect="plain">未开方</el-tag>
|
||||
<el-tag
|
||||
v-if="row.has_prescription && row.prescription_is_system_auto === 1"
|
||||
type="warning"
|
||||
size="small"
|
||||
effect="plain"
|
||||
>
|
||||
系统代开
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -561,7 +573,7 @@ const formData = reactive({
|
||||
status: '' as string | number,
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
date_preset: 'today' as '' | 'today' | 'tomorrow' | 'day_after',
|
||||
date_preset: 'today' as '' | 'yesterday' | 'day_before' | 'today' | 'tomorrow' | 'day_after',
|
||||
diagnosis_confirmed: '' as '' | '0' | '1', // ''=全部 1=已确认 0=未确认
|
||||
/** 为 1 时后端 extend 返回各状态数量,避免额外 4 次列表请求 */
|
||||
include_status_counts: 0 as 0 | 1
|
||||
@@ -589,14 +601,31 @@ watch(
|
||||
if (!formData.date_preset) return
|
||||
const today = new Date()
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
const todayStr = `${today.getFullYear()}-${pad(today.getMonth() + 1)}-${pad(today.getDate())}`
|
||||
const fmt = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
||||
const todayStr = fmt(today)
|
||||
const yesterday = new Date(today)
|
||||
yesterday.setDate(yesterday.getDate() - 1)
|
||||
const yesterdayStr = fmt(yesterday)
|
||||
const dayBefore = new Date(today)
|
||||
dayBefore.setDate(dayBefore.getDate() - 2)
|
||||
const dayBeforeStr = fmt(dayBefore)
|
||||
const tomorrow = new Date(today)
|
||||
tomorrow.setDate(tomorrow.getDate() + 1)
|
||||
const tomorrowStr = `${tomorrow.getFullYear()}-${pad(tomorrow.getMonth() + 1)}-${pad(tomorrow.getDate())}`
|
||||
const tomorrowStr = fmt(tomorrow)
|
||||
const dayAfter = new Date(today)
|
||||
dayAfter.setDate(dayAfter.getDate() + 2)
|
||||
const dayAfterStr = `${dayAfter.getFullYear()}-${pad(dayAfter.getMonth() + 1)}-${pad(dayAfter.getDate())}`
|
||||
const expected = formData.date_preset === 'today' ? todayStr : formData.date_preset === 'tomorrow' ? tomorrowStr : dayAfterStr
|
||||
const dayAfterStr = fmt(dayAfter)
|
||||
const preset = formData.date_preset
|
||||
const expected =
|
||||
preset === 'yesterday'
|
||||
? yesterdayStr
|
||||
: preset === 'day_before'
|
||||
? dayBeforeStr
|
||||
: preset === 'today'
|
||||
? todayStr
|
||||
: preset === 'tomorrow'
|
||||
? tomorrowStr
|
||||
: dayAfterStr
|
||||
const startStr = (start || '').split(' ')[0]
|
||||
if (startStr !== expected) {
|
||||
formData.date_preset = ''
|
||||
@@ -677,7 +706,13 @@ const handleDatePresetChange = (val: string | number | boolean | undefined) => {
|
||||
const today = new Date()
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
let target: Date
|
||||
if (v === 'today') {
|
||||
if (v === 'yesterday') {
|
||||
target = new Date(today)
|
||||
target.setDate(target.getDate() - 1)
|
||||
} else if (v === 'day_before') {
|
||||
target = new Date(today)
|
||||
target.setDate(target.getDate() - 2)
|
||||
} else if (v === 'today') {
|
||||
target = today
|
||||
} else if (v === 'tomorrow') {
|
||||
target = new Date(today)
|
||||
@@ -687,7 +722,7 @@ const handleDatePresetChange = (val: string | number | boolean | undefined) => {
|
||||
target.setDate(target.getDate() + 2)
|
||||
}
|
||||
const dateStr = `${target.getFullYear()}-${pad(target.getMonth() + 1)}-${pad(target.getDate())}`
|
||||
formData.date_preset = v as '' | 'today' | 'tomorrow' | 'day_after'
|
||||
formData.date_preset = v as '' | 'yesterday' | 'day_before' | 'today' | 'tomorrow' | 'day_after'
|
||||
formData.start_date = dateStr
|
||||
formData.end_date = dateStr
|
||||
pager.page = 1
|
||||
@@ -1144,6 +1179,14 @@ onUnmounted(() => {
|
||||
padding: 0 16px 20px;
|
||||
}
|
||||
|
||||
.prescription-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-btns {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
Reference in New Issue
Block a user