This commit is contained in:
Your Name
2026-04-22 16:36:40 +08:00
parent 4872e4d2e6
commit 852bcd54a5
7 changed files with 528 additions and 66 deletions
+61 -17
View File
@@ -38,6 +38,18 @@
<el-radio-button label="not_passed">未通过</el-radio-button>
<el-radio-button label="rejected">驳回</el-radio-button>
</el-radio-group>
<span class="pl-toolbar__sep" aria-hidden="true" />
<span class="pl-toolbar__k" title="与列表「来源」列一致:系统代开 / 手工">来源</span>
<el-radio-group
v-model="formData.source_filter"
size="small"
class="pl-toolbar__rg pl-toolbar__rg--source"
@change="onSourceFilterChange"
>
<el-radio-button label="all">全部</el-radio-button>
<el-radio-button label="manual">手工</el-radio-button>
<el-radio-button label="system">系统代开</el-radio-button>
</el-radio-group>
</div>
<div class="pl-toolbar__line pl-toolbar__line--second">
<el-form :model="formData" inline class="pl-toolbar__form">
@@ -189,7 +201,7 @@
查看
</el-button>
<el-button
v-if="!Number(row.has_prescription_order)"
v-if="!Number(row.has_prescription_order) && Number(row.void_status) !== 1"
type="success"
link
v-perms="['tcm.prescriptionOrder/create']"
@@ -444,6 +456,15 @@
class="mb-4"
:title="editReviveHint"
/>
<div
v-if="Number(editForm.diagnosis_id) > 0"
class="mb-3 flex flex-wrap items-center gap-2 pl-[120px]"
>
<el-button type="primary" size="small" @click="openDiagnosisPatientDetail">
查看患者诊单详情
</el-button>
<span class="text-xs text-gray-400">关联诊单 #{{ editForm.diagnosis_id }}</span>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="患者姓名" prop="patient_name">
@@ -1234,6 +1255,9 @@
<el-button type="danger" :loading="auditLoading" @click="submitAudit('reject')">驳回处方</el-button>
</template>
</el-dialog>
<!-- 与 tcm/diagnosis/edit 同一套诊单界面(只读 + 全部分页签) -->
<TcmDiagnosisEditView ref="diagnosisViewRef" />
</div>
</template>
@@ -1259,9 +1283,11 @@ import feedback from '@/utils/feedback'
import type { FormInstance, FormRules } from 'element-plus'
import DaterangePicker from '@/components/daterange-picker/index.vue'
import { Search } from '@element-plus/icons-vue'
import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue'
import { computed, onMounted, reactive, ref, watch, nextTick, defineAsyncComponent } from 'vue'
import { useRouter } from 'vue-router'
const TcmDiagnosisEditView = defineAsyncComponent(() => import('@/views/tcm/diagnosis/edit.vue'))
/** 与 server/config/project.php prescription_audit_roles 保持一致 */
const PRESCRIPTION_AUDIT_ROLE_IDS = [0, 3]
@@ -1289,6 +1315,8 @@ const formData = reactive({
creator_ids: [] as number[],
/** all | passed | not_passed | pending | rejectedall 表示不限,接口传参会转为空) */
audit_filter: 'all' as string,
/** all | manual | system — 与 is_system_auto:手工(0) / 系统代开(1) */
source_filter: 'all' as string,
start_time: '',
end_time: ''
})
@@ -1621,13 +1649,13 @@ function resetCreateOrderForm() {
createOrderFormRef.value?.clearValidate()
}
/** 仅按定金门槛抬升「总金额」,不跟已选支付单合计联动(由用户自填) */
function syncCreateOrderAmountFromRules() {
const min = createOrderDepositMin.value
const paid = createOrderLinkedPaidTotal.value
const floor = min > 0 ? Math.round(min * 100) / 100 : 0
const need = min > 0 ? Math.max(paid, floor) : paid > 0 ? paid : 0
if (need > 0 && Number(createOrderForm.amount) < need) {
createOrderForm.amount = Math.round(need * 100) / 100
if (min <= 0) return
const need = Math.round(min * 100) / 100
if (Number(createOrderForm.amount) < need) {
createOrderForm.amount = need
}
}
@@ -1664,15 +1692,11 @@ watch(
}
)
watch(
() => [...createOrderForm.pay_order_ids],
() => {
syncCreateOrderAmountFromRules()
},
{ deep: true }
)
async function openCreateOrderFromPrescription(row: any) {
if (Number(row?.void_status) === 1) {
feedback.msgWarning('已作废处方不可创建业务订单')
return
}
resetCreateOrderForm()
createOrderPrescription.value = row
const did = Number(row.diagnosis_id) || 0
@@ -1889,6 +1913,19 @@ const editForm = reactive({
times_per_day: 2
})
const diagnosisViewRef = ref<{
openViewOnly: (id: number) => Promise<void>
} | null>(null)
function openDiagnosisPatientDetail() {
const id = Number(editForm.diagnosis_id)
if (!id) {
feedback.msgWarning('本处方未关联诊单,无法查看诊单患者信息')
return
}
void diagnosisViewRef.value?.openViewOnly(id)
}
// 标志:是否正在加载数据(防止watch函数覆盖已加载的值)
const isLoadingData = ref(false)
@@ -1940,10 +1977,12 @@ const rules: FormRules = {
}
async function fetchPrescriptionLists(params: Record<string, unknown>) {
const { audit_filter, creator_ids, ...rest } = params
const { audit_filter, source_filter, creator_ids, ...rest } = params
const payload: Record<string, unknown> = {
...rest,
audit_filter: audit_filter === 'all' || audit_filter === '' ? '' : audit_filter
audit_filter: audit_filter === 'all' || audit_filter === '' ? '' : audit_filter,
source_filter:
source_filter === 'all' || source_filter === '' || source_filter === undefined ? '' : source_filter
}
if (Array.isArray(creator_ids) && creator_ids.length > 0) {
payload.creator_ids = creator_ids
@@ -1993,6 +2032,10 @@ function onAuditFilterChange() {
resetPage()
}
function onSourceFilterChange() {
resetPage()
}
let syncingDateTab = false
watch(
() => [formData.start_time, formData.end_time],
@@ -2039,6 +2082,7 @@ function resetParams() {
formData.patient_name = ''
formData.creator_ids = []
formData.audit_filter = 'all'
formData.source_filter = 'all'
formData.start_time = ''
formData.end_time = ''
syncingDateTab = false