处方列表:「重新开方」按钮改按开方权限显示,与后端口径一致
原先只认 cf.prescription/add,诊单开方(tcm.diagnosis/kaifang、chufang)或 tcm.prescription/add 授权的医生能开方却看不到按钮。 改为与后端 PrescriptionLogic::PRESCRIBE_PERMISSIONS 一致,任一开方权限即显示;保存仍走 /tcm.prescription/add 由后端校验。 Co-Authored-By: Claude Opus 5 <[EMAIL]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7458ff03a7
commit
4d1a8683e5
@@ -384,7 +384,7 @@
|
||||
class="cf-prescription-drawer"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@close="showEdit = false"
|
||||
@close="showEdit = false"
|
||||
@closed="onEditDialogClosed"
|
||||
>
|
||||
<!-- 查看:A4 处方笺 -->
|
||||
@@ -394,13 +394,13 @@
|
||||
{{ viewDetailError }}
|
||||
<el-button v-if="slipView?.id" link type="primary" @click="handleView(slipView)">重试加载</el-button>
|
||||
</div>
|
||||
<EsignPrescriptionPanel
|
||||
<EsignPrescriptionPanel
|
||||
v-if="showEdit && slipView?.id && !viewDetailLoading && !viewDetailError"
|
||||
:key="slipView.id"
|
||||
:prescription-id="Number(slipView.id)"
|
||||
:initial-state="slipView.esign"
|
||||
@status-change="onEsignStatusChange"
|
||||
/>
|
||||
:key="slipView.id"
|
||||
:prescription-id="Number(slipView.id)"
|
||||
:initial-state="slipView.esign"
|
||||
@status-change="onEsignStatusChange"
|
||||
/>
|
||||
<!-- 顶部工具栏(不打印 / 不下载) -->
|
||||
<div class="rx-toolbar">
|
||||
<el-tag
|
||||
@@ -426,17 +426,17 @@
|
||||
size="small"
|
||||
>{{ listAuditStatusLabel(slipView) }}</el-tag>
|
||||
<el-tag v-else-if="slipView" type="danger" size="small">已驳回</el-tag>
|
||||
<el-tag v-if="slipView && pendingEsignAudit(slipView)" type="warning" size="small" effect="plain">
|
||||
{{ slipView.esign.status_label }}
|
||||
</el-tag>
|
||||
<el-tag v-if="slipView && pendingEsignAudit(slipView)" type="warning" size="small" effect="plain">
|
||||
{{ slipView.esign.status_label }}
|
||||
</el-tag>
|
||||
<div class="flex-1" />
|
||||
<el-button
|
||||
v-if="slipView && !viewDetailLoading && canOpenPrescriptionAudit(slipView)"
|
||||
v-perms="['cf.prescription/audit']"
|
||||
type="warning"
|
||||
size="small"
|
||||
v-perms="['cf.prescription/audit']"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="openAuditDialog(slipView)"
|
||||
>审核</el-button>
|
||||
>审核</el-button>
|
||||
<el-button
|
||||
v-if="slipView && !viewDetailLoading && !viewDetailError && canReissuePrescription(slipView)"
|
||||
type="primary"
|
||||
@@ -445,7 +445,7 @@
|
||||
:disabled="reissuingPrescriptionId !== 0"
|
||||
@click="handleReissue(slipView)"
|
||||
>重新开方</el-button>
|
||||
<el-button v-if="!requiresOriginalEsignPdf(slipView?.esign)" :icon="Printer" size="small" @click="handlePrintSlip">打印</el-button>
|
||||
<el-button v-if="!requiresOriginalEsignPdf(slipView?.esign)" :icon="Printer" size="small" @click="handlePrintSlip">打印</el-button>
|
||||
<el-dropdown
|
||||
trigger="click"
|
||||
:disabled="viewDetailLoading || downloadingSlip"
|
||||
@@ -1153,12 +1153,12 @@
|
||||
<el-input v-model="editForm.doctor_name" placeholder="请输入医师姓名" />
|
||||
</el-form-item>
|
||||
|
||||
<el-alert v-if="esignError" type="error" :closable="false" class="mb-3">
|
||||
{{ esignError }} <el-button link type="primary" @click="loadEsignConfig">重试</el-button>
|
||||
</el-alert>
|
||||
<el-alert v-else-if="esignEnabled" type="info" :closable="false" class="mb-3"
|
||||
<el-alert v-if="esignError" type="error" :closable="false" class="mb-3">
|
||||
{{ esignError }} <el-button link type="primary" @click="loadEsignConfig">重试</el-button>
|
||||
</el-alert>
|
||||
<el-alert v-else-if="esignEnabled" type="info" :closable="false" class="mb-3"
|
||||
:title="esignConfig?.environment === 'sandbox' ? '沙箱测试。保存草稿后,先上传处方,再由开方医生本人签署。' : '保存草稿后,先上传处方,再由开方医生本人签署。'" />
|
||||
<el-form-item v-else-if="esignReady" label="医师签名" prop="doctor_signature" required>
|
||||
<el-form-item v-else-if="esignReady" label="医师签名" prop="doctor_signature" required>
|
||||
<div class="signature-pad-wrap">
|
||||
<canvas
|
||||
ref="signatureCanvasRef"
|
||||
@@ -1183,8 +1183,8 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button @click="showEdit = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitLoading || esignLoading" :disabled="!esignReady">
|
||||
{{ esignEnabled ? '保存处方草稿' : '确定' }}
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitLoading || esignLoading" :disabled="!esignReady">
|
||||
{{ esignEnabled ? '保存处方草稿' : '确定' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
@@ -1706,7 +1706,7 @@
|
||||
|
||||
<el-dialog v-model="auditDialogVisible" title="处方审核" width="min(1280px, 96vw)" top="5vh" append-to-body destroy-on-close @closed="auditRemark = ''">
|
||||
<PrescriptionAuditLayout
|
||||
:prescription-id="auditTargetId"
|
||||
:prescription-id="auditTargetId"
|
||||
:doctor-signed-at="auditEsign?.signature_time || auditEsign?.signed_at"
|
||||
:pharmacist-signed-at="auditReview?.signature_time || auditEsign?.review_signature_time"
|
||||
>
|
||||
@@ -1735,7 +1735,7 @@
|
||||
</PrescriptionAuditLayout>
|
||||
<template #footer>
|
||||
<el-button @click="auditDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="auditLoading" :disabled="!canApproveAudit" @click="submitAudit('approve')">审核通过</el-button>
|
||||
<el-button type="primary" :loading="auditLoading" :disabled="!canApproveAudit" @click="submitAudit('approve')">审核通过</el-button>
|
||||
<el-button type="danger" :loading="auditLoading" @click="submitAudit('reject')">驳回处方</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -1778,13 +1778,13 @@ import MedicineNameSelect from '@/components/medicine-name-select/index.vue'
|
||||
import PrescriptionSlip from '@/components/prescription-slip/index.vue'
|
||||
import PrescriptionAuditLayout from '@/components/PrescriptionAuditLayout.vue'
|
||||
import PrescriptionLinkedOrdersDialog from './components/PrescriptionLinkedOrdersDialog.vue'
|
||||
import EsignPrescriptionPanel from '@/components/EsignPrescriptionPanel.vue'
|
||||
import { usePrescriptionEsignConfig } from '@/hooks/usePrescriptionEsignConfig'
|
||||
import EsignPrescriptionPanel from '@/components/EsignPrescriptionPanel.vue'
|
||||
import { usePrescriptionEsignConfig } from '@/hooks/usePrescriptionEsignConfig'
|
||||
import { canApprovePrescriptionEsign, downloadOriginalEsignPdf, pendingPrescriptionReviewLabel, requiresOriginalEsignPdf, updatePrescriptionSlipEsign } from '@/utils/prescription-esign'
|
||||
import type { PrescriptionEsignStatus } from '@/api/tcm'
|
||||
import type { PrescriptionEsignStatus } from '@/api/tcm'
|
||||
import { prescriptionListSigningStatus } from './components/prescription-list-signing-status'
|
||||
import { Search, Download, Printer, EditPen } from '@element-plus/icons-vue'
|
||||
import { computed, onMounted, onActivated, onDeactivated, reactive, ref, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { computed, onMounted, onActivated, onDeactivated, reactive, ref, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import html2canvas from 'html2canvas'
|
||||
import jsPDF from 'jspdf'
|
||||
@@ -1970,51 +1970,51 @@ const SIGNATURE_CSS_W = 560
|
||||
const SIGNATURE_CSS_H = 168
|
||||
/** 查看模式:处方笺数据源(先列表行,再详情覆盖) */
|
||||
const slipView = ref<Record<string, any> | null>(null)
|
||||
const { config: esignConfig, enabled: esignEnabled, ready: esignReady, loading: esignLoading, error: esignError, load: loadEsignConfig } = usePrescriptionEsignConfig()
|
||||
|
||||
const canManageCaSigning = computed(() => Number(userStore.userInfo?.root) === 1)
|
||||
const caSigningSettingsVisible = ref(false)
|
||||
const caSigningSettingsEnabled = ref(false)
|
||||
const caSigningSettingsSaving = ref(false)
|
||||
const caSigningSettingsSaveError = ref('')
|
||||
const canSaveCaSigningSettings = computed(
|
||||
() => canManageCaSigning.value && esignReady.value && !esignLoading.value && !caSigningSettingsSaving.value
|
||||
)
|
||||
|
||||
async function loadCaSigningSettings() {
|
||||
if (!canManageCaSigning.value || caSigningSettingsSaving.value) return
|
||||
caSigningSettingsSaveError.value = ''
|
||||
if (await loadEsignConfig()) {
|
||||
caSigningSettingsEnabled.value = esignConfig.value?.enabled === true
|
||||
}
|
||||
}
|
||||
|
||||
function openCaSigningSettings() {
|
||||
if (!canManageCaSigning.value) return
|
||||
caSigningSettingsVisible.value = true
|
||||
void loadCaSigningSettings()
|
||||
}
|
||||
|
||||
async function saveCaSigningSettings() {
|
||||
if (!canSaveCaSigningSettings.value) return
|
||||
caSigningSettingsSaving.value = true
|
||||
caSigningSettingsSaveError.value = ''
|
||||
try {
|
||||
const enabled = caSigningSettingsEnabled.value
|
||||
const config = await prescriptionEsignSetConfig({ enabled })
|
||||
if (config?.enabled !== enabled) throw new Error('保存结果与所选设置不一致')
|
||||
esignConfig.value = config
|
||||
caSigningSettingsVisible.value = false
|
||||
feedback.msgSuccess('CA 签名设置已保存')
|
||||
void getLists({ silent: true }).catch(() => {})
|
||||
} catch {
|
||||
caSigningSettingsSaveError.value = '保存未完成,当前选择已保留,请重试。'
|
||||
} finally {
|
||||
caSigningSettingsSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onEsignStatusChange = (state: PrescriptionEsignStatus) => {
|
||||
const { config: esignConfig, enabled: esignEnabled, ready: esignReady, loading: esignLoading, error: esignError, load: loadEsignConfig } = usePrescriptionEsignConfig()
|
||||
|
||||
const canManageCaSigning = computed(() => Number(userStore.userInfo?.root) === 1)
|
||||
const caSigningSettingsVisible = ref(false)
|
||||
const caSigningSettingsEnabled = ref(false)
|
||||
const caSigningSettingsSaving = ref(false)
|
||||
const caSigningSettingsSaveError = ref('')
|
||||
const canSaveCaSigningSettings = computed(
|
||||
() => canManageCaSigning.value && esignReady.value && !esignLoading.value && !caSigningSettingsSaving.value
|
||||
)
|
||||
|
||||
async function loadCaSigningSettings() {
|
||||
if (!canManageCaSigning.value || caSigningSettingsSaving.value) return
|
||||
caSigningSettingsSaveError.value = ''
|
||||
if (await loadEsignConfig()) {
|
||||
caSigningSettingsEnabled.value = esignConfig.value?.enabled === true
|
||||
}
|
||||
}
|
||||
|
||||
function openCaSigningSettings() {
|
||||
if (!canManageCaSigning.value) return
|
||||
caSigningSettingsVisible.value = true
|
||||
void loadCaSigningSettings()
|
||||
}
|
||||
|
||||
async function saveCaSigningSettings() {
|
||||
if (!canSaveCaSigningSettings.value) return
|
||||
caSigningSettingsSaving.value = true
|
||||
caSigningSettingsSaveError.value = ''
|
||||
try {
|
||||
const enabled = caSigningSettingsEnabled.value
|
||||
const config = await prescriptionEsignSetConfig({ enabled })
|
||||
if (config?.enabled !== enabled) throw new Error('保存结果与所选设置不一致')
|
||||
esignConfig.value = config
|
||||
caSigningSettingsVisible.value = false
|
||||
feedback.msgSuccess('CA 签名设置已保存')
|
||||
void getLists({ silent: true }).catch(() => {})
|
||||
} catch {
|
||||
caSigningSettingsSaveError.value = '保存未完成,当前选择已保留,请重试。'
|
||||
} finally {
|
||||
caSigningSettingsSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onEsignStatusChange = (state: PrescriptionEsignStatus) => {
|
||||
const previous = slipView.value?.esign
|
||||
if (slipView.value && state.review_submitted_at !== undefined) {
|
||||
slipView.value.review_submitted_at = state.review_submitted_at
|
||||
@@ -2027,7 +2027,7 @@ const onEsignStatusChange = (state: PrescriptionEsignStatus) => {
|
||||
|| previous?.can_review_prescription !== state.can_review_prescription) {
|
||||
void getLists({ silent: true }).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
const viewDetailLoading = ref(false)
|
||||
const viewDetailError = ref('')
|
||||
let viewDetailRequest: AbortController | undefined
|
||||
@@ -2041,7 +2041,7 @@ const reissuingPrescriptionId = ref(0)
|
||||
const auditTargetId = ref(0)
|
||||
const auditRemark = ref('')
|
||||
const auditLoading = ref(false)
|
||||
const auditEsign = ref<PrescriptionEsignStatus | null>(null)
|
||||
const auditEsign = ref<PrescriptionEsignStatus | null>(null)
|
||||
const auditReview = ref<import('@/api/tcm').PrescriptionEsignReviewStatus | null>(null)
|
||||
const canApproveAudit = computed(() => (
|
||||
canApprovePrescriptionEsign(auditEsign.value) && auditReview.value?.can_approve === true
|
||||
@@ -2060,9 +2060,9 @@ const patchPatientForm = reactive({
|
||||
const patchPatientRules: FormRules = {
|
||||
patient_name: [{ required: true, message: '请输入患者姓名', trigger: 'blur' }],
|
||||
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{ pattern: /^(?:1[3-9]\d{9}|0\d{2,3}-?\d{7,8})$/, message: '请输入 11 位手机号或带区号的座机号', trigger: 'blur' }
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{ pattern: /^(?:1[3-9]\d{9}|0\d{2,3}-?\d{7,8})$/, message: '请输入 11 位手机号或带区号的座机号', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2999,7 +2999,7 @@ async function handleDownloadSlip(command: 'esign' | 'internal' | 'user') {
|
||||
const name = (slipView.value as any)?.patient_name || '处方'
|
||||
const id = (slipView.value as any)?.id || ''
|
||||
const date = (slipView.value as any)?.prescription_date || ''
|
||||
const copy = command === 'internal' ? '药房联' : '处方联'
|
||||
const copy = command === 'internal' ? '药房联' : '处方联'
|
||||
pdf.save(`${copy}-${name}${date ? '-' + date : ''}${id ? '-' + id : ''}.pdf`)
|
||||
} catch (e: any) {
|
||||
console.error('下载处方 PDF 失败:', e)
|
||||
@@ -3181,7 +3181,7 @@ const rules: FormRules = {
|
||||
{
|
||||
required: true,
|
||||
validator: (_rule, v, cb) => {
|
||||
if (!esignEnabled.value && (!v || !String(v).trim())) {
|
||||
if (!esignEnabled.value && (!v || !String(v).trim())) {
|
||||
cb(new Error('请使用电子签名板手写医师签名'))
|
||||
} else {
|
||||
cb()
|
||||
@@ -3370,10 +3370,10 @@ function isApprovedActivePrescription(row: { audit_status?: number; void_status?
|
||||
return Number(row.audit_status) === 1 && Number(row.void_status) !== 1
|
||||
}
|
||||
|
||||
function isPendingPrescriptionAudit(row: { audit_status?: number | string; void_status?: number | string }) {
|
||||
return (row.audit_status === 0 || row.audit_status === '0') && Number(row.void_status) !== 1
|
||||
}
|
||||
|
||||
function isPendingPrescriptionAudit(row: { audit_status?: number | string; void_status?: number | string }) {
|
||||
return (row.audit_status === 0 || row.audit_status === '0') && Number(row.void_status) !== 1
|
||||
}
|
||||
|
||||
type VoidablePrescriptionRow = Parameters<typeof isPendingPrescriptionAudit>[0] & {
|
||||
id?: number | string
|
||||
can_void?: boolean
|
||||
@@ -3412,11 +3412,11 @@ function canOpenPrescriptionAudit(row: { audit_status?: number | string; void_st
|
||||
return isPendingPrescriptionAudit(row) && row.can_review_prescription === true
|
||||
}
|
||||
|
||||
function pendingEsignAudit(row: { audit_status?: number | string; void_status?: number | string; esign?: PrescriptionEsignStatus }) {
|
||||
function pendingEsignAudit(row: { audit_status?: number | string; void_status?: number | string; esign?: PrescriptionEsignStatus }) {
|
||||
return isPendingPrescriptionAudit(row) && row.esign?.required === true && row.esign.awaiting_upload !== true
|
||||
&& !canApprovePrescriptionEsign(row.esign)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function formatAuditTime(ts: number | null | undefined) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(ts * 1000)
|
||||
@@ -3662,21 +3662,21 @@ async function submitPrescriptionForReview(row: Record<string, any>) {
|
||||
function openAuditDialog(row: Record<string, any>) {
|
||||
if (auditLoading.value || !canOpenPrescriptionAudit(row)) return
|
||||
auditTargetId.value = Number(row.id)
|
||||
auditEsign.value = null
|
||||
auditEsign.value = null
|
||||
auditReview.value = null
|
||||
auditRemark.value = ''
|
||||
auditDialogVisible.value = true
|
||||
}
|
||||
|
||||
function onAuditEsignStatusChange(state: PrescriptionEsignStatus) {
|
||||
const justSigned = auditEsign.value && !canApproveAudit.value && state.status === 'signed'
|
||||
&& canApprovePrescriptionEsign(state)
|
||||
auditEsign.value = state
|
||||
if (justSigned) {
|
||||
if (Number(slipView.value?.id) === auditTargetId.value && slipView.value) slipView.value.esign = state
|
||||
else void getLists()
|
||||
}
|
||||
}
|
||||
function onAuditEsignStatusChange(state: PrescriptionEsignStatus) {
|
||||
const justSigned = auditEsign.value && !canApproveAudit.value && state.status === 'signed'
|
||||
&& canApprovePrescriptionEsign(state)
|
||||
auditEsign.value = state
|
||||
if (justSigned) {
|
||||
if (Number(slipView.value?.id) === auditTargetId.value && slipView.value) slipView.value.esign = state
|
||||
else void getLists()
|
||||
}
|
||||
}
|
||||
|
||||
function onAuditReviewChange(state: import('@/api/tcm').PrescriptionEsignReviewStatus | null) {
|
||||
auditReview.value = state
|
||||
@@ -3687,9 +3687,9 @@ function onAuditReviewChange(state: import('@/api/tcm').PrescriptionEsignReviewS
|
||||
void getLists()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function submitAudit(action: 'approve' | 'reject') {
|
||||
if (auditLoading.value || (action === 'approve' && !canApproveAudit.value)) return
|
||||
if (auditLoading.value || (action === 'approve' && !canApproveAudit.value)) return
|
||||
if (action === 'reject' && !auditRemark.value.trim()) {
|
||||
feedback.msgError('驳回时请填写审核意见')
|
||||
return
|
||||
@@ -3706,7 +3706,7 @@ async function submitAudit(action: 'approve' | 'reject') {
|
||||
feedback.msgWarning(auditData.wecom_notify_hint)
|
||||
}
|
||||
auditDialogVisible.value = false
|
||||
if (showEdit.value && Number(slipView.value?.id) === auditTargetId.value) showEdit.value = false
|
||||
if (showEdit.value && Number(slipView.value?.id) === auditTargetId.value) showEdit.value = false
|
||||
getLists()
|
||||
} catch {
|
||||
/* 拦截器已提示 */
|
||||
@@ -4102,7 +4102,7 @@ const resetForm = () => {
|
||||
const handleAdd = () => openNewPrescription()
|
||||
|
||||
function openNewPrescription(source?: Record<string, any>) {
|
||||
void loadEsignConfig()
|
||||
void loadEsignConfig()
|
||||
isLoadingData.value = !!source
|
||||
resetForm()
|
||||
if (source) {
|
||||
@@ -4129,10 +4129,22 @@ function openNewPrescription(source?: Record<string, any>) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 开方权限:与后端 PrescriptionLogic::PRESCRIBE_PERMISSIONS 一致,任一即可(重新开方保存走 /tcm.prescription/add) */
|
||||
const PRESCRIBE_PERMISSIONS = [
|
||||
'tcm.prescription/add',
|
||||
'cf.prescription/add',
|
||||
'tcm.diagnosis/chufang',
|
||||
'tcm.diagnosis/kaifang'
|
||||
]
|
||||
|
||||
/** 已作废处方(含他人所开、他人作废)均可由有开方权限的账号重新开方;新处方以当前账号为开方医生 */
|
||||
function canReissuePrescription(row: { creator_id?: number | string; void_status?: number | string }) {
|
||||
const doctorId = Number(userStore.userInfo?.id)
|
||||
return Number(row.void_status) === 1 && doctorId > 0 && hasPermission(['cf.prescription/add'])
|
||||
return (
|
||||
Number(row.void_status) === 1 &&
|
||||
doctorId > 0 &&
|
||||
PRESCRIBE_PERMISSIONS.some((perm) => hasPermission([perm]))
|
||||
)
|
||||
}
|
||||
|
||||
async function handleReissue(row: { id?: number | string; creator_id?: number | string; void_status?: number | string }) {
|
||||
@@ -4187,7 +4199,7 @@ const handleView = async (row: any) => {
|
||||
|
||||
// 编辑处方
|
||||
const handleEdit = async (row: any) => {
|
||||
await loadEsignConfig()
|
||||
await loadEsignConfig()
|
||||
editingWasVoid.value = Number(row.void_status) === 1
|
||||
editingWasRejected.value = Number(row.audit_status) === 2
|
||||
editMode.value = 'edit'
|
||||
@@ -4286,8 +4298,8 @@ function fillPrescriptionContents(src: Record<string, any>) {
|
||||
|
||||
// 提交表单
|
||||
const handleSubmit = async () => {
|
||||
if (submitLoading.value) return
|
||||
if (!esignReady.value && !(await loadEsignConfig())) return
|
||||
if (submitLoading.value) return
|
||||
if (!esignReady.value && !(await loadEsignConfig())) return
|
||||
if (!formRef.value) return
|
||||
|
||||
try {
|
||||
@@ -4296,7 +4308,7 @@ const handleSubmit = async () => {
|
||||
// Element Plus:校验失败会 reject,表单项已展示错误,勿再向外抛成 Uncaught
|
||||
return
|
||||
}
|
||||
if (submitLoading.value) return
|
||||
if (submitLoading.value) return
|
||||
|
||||
// 验证药材
|
||||
if (!editForm.herbs || editForm.herbs.length === 0) {
|
||||
@@ -4322,25 +4334,25 @@ const handleSubmit = async () => {
|
||||
try {
|
||||
const params: Record<string, unknown> = { ...editForm }
|
||||
|
||||
let result: any
|
||||
let result: any
|
||||
if (editMode.value === 'add') {
|
||||
params.audit_status = 0
|
||||
if (reissueContext.value) {
|
||||
Object.assign(params, reissueContext.value)
|
||||
if (!editForm.visit_no.trim()) delete params.visit_no
|
||||
}
|
||||
result = await prescriptionAdd(params)
|
||||
result = await prescriptionAdd(params)
|
||||
} else {
|
||||
result = await prescriptionEdit(params)
|
||||
result = await prescriptionEdit(params)
|
||||
}
|
||||
if (esignEnabled.value || requiresOriginalEsignPdf(result?.esign)) {
|
||||
const id = Number(result?.id || editForm.id)
|
||||
feedback.msgSuccess(result?.esign?.required ? '处方草稿已保存' : '处方已保存,请核对电子签署状态')
|
||||
await handleView({ ...editForm, id, audit_status: 0, esign: result?.esign })
|
||||
} else {
|
||||
if (esignEnabled.value || requiresOriginalEsignPdf(result?.esign)) {
|
||||
const id = Number(result?.id || editForm.id)
|
||||
feedback.msgSuccess(result?.esign?.required ? '处方草稿已保存' : '处方已保存,请核对电子签署状态')
|
||||
await handleView({ ...editForm, id, audit_status: 0, esign: result?.esign })
|
||||
} else {
|
||||
feedback.msgSuccess('处方已保存,请在「已开处方」上传')
|
||||
showEdit.value = false
|
||||
}
|
||||
showEdit.value = false
|
||||
}
|
||||
getLists()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -4357,19 +4369,19 @@ const handleDelete = async (id: number) => {
|
||||
getLists()
|
||||
}
|
||||
|
||||
// 从订单页返回缓存的处方列表时,重新读取退款后的占用状态。
|
||||
let refreshOnReturn = false
|
||||
onDeactivated(() => {
|
||||
refreshOnReturn = true
|
||||
})
|
||||
onActivated(() => {
|
||||
if (!refreshOnReturn) return
|
||||
refreshOnReturn = false
|
||||
getLists()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
void loadEsignConfig()
|
||||
// 从订单页返回缓存的处方列表时,重新读取退款后的占用状态。
|
||||
let refreshOnReturn = false
|
||||
onDeactivated(() => {
|
||||
refreshOnReturn = true
|
||||
})
|
||||
onActivated(() => {
|
||||
if (!refreshOnReturn) return
|
||||
refreshOnReturn = false
|
||||
getLists()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
void loadEsignConfig()
|
||||
await loadRoleOptions()
|
||||
await loadRegionData()
|
||||
await loadServicePackageOptions()
|
||||
|
||||
Reference in New Issue
Block a user