This commit is contained in:
zlwu committed 2026-06-03 17:53:48 +08:00
1 parent 09afdb1d65
commit afd517ce10
215 files changed
+32936 -23862

No files matched your search

@@ -115,6 +115,134 @@
:rows="3"
/>
</el-form-item>
<div class="form-col-full">
<div class="section-subtitle" style="margin-bottom: 12px">知情同意书</div>
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
ref="consentUploadRef"
:show-file-list="false"
:auto-upload="false"
:multiple="true"
accept="image/*,.pdf"
@change="handleConsentFileChange"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div
v-for="(file, idx) in consentFileList"
:key="file.id || idx"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div class="attachment-preview">
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else-if="isVideoFile(file)">
<div class="attachment-preview__icon attachment-preview__icon--video">
<el-icon :size="28"><VideoPlay /></el-icon>
</div>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{
file.fileName
}}</span>
<div class="attachment-actions">
<el-icon class="action-btn" @click.stop="downloadFile(file)">
<Download />
</el-icon>
<el-icon
class="action-btn action-btn--danger"
@click.stop="removeConsentFile(idx)"
>
<Delete />
</el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint">支持图片和 PDF 格式,可稍后补充</span>
</div>
</div>
<div class="form-col-full">
<div class="section-subtitle" style="margin-top: 8px; margin-bottom: 12px"
>其他附件</div
>
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
ref="otherUploadRef"
:show-file-list="false"
:auto-upload="false"
:multiple="true"
accept="image/*,.pdf,.doc,.docx,.xls,.xlsx"
@change="handleOtherFileChange"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div
v-for="(file, idx) in otherFileList"
:key="file.id || idx"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div class="attachment-preview">
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else-if="isVideoFile(file)">
<div class="attachment-preview__icon attachment-preview__icon--video">
<el-icon :size="28"><VideoPlay /></el-icon>
</div>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{
file.fileName
}}</span>
<div class="attachment-actions">
<el-icon class="action-btn" @click.stop="downloadFile(file)">
<Download />
</el-icon>
<el-icon
class="action-btn action-btn--danger"
@click.stop="removeOtherFile(idx)"
>
<Delete />
</el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint">支持图片、PDF、Word、Excel 等文件</span>
</div>
</div>
</div>
</div>
</div>
@@ -346,6 +474,28 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="输注地点">
<el-input
v-model="infusionPlan.infusionLocation"
placeholder="请输入输注地点,将自动带入各输注计划"
/>
</el-form-item>
<el-form-item label="输注方式">
<el-select
v-model="infusionPlan.infusionMethod"
clearable
filterable
placeholder="请选择输注方式,将自动带入各输注计划"
style="width: 100%"
>
<el-option
v-for="opt in infusionMethodOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
<el-form-item v-if="isYfkOrder" label="方案总金额">
<span class="infusion-amount-summary">
¥{{ formatOrderBalance(infusionPlanTotalAmount) }}
@@ -926,17 +1076,19 @@
needCheckup: 0
})
const diagnosisFileList = ref<
Array<{
id?: string
fileName: string
fileUrl: string
fileSize: number
fileSizeDisplay?: string
fileType?: string
_uploading?: boolean
}>
>([])
type AttachmentFileItem = {
id?: string
fileName: string
fileUrl: string
fileSize: number
fileSizeDisplay?: string
fileType?: string
_uploading?: boolean
}
const diagnosisFileList = ref<AttachmentFileItem[]>([])
const consentFileList = ref<AttachmentFileItem[]>([])
const otherFileList = ref<AttachmentFileItem[]>([])
// ── 渠道 & 服务订单 ────────────────────────────────────────────────────
const channelLoading = ref(false)
@@ -1534,6 +1686,97 @@
}
const diagnosisUploadRef = ref()
const consentUploadRef = ref()
const otherUploadRef = ref()
const uploadAttachmentFile = async (
file: File,
folder: string,
list: { value: AttachmentFileItem[] },
uploadRef: { value?: { clearFiles?: () => void } }
) => {
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
list.value.push({
id: tempId,
fileName: file.name,
fileUrl: '',
fileSize: file.size,
fileSizeDisplay: `${(file.size / 1024).toFixed(1)} KB`,
fileType: file.type || '',
_uploading: true
})
const idx = list.value.length - 1
try {
const fd = new FormData()
fd.append('folder', folder)
fd.append('file', file)
const res: any = await fetchUploadAttachment(fd)
list.value[idx] = {
...list.value[idx],
id: res.id || tempId,
fileName: file.name || res.fileName,
fileUrl: res.fileUrl || res?.data?.fileUrl || res?.data?.url || '',
fileSize: res.fileSize || file.size,
fileSizeDisplay: res.fileSizeDisplay || `${(file.size / 1024).toFixed(1)} KB`,
fileType: res.fileType || file.type || '',
_uploading: false
}
} catch (e: any) {
ElMessage.error(e?.message || '上传失败')
list.value.splice(idx, 1)
} finally {
nextTick(() => uploadRef.value?.clearFiles?.())
}
}
const mapAttachmentFilesFromDetail = (files: Array<Record<string, any>> | undefined) =>
(files || []).map((a) => ({
id: a.id || `existing_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
fileName: a.fileName || a.file_name || '附件',
fileUrl: a.fileUrl || a.file_url || '',
fileSize: a.fileSize ?? a.file_size ?? 0,
fileSizeDisplay: a.fileSizeDisplay || a.file_size_display || '',
fileType: a.fileType || a.file_type || '',
_uploading: false
}))
const mapUrlsToAttachmentFiles = (urlsStr: string) =>
(urlsStr || '')
.split(',')
.filter(Boolean)
.map((url: string) => {
const parts = url.split('/')
const name = decodeURIComponent(parts[parts.length - 1] || '附件')
return {
id: `existing_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
fileName: name,
fileUrl: url,
fileSize: 0,
fileSizeDisplay: '',
fileType: '',
_uploading: false
}
})
const handleConsentFileChange = async (uploadFile: any) => {
const file = uploadFile.raw || uploadFile
if (!file) return
await uploadAttachmentFile(file, 'pilot-application-consent', consentFileList, consentUploadRef)
}
const removeConsentFile = (idx: number) => {
consentFileList.value.splice(idx, 1)
}
const handleOtherFileChange = async (uploadFile: any) => {
const file = uploadFile.raw || uploadFile
if (!file) return
await uploadAttachmentFile(file, 'pilot-application-other', otherFileList, otherUploadRef)
}
const removeOtherFile = (idx: number) => {
otherFileList.value.splice(idx, 1)
}
const handleDiagnosisFileChange = async (uploadFile: any) => {
const file = uploadFile.raw || uploadFile
@@ -1593,6 +1836,8 @@
totalCourseCount: 0,
courseInterval: '',
infusionStartDate: '',
infusionLocation: '',
infusionMethod: '',
channelAgreementId: ''
})
@@ -1746,6 +1991,21 @@
})
}
/** 方案级输注地点/方式 → 同步到各输注计划(新增模式全部;编辑模式仅可编辑计划) */
const syncScheduleLocationAndMethod = () => {
infusionSchedules.value.forEach((s: any) => {
if (!isEdit.value || isScheduleEditable(s)) {
s.infusionLocation = infusionPlan.infusionLocation
s.infusionMethod = infusionPlan.infusionMethod
}
})
}
const defaultScheduleLocationAndMethod = () => ({
infusionLocation: infusionPlan.infusionLocation || '',
infusionMethod: infusionPlan.infusionMethod || ''
})
// 输注开始日期或疗程间隔变化时,重新计算所有计划时间
watch(
() => [infusionPlan.infusionStartDate, infusionPlan.courseInterval],
@@ -1754,6 +2014,13 @@
}
)
watch(
() => [infusionPlan.infusionLocation, infusionPlan.infusionMethod],
() => {
syncScheduleLocationAndMethod()
}
)
watch(
() => infusionPlan.totalCourseCount,
(newCount: number) => {
@@ -1767,8 +2034,7 @@
infusionSchedules.value.push({
_localId: ++scheduleSeq,
infusionTime: computeScheduleTime(i),
infusionLocation: '',
infusionMethod: '',
...defaultScheduleLocationAndMethod(),
amount: null,
_expanded: i === 0,
cellProducts: [] as any[]
@@ -1795,8 +2061,7 @@
infusionSchedules.value.push({
_localId: ++scheduleSeq,
infusionTime: computeScheduleTime(idx),
infusionLocation: '',
infusionMethod: '',
...defaultScheduleLocationAndMethod(),
amount: null,
_expanded: true,
cellProducts: [] as any[]
@@ -1948,10 +2213,14 @@
patientForm.clinicalDiagnosis = ''
patientForm.needCheckup = 0
diagnosisFileList.value = []
consentFileList.value = []
otherFileList.value = []
infusionPlan.id = ''
infusionPlan.totalCourseCount = 0
infusionPlan.courseInterval = ''
infusionPlan.infusionStartDate = ''
infusionPlan.infusionLocation = ''
infusionPlan.infusionMethod = ''
infusionPlan.channelAgreementId = ''
infusionSchedules.value = []
scheduleSeq = 0
@@ -1977,6 +2246,21 @@
formData.channelServiceOrderId = detail.channelServiceOrderId || ''
formData.remark = detail.remark || ''
if (detail.consentAttachmentFiles?.length) {
consentFileList.value = mapAttachmentFilesFromDetail(detail.consentAttachmentFiles)
} else if (detail.consentFormUrls) {
consentFileList.value = mapUrlsToAttachmentFiles(detail.consentFormUrls)
} else {
consentFileList.value = []
}
if (detail.attachmentFiles?.length) {
otherFileList.value = mapAttachmentFilesFromDetail(detail.attachmentFiles)
} else if (detail.attachmentUrls) {
otherFileList.value = mapUrlsToAttachmentFiles(detail.attachmentUrls)
} else {
otherFileList.value = []
}
// 加载渠道后加载服务订单
if (formData.channelId && !isClinical.value) {
try {
@@ -2043,6 +2327,11 @@
infusionPlan.channelAgreementId = ip.channelAgreementId || ''
}
if (detail.infusionSchedules && Array.isArray(detail.infusionSchedules)) {
const firstSchedule = detail.infusionSchedules[0]
if (firstSchedule) {
infusionPlan.infusionLocation = firstSchedule.infusionLocation || ''
infusionPlan.infusionMethod = firstSchedule.infusionMethod || ''
}
infusionSchedules.value = detail.infusionSchedules.map((s: any, i: number) => ({
id: s.id || '',
_localId: ++scheduleSeq,
@@ -2105,6 +2394,22 @@
? undefined
: formData.channelServiceOrderId || undefined,
remark: formData.remark || undefined,
consentAttachments: consentFileList.value.map((a) => ({
id: a.id,
fileName: a.fileName,
fileUrl: a.fileUrl,
fileSize: a.fileSize,
fileSizeDisplay: a.fileSizeDisplay,
fileType: a.fileType
})),
otherAttachments: otherFileList.value.map((a) => ({
id: a.id,
fileName: a.fileName,
fileUrl: a.fileUrl,
fileSize: a.fileSize,
fileSizeDisplay: a.fileSizeDisplay,
fileType: a.fileType
})),
bizType: props.bizType || undefined,
patient: {
customerId: patientForm.customerId || undefined,