<template>
|
<div>
|
<el-dialog
|
:title="title"
|
:visible.sync="dialogVisible"
|
width="1200px"
|
:close-on-click-modal="false"
|
@close="handleClose"
|
>
|
<el-form
|
ref="formRef"
|
:model="formData"
|
:rules="rules"
|
label-width="130px"
|
label-position="right"
|
>
|
<!-- 基础信息部分 -->
|
<el-card header="基础信息" class="form-section">
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item
|
label="当前医疗机构"
|
prop="currentMedicalInstitution"
|
>
|
<el-input
|
v-model="formData.currentMedicalInstitution"
|
placeholder="请输入当前医疗机构"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="当前医疗机构科室" prop="currentDept">
|
<el-input
|
v-model="formData.currentDept"
|
placeholder="请输入当前医疗机构科室"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="首诊医疗机构" prop="firstMedicalInstitution">
|
<el-input
|
v-model="formData.firstMedicalInstitution"
|
placeholder="请输入首诊医疗机构"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="首诊医疗机构科室" prop="firstDept">
|
<el-input
|
v-model="formData.firstDept"
|
placeholder="请输入首诊医疗机构科室"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="捐献编号" prop="caseNo">
|
<el-input
|
v-model="formData.caseNo"
|
placeholder="请输入捐献编号"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="上报医院" prop="treatmenthospitalname">
|
<el-input
|
v-model="formData.treatmenthospitalname"
|
placeholder="请输入上报医院"
|
/>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="11">
|
<el-form-item label="捐献者编号" prop="donorno">
|
<el-input
|
v-model="formData.donorno"
|
placeholder="请输入捐献者编号"
|
/>
|
</el-form-item>
|
</el-col> -->
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item label="姓名" prop="name">
|
<el-input v-model="formData.name" placeholder="必填项" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="性别" prop="sex">
|
<el-select v-model="formData.sex" placeholder="请选择性别">
|
<el-option label="男" value="1" />
|
<el-option label="女" value="2" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="国籍" prop="nationality">
|
<el-input
|
v-model="formData.nationality"
|
placeholder="请输入国籍"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item label="出生日期" prop="birthday">
|
<el-date-picker
|
v-model="formData.birthday"
|
type="date"
|
placeholder="选择出生日期"
|
value-format="yyyy-MM-dd"
|
style="width: 100%"
|
@change="calculateAge"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="年龄" prop="andAge">
|
<el-input v-model="formData.andAge" disabled />
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="民族" prop="nation">
|
<el-select v-model="formData.nation" placeholder="请选择民族">
|
<el-option
|
v-for="dict in dict.type.sys_nation || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="证件类型" prop="idcardtype">
|
<el-select
|
v-model="formData.idcardtype"
|
placeholder="请选择证件类型"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_IDType || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="证件号码" prop="idcardno">
|
<el-input
|
v-model="formData.idcardno"
|
placeholder="请输入证件号码"
|
@blur="handleIdCardBlur"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- <el-row :gutter="20">
|
|
<el-col :span="6">
|
<el-form-item label="学历" prop="education">
|
<el-select
|
v-model="formData.education"
|
placeholder="请选择学历"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_education || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="职业" prop="occupation">
|
<el-select
|
v-model="formData.occupation"
|
placeholder="请选择职业"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_occupation || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="籍贯" prop="nativeplace">
|
<el-input
|
v-model="formData.nativeplace"
|
placeholder="请输入籍贯"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row> -->
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="现居住地" prop="residenceaddress">
|
<li-area-select
|
ref="residenceSelect"
|
v-model="residenceAddress"
|
@change="handleResidenceAddressChange"
|
/>
|
<el-input
|
v-model="formData.residenceaddress"
|
placeholder="请输入详细地址"
|
style="margin-top: 8px"
|
@blur="handleResidenceDetailBlur"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="住址" prop="registeraddress">
|
<li-area-select
|
ref="registerSelect"
|
v-model="registerAddress"
|
@change="handleRegisterAddressChange"
|
/>
|
<el-input
|
v-model="formData.registeraddress"
|
placeholder="请输入详细地址"
|
style="margin-top: 8px"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 医疗信息部分 -->
|
<el-card header="医疗信息" class="form-section">
|
<el-row :gutter="20">
|
<!-- <el-col :span="8">
|
<el-form-item label="入院时间" prop="Reporttothehospital">
|
<el-date-picker
|
v-model="formData.entryTime"
|
type="datetime"
|
placeholder="选择入院时间"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col> -->
|
<el-col :span="8">
|
<el-form-item label="住院号" prop="inpatientno">
|
<el-input
|
v-model="formData.inpatientno"
|
placeholder="请输入住院号"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="血型" prop="bloodtype">
|
<el-radio-group v-model="formData.bloodtype">
|
<el-radio
|
v-for="dict in dict.type.sys_BloodType || []"
|
:key="dict.value"
|
:label="dict.value"
|
>{{ dict.label }}</el-radio
|
>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="Rh(D)" prop="rhyin">
|
<el-radio-group v-model="formData.rhyin">
|
<el-radio
|
v-for="dict in dict.type.sys_bloodtype_rhd || []"
|
:key="dict.value"
|
:label="dict.value"
|
>{{ dict.label }}</el-radio
|
>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="疾病诊断" prop="diagnosisname">
|
<el-input
|
v-model="formData.diagnosisname"
|
placeholder="请输入疾病诊断名称"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<!-- 疾病类型 -->
|
<el-row>
|
<el-col :span="16">
|
<el-form-item label="疾病类型" align="left">
|
<el-checkbox-group v-model="formData.diseasetype">
|
<el-checkbox
|
v-for="dict in dict.type.sys_DiseaseType || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="其他" prop="diseasetypeOther">
|
<el-input
|
v-model="formData.diseasetypeOther"
|
placeholder="请输入其他"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 传染病 -->
|
<el-row>
|
<el-col :span="12">
|
<el-form-item align="left" label="传染病">
|
<el-checkbox-group v-model="formData.infectious">
|
<el-checkbox
|
v-for="dict in dict.type.sys_Infectious || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item align="left" label="其他" prop="infectiousOther">
|
<el-input
|
v-model="formData.infectiousOther"
|
placeholder="请输入其他"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 病人状况和其他情况 -->
|
<el-row>
|
<el-col :span="9">
|
<el-form-item align="left" label="病人状况">
|
<el-checkbox-group v-model="formData.patientstate">
|
<el-checkbox
|
v-for="dict in dict.type.sys_patientstate || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="15" align="left">
|
<el-form-item label="其他情况">
|
<el-checkbox-group v-model="formData.othercases">
|
<el-checkbox
|
v-for="dict in dict.type.sys_OtherCases || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- <el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item label="GCS评分" prop="gcsScore">
|
<el-input
|
v-model="formData.gcsScore"
|
placeholder="请输入GCS评分"
|
/>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="8">
|
<el-form-item label="协调员姓名" prop="coordinatorName">
|
<el-input
|
v-model="formData.coordinatorName"
|
placeholder="请输入协调员姓名"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row> -->
|
|
<!-- <el-row>
|
<el-col :span="24">
|
<el-form-item label="病情概况" prop="illnessoverview">
|
<el-input
|
v-model="formData.illnessoverview"
|
type="textarea"
|
:rows="3"
|
placeholder="请输入病情概况"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row> -->
|
</el-card>
|
<!-- 意愿和亲属信息部分 -->
|
<el-card header="意愿和亲属信息" class="form-section">
|
<!-- 本人意愿 -->
|
<el-row>
|
<el-col :span="24">
|
<el-form-item align="left" label="本人意愿 ">
|
<el-checkbox-group v-model="formData.selfwill">
|
<el-checkbox
|
v-for="dict in dict.type.sys_SelfWill || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 亲属状况 -->
|
<el-row>
|
<el-col :span="12">
|
<el-form-item
|
label="亲属状况"
|
prop="kinship"
|
class="relation"
|
align="left"
|
>
|
<el-checkbox-group v-model="formData.kinship">
|
<el-checkbox
|
v-for="dict in dict.type.sys_Kinship || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="其他" prop="kinshipOther">
|
<el-input
|
v-model="formData.kinshipOther"
|
placeholder="请输入其他"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 主要亲属 -->
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="主要亲属" prop="majorrelatives">
|
<el-input
|
v-model="formData.majorrelatives"
|
placeholder="请输入主要亲属"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="与潜在捐献者关系" prop="familyrelations">
|
<el-select
|
v-model="formData.familyrelations"
|
placeholder="请选择与捐献者关系"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_FamilyRelation || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 信息来源 -->
|
</el-card>
|
<!-- 地址信息部分 -->
|
<!-- <el-card header="地址信息" class="form-section">
|
|
</el-card> -->
|
<!-- 报告信息部分 -->
|
<el-card header="报告信息" class="form-section">
|
<el-row :gutter="20">
|
<!-- <el-col :span="8">
|
<el-form-item label="报告人编号" prop="reporterno">
|
<el-select
|
v-model="formData.reporterno"
|
@change="handleReporterChange"
|
>
|
<el-option
|
v-for="reporter in reporters"
|
:key="reporter.reportNo"
|
:label="reporter.reportName"
|
:value="reporter.reportNo"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col> -->
|
<el-row>
|
<el-col :span="12">
|
<el-form-item align="left" label="信息来源">
|
<el-checkbox-group v-model="formData.infosources">
|
<el-checkbox
|
v-for="dict in dict.type.sys_InfoSources || []"
|
:key="dict.value"
|
:label="dict.value"
|
>
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="其他" prop="infosourcesOther">
|
<el-input
|
v-model="formData.infosourcesOther"
|
placeholder="请输入信息来源其他"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
|
<el-col :span="20">
|
<el-form-item label="获取组织名称" prop="acquisitiontissuename">
|
<el-input
|
v-model="formData.acquisitiontissuename"
|
placeholder="请输入获取组织名称"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- 上报阶段报告人 -->
|
<el-col :span="8">
|
<el-form-item label="上报阶段报告人" prop="reportername">
|
<el-input
|
v-model="formData.reportername"
|
placeholder="报告人姓名"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="报告人联系电话" prop="reporterphone">
|
<el-input
|
v-model="formData.reporterphone"
|
placeholder="报告人联系电话"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="报告时间" prop="reporttime">
|
<el-date-picker
|
v-model="formData.reporttime"
|
type="date"
|
placeholder="选择报告时间"
|
value-format="yyyy-MM-dd "
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
<!-- 报告信息员 -->
|
<el-col :span="8">
|
<el-form-item label="报告信息员" prop="infoName">
|
<el-input
|
v-model="formData.infoName"
|
placeholder="请输入报告信息员"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="信息员联系电话" prop="infophone">
|
<el-input
|
v-model="formData.infophone"
|
placeholder="请输入信息员联系电话"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- <el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="报告时间" prop="reporttime">
|
<el-date-picker
|
v-model="formData.reporttime"
|
type="date"
|
placeholder="选择报告时间"
|
value-format="yyyy-MM-dd "
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="部门ID" prop="deptid">
|
<el-input
|
v-model="formData.deptid"
|
placeholder="请输入部门ID"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row> -->
|
</el-card>
|
|
<!-- 捐献信息部分 -->
|
<!-- <el-card header="捐献信息" class="form-section">
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item label="捐献类别" prop="donationcategory">
|
<el-select
|
v-model="formData.donationcategory"
|
placeholder="请选择捐献类别"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_DonationCategory || []"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="案例上报时间" prop="donatetime">
|
<el-date-picker
|
v-model="formData.donatetime"
|
type="datetime"
|
placeholder="选择案例时间"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="记录状态" prop="recordstate">
|
<el-select v-model="formData.recordstate" :disabled="isEdit">
|
<el-option label="新建" value="0" />
|
<el-option label="已上报" value="1" />
|
<el-option label="审核中" value="2" />
|
<el-option label="已完成" value="3" />
|
<el-option label="已终止" value="99" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row>
|
<el-col :span="8">
|
<el-form-item align="left" label="红十字会" prop="redorganno">
|
|
<el-select
|
v-model="formData.redorganname"
|
placeholder="请选择红十字会机构名称"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_redcrossagency"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="联系人" prop="contactperson">
|
<el-input
|
v-model="formData.contactperson"
|
placeholder="请输入联系人"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="联系时间" prop="contacttime">
|
<el-date-picker
|
v-model="formData.contacttime"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
placeholder="选择报告时间"
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
<el-form-item label="获取组织名称" prop="acquisitiontissuename">
|
<el-input
|
v-model="formData.acquisitiontissuename"
|
placeholder="请输入获取组织名称"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card> -->
|
</el-form>
|
|
<!-- 捐献者登记阶段附件(可编辑,存储于亲属确认表 assessannex) -->
|
<el-card header="登记阶段附件" class="form-section">
|
<el-tabs v-model="activeRegisterType" type="card">
|
<el-tab-pane
|
v-for="type in registerAttachmentTypes"
|
:key="type.value"
|
:label="type.label"
|
:name="type.value"
|
>
|
<div class="attachment-header">
|
<span class="upload-title">{{ type.label }}</span>
|
<el-button
|
size="mini"
|
type="primary"
|
icon="el-icon-plus"
|
@click="openUploadDialog(type.value)"
|
>
|
添加附件
|
</el-button>
|
</div>
|
|
<el-table
|
:data="getRegisterAttachments(type.value)"
|
size="small"
|
style="width: 100%"
|
>
|
<el-table-column label="文件名" min-width="200">
|
<template slot-scope="scope">
|
<i
|
class="el-icon-document"
|
style="color: #409eff; margin-right: 8px"
|
></i>
|
<span>{{ scope.row.fileName }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="文件类型" width="90" align="center">
|
<template slot-scope="scope">
|
<el-tag size="small">{{
|
getFileType(scope.row.fileName)
|
}}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="文件大小" width="90" align="center">
|
<template slot-scope="scope">
|
<span>{{ formatFileSize(scope.row.fileSize) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="上传时间" width="155" align="center">
|
<template slot-scope="scope">
|
<span>{{
|
formatDateTime(scope.row.uploadTime || scope.row.createTime)
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="145" align="center">
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="primary"
|
@click="handlePreview(scope.row)"
|
>
|
预览
|
</el-button>
|
<el-button
|
size="mini"
|
type="danger"
|
@click="handleRemoveAttachment(type.value, scope.$index)"
|
>
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div
|
v-if="getRegisterAttachments(type.value).length === 0"
|
class="empty-attachment"
|
>
|
<el-empty
|
:description="`暂无${type.label}`"
|
:image-size="80"
|
></el-empty>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
</el-card>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="handleClose">取消</el-button>
|
<el-button
|
type="primary"
|
@click="handleSubmit"
|
:loading="submitLoading"
|
>
|
{{ isEdit ? "更新" : "保存" }}
|
</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 上传附件对话框 -->
|
<el-dialog
|
:title="`上传${getCurrentTypeLabel()}附件`"
|
:visible.sync="uploadDialogVisible"
|
width="480px"
|
:close-on-click-modal="false"
|
>
|
<el-upload
|
ref="uploadRef"
|
class="upload-demo"
|
drag
|
:action="uploadAction"
|
:headers="headers"
|
multiple
|
:file-list="tempFileList"
|
:before-upload="beforeUpload"
|
:on-change="handleFileChange"
|
:on-remove="handleTempRemove"
|
:on-success="handleUploadSuccess"
|
:auto-upload="false"
|
>
|
<i class="el-icon-upload"></i>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__tip" slot="tip">
|
支持上传pdf、jpg、png、doc、docx格式文件,单个文件不超过10MB
|
</div>
|
</el-upload>
|
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="uploadDialogVisible = false">取消</el-button>
|
<el-button
|
type="primary"
|
@click="submitUpload"
|
:loading="uploadLoading"
|
:disabled="tempFileList.length === 0"
|
>
|
确认上传
|
</el-button>
|
</span>
|
</el-dialog>
|
|
<!-- 文件预览弹窗 -->
|
<FilePreviewDialog
|
:visible="previewVisible"
|
:file="currentPreviewFile"
|
@close="previewVisible = false"
|
@download="handleDownload"
|
/>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getDonatebaseinfo,
|
updateDonatebaseinfo
|
} from "@/api/project/donatebaseinfo";
|
import { relativesEdit, relativesAdd, relativesList } from "@/api/businessApi";
|
import OrgSelecter from "@/views/project/components/orgselect";
|
import LiAreaSelect from "@/components/Address";
|
import FilePreviewDialog from "@/components/FilePreviewDialog";
|
import { getToken } from "@/utils/auth";
|
|
export default {
|
name: "EditCaseModal",
|
components: {
|
OrgSelecter,
|
LiAreaSelect,
|
FilePreviewDialog
|
},
|
|
// 添加所有需要的字典类型
|
dicts: [
|
"sys_redcrossagency",
|
"sys_bloodtype_rhd",
|
"sys_BloodType",
|
"sys_user_sex",
|
"sys_IDType",
|
"sys_nation",
|
"sys_education",
|
"sys_occupation",
|
"sys_DiseaseType",
|
"sys_Infectious",
|
"sys_patientstate",
|
"sys_OtherCases",
|
"sys_SelfWill",
|
"sys_Kinship",
|
"sys_FamilyRelation",
|
"sys_InfoSources",
|
"sys_DonationCategory"
|
],
|
|
props: {
|
visible: {
|
type: Boolean,
|
default: false
|
},
|
editData: {
|
type: Object,
|
default: () => ({})
|
},
|
dictOptions: {
|
type: Object,
|
default: () => ({})
|
},
|
reporters: {
|
type: Array,
|
default: () => []
|
}
|
},
|
data() {
|
return {
|
isEdit: false,
|
submitLoading: false,
|
residenceAddress: {},
|
registerAddress: {},
|
formData: this.getDefaultFormData(),
|
// 登记阶段附件(可编辑,存储于亲属确认表 assessannex)
|
registerAttachmentTypes: [
|
{ value: "1", label: "人体器官潜在捐献者登记表附件" },
|
{ value: "5", label: "证件照" },
|
{ value: "6", label: "疾病诊断治疗" }
|
],
|
registerAttachmentData: { "1": [], "5": [], "6": [] },
|
otherAttachments: [],
|
confirmationRecord: null,
|
activeRegisterType: "1",
|
uploadAction: process.env.VUE_APP_BASE_API + "/common/upload",
|
headers: { Authorization: "Bearer " + getToken() },
|
uploadDialogVisible: false,
|
uploadLoading: false,
|
tempFileList: [],
|
currentUploadType: "",
|
previewVisible: false,
|
currentPreviewFile: null,
|
rules: {
|
name: [
|
{ required: true, message: "请输入捐献者姓名", trigger: "blur" }
|
],
|
caseNo: [
|
{ required: true, message: "请输入捐献者编号", trigger: "blur" }
|
],
|
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
|
idcardtype: [
|
{ required: true, message: "请选择证件类型", trigger: "change" }
|
],
|
idcardno: [
|
{ required: true, message: "请输入证件号码", trigger: "blur" }
|
],
|
birthday: [
|
{ required: true, message: "请选择出生日期", trigger: "change" }
|
],
|
treatmenthospitalno: [
|
{ required: true, message: "请选择首诊医院", trigger: "change" }
|
],
|
diagnosisname: [
|
{ required: true, message: "请输入疾病诊断", trigger: "blur" }
|
],
|
bloodtype: [
|
{ required: true, message: "请选择血型", trigger: "change" }
|
],
|
// donatetime: [
|
// { required: true, message: "请选择案例时间", trigger: "change" }
|
// ],
|
reporttime: [
|
{ required: true, message: "请选择报告时间", trigger: "change" }
|
],
|
residenceaddress: [
|
{ required: true, message: "请输入现居住地详细地址", trigger: "blur" }
|
],
|
registeraddress: [
|
{ required: true, message: "请输入住址详细地址", trigger: "blur" }
|
]
|
}
|
};
|
},
|
computed: {
|
title() {
|
return this.isEdit ? "编辑案例信息" : "新增捐献案例";
|
},
|
dialogVisible: {
|
get() {
|
return this.visible;
|
},
|
set(value) {
|
this.$emit("update:visible", value);
|
if (!value) {
|
this.handleClose();
|
}
|
}
|
},
|
},
|
watch: {
|
visible(newVal) {
|
console.log("visible变化:", newVal);
|
if (newVal) {
|
this.$nextTick(() => {
|
this.initForm();
|
});
|
} else {
|
this.handleClose();
|
}
|
},
|
editData: {
|
immediate: true,
|
deep: true,
|
handler(newVal) {
|
console.log("editData变化:", newVal);
|
this.isEdit = !!(newVal && newVal.id);
|
}
|
}
|
},
|
created() {
|
console.log("EditCaseModal created");
|
console.log("visible:", this.visible);
|
console.log("editData:", this.editData);
|
},
|
mounted() {
|
console.log("EditCaseModal mounted");
|
console.log("visible:", this.visible);
|
console.log("editData:", this.editData);
|
console.log("isEdit:", this.isEdit);
|
},
|
methods: {
|
getDefaultFormData() {
|
return {
|
// 基础信息
|
caseNo: null,
|
donorno: null,
|
donateno: null,
|
name: null,
|
sex: null,
|
idcardtype: null,
|
idcardno: null,
|
birthday: null,
|
andAge: "",
|
age: null,
|
ageunit: "年",
|
age2: null,
|
ageunit2: "月",
|
nation: null,
|
nationality: "中国",
|
nativeplace: null,
|
phone: null,
|
education: null,
|
occupation: null,
|
|
// 医疗信息
|
treatmenthospitalno: null,
|
treatmenthospitalname: null,
|
treatmentdeptname: null,
|
inpatientno: null,
|
diagnosisname: null,
|
bloodtype: "0",
|
rhyin: "0",
|
currentMedicalInstitution: null,
|
currentDept: null,
|
firstMedicalInstitution: null,
|
firstDept: null,
|
gcsScore: null,
|
illnessoverview: null,
|
coordinatorNo: null,
|
coordinatorName: null,
|
diseasetype: [],
|
infectious: [],
|
patientstate: [],
|
othercases: [],
|
|
// 地址信息
|
residenceaddress: null,
|
residenceprovince: null,
|
residencecity: null,
|
residencetown: null,
|
registeraddress: null,
|
registerprovince: null,
|
registercity: null,
|
registertown: null,
|
|
// 意愿和亲属信息
|
selfwill: [],
|
kinship: [],
|
majorrelatives: null,
|
familyrelations: null,
|
infosources: [],
|
infoName: null,
|
infophone: null,
|
redorganno: null,
|
contactperson: null,
|
contacttime: null,
|
|
// 捐献信息
|
donationcategory: null,
|
donatetime: null,
|
recordstate: "0",
|
acquisitiontissuename: "青岛大学附属医院",
|
|
// 报告信息
|
reporterno: null,
|
reportername: null,
|
reporterphone: null,
|
reporttime: null,
|
deptid: null,
|
|
// 其他字段
|
diseasetypeOther: null,
|
infectiousOther: null,
|
kinshipOther: null,
|
infosourcesOther: null
|
};
|
},
|
|
async initForm() {
|
console.log("初始化表单,isEdit:", this.isEdit);
|
try {
|
if (this.isEdit && this.editData && this.editData.id) {
|
console.log("加载编辑数据,id:", this.editData.id);
|
await this.loadEditData();
|
} else {
|
console.log("新增模式,初始化表单");
|
this.formData = this.getDefaultFormData();
|
this.formData.nationality = "中国";
|
this.formData.bloodtype = "0";
|
this.formData.rhyin = "0";
|
this.formData.recordstate = "0";
|
this.formData.acquisitiontissuename = "青岛大学附属医院";
|
|
// 设置信息员和电话默认值
|
this.formData.infoName = "孙文月";
|
this.formData.infophone = "18661808259";
|
}
|
} catch (error) {
|
console.error("初始化表单失败:", error);
|
this.$message.error("初始化表单失败");
|
} finally {
|
this.$nextTick(() => {
|
if (this.$refs.formRef) {
|
this.$refs.formRef.clearValidate();
|
}
|
});
|
}
|
},
|
|
async loadEditData() {
|
try {
|
const response = await getDonatebaseinfo(this.editData.id);
|
response.data.firstMedicalInstitution =
|
response.data.treatmenthospitalname;
|
const data = response.data;
|
console.log("加载到的数据:", data);
|
|
// 处理数组字段
|
const arrayFields = [
|
"diseasetype",
|
"infectious",
|
"selfwill",
|
"othercases",
|
"infosources",
|
"kinship",
|
"patientstate"
|
];
|
arrayFields.forEach(field => {
|
if (data[field] && typeof data[field] === "string") {
|
data[field] = data[field].split(",");
|
} else if (!data[field]) {
|
data[field] = [];
|
}
|
});
|
|
this.formData = { ...this.getDefaultFormData(), ...data };
|
console.log("合并后的formData:", this.formData);
|
this.formData.infoName = "孙文月";
|
this.formData.infophone = "18661808259";
|
if (!this.formData.currentMedicalInstitution)
|
this.formData.currentMedicalInstitution = "青岛大学附属医院";
|
|
if (!this.formDatacurrentDept) this.formData.currentDept = "器官捐献科";
|
// 根据返回数据设置地址展示信息
|
if (data.residenceprovincename) {
|
this.residenceAddress = {
|
sheng: data.residenceprovincename,
|
shi: data.residencecountyname,
|
qu: data.residencecommunityname
|
};
|
}
|
// 户籍地址
|
if (data.registerprovince) {
|
this.registerAddress = {
|
sheng: data.registerprovince,
|
shi: data.registercityname,
|
qu: data.registercommunityname
|
};
|
}
|
console.log(this.registerAddress, "registerAddress12");
|
|
this.calculateAge(data.birthday);
|
await this.loadRegisterAttachments();
|
} catch (error) {
|
console.error("获取案例数据失败:", error);
|
this.$message.error("获取案例数据失败");
|
this.handleClose();
|
}
|
},
|
|
handleIdCardBlur() {
|
this.updateMessage();
|
},
|
|
updateMessage() {
|
const idCardReg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
if (idCardReg.test(this.formData.idcardno)) {
|
const orgBirthday = this.formData.idcardno.substring(6, 14);
|
const orgGender = this.formData.idcardno.substring(16, 17);
|
|
const sex = orgGender % 2 == 1 ? "1" : "2";
|
const birthday = `${orgBirthday.substring(
|
0,
|
4
|
)}-${orgBirthday.substring(4, 6)}-${orgBirthday.substring(6, 8)}`;
|
|
this.formData.sex = sex;
|
this.formData.birthday = birthday;
|
this.calculateAge(birthday);
|
}
|
},
|
|
calculateAge(birthday) {
|
if (!birthday) {
|
this.formData.age = this.formData.age2 = null;
|
this.formData.andAge = "";
|
return;
|
}
|
|
const birthDate = new Date(birthday);
|
const today = new Date();
|
|
let yearDiff = today.getFullYear() - birthDate.getFullYear();
|
let monthDiff = today.getMonth() - birthDate.getMonth();
|
let dayDiff = today.getDate() - birthDate.getDate();
|
|
if (dayDiff < 0) {
|
monthDiff--;
|
const lastDayOfMonth = new Date(
|
today.getFullYear(),
|
today.getMonth(),
|
0
|
).getDate();
|
dayDiff += lastDayOfMonth;
|
}
|
|
if (monthDiff < 0) {
|
yearDiff--;
|
monthDiff += 12;
|
}
|
|
this.formData.age = yearDiff;
|
this.formData.ageunit = "岁";
|
this.formData.age2 = monthDiff;
|
this.formData.ageunit2 = "月";
|
|
if (yearDiff === 0) {
|
if (monthDiff === 0) {
|
this.formData.age = dayDiff;
|
this.formData.ageunit = "天";
|
this.formData.age2 = null;
|
} else {
|
this.formData.age = monthDiff;
|
this.formData.ageunit = "月";
|
this.formData.age2 = dayDiff;
|
this.formData.ageunit2 = "天";
|
}
|
}
|
|
this.formData.andAge = [
|
this.formData.age && this.formData.age !== 0
|
? `${this.formData.age}${this.formData.ageunit}`
|
: "",
|
this.formData.age2 && this.formData.age2 !== 0
|
? `${this.formData.age2}${this.formData.ageunit2}`
|
: ""
|
]
|
.filter(Boolean)
|
.join(" ");
|
},
|
|
handleHospitalChange(hospitalInfo) {
|
if (hospitalInfo && hospitalInfo.organizationname) {
|
this.formData.treatmenthospitalname = hospitalInfo.organizationname;
|
}
|
},
|
|
handleReporterChange(reporterNo) {
|
const reporter = this.reporters.find(r => r.reportNo === reporterNo);
|
if (reporter) {
|
this.formData.reportername = reporter.reportName;
|
}
|
},
|
|
handleResidenceAddressChange(address) {
|
this.formData.residenceprovincename = address.sheng;
|
this.formData.residencecountyname = address.shi;
|
this.formData.residencecommunityname = address.qu;
|
|
// 每次现住址省市区变化时,如果户籍地址的省市区完全为空,则自动填充
|
const registerProvinceEmpty = !this.formData.registerprovince;
|
const registerCityEmpty = !this.formData.registercityname;
|
const registerTownEmpty = !this.formData.registercommunityname;
|
|
if (registerProvinceEmpty || registerCityEmpty || registerTownEmpty) {
|
this.formData.registerprovince = address.sheng;
|
this.formData.registercityname = address.shi;
|
this.formData.registercommunityname = address.qu;
|
this.registerAddress = {
|
sheng: address.sheng,
|
shi: address.shi,
|
qu: address.qu
|
};
|
}
|
},
|
// 现居住地详细地址失焦时,如果住址详细地址为空则自动填充
|
handleResidenceDetailBlur() {
|
if (this.formData.residenceaddress && !this.formData.registeraddress) {
|
this.formData.registeraddress = this.formData.residenceaddress;
|
}
|
},
|
handleRegisterAddressChange(address) {
|
console.log(this.registerAddress, "registerAddress11");
|
|
this.formData.registerprovince = address.sheng;
|
this.formData.registercityname = address.shi;
|
this.formData.registercommunityname = address.qu;
|
},
|
|
// 加载登记阶段附件(读取亲属确认表 assessannex,与确认详情页共用同一份数据)
|
// 捐献确认信息统一通过 confirmationBaseInfoList 接口获取
|
async loadRegisterAttachments() {
|
const infoid = this.editData && this.editData.id;
|
if (!infoid) {
|
this.resetAttachments();
|
return;
|
}
|
try {
|
const res = await relativesList({ infoid });
|
const record = this.parseConfirmationBaseInfo(res);
|
if (record && record.id) {
|
this.confirmationRecord = record;
|
this.parseAssessannex(record.assessannex);
|
} else {
|
this.confirmationRecord = null;
|
this.resetAttachments();
|
}
|
} catch (e) {
|
console.warn("获取亲属确认附件失败:", e);
|
this.resetAttachments();
|
}
|
},
|
|
// 解析 confirmationBaseInfoList 返回的确认基础信息(兼容数组 / rows / 单对象结构)
|
parseConfirmationBaseInfo(res) {
|
if (!res || res.code !== 200) return null;
|
const data = res.data;
|
if (!data) return null;
|
if (Array.isArray(data)) return data[0] || null;
|
if (Array.isArray(data.rows)) return data.rows[0] || null;
|
if (Array.isArray(data.list)) return data.list[0] || null;
|
return data;
|
},
|
|
resetAttachments() {
|
Object.keys(this.registerAttachmentData).forEach(key => {
|
this.registerAttachmentData[key] = [];
|
});
|
this.otherAttachments = [];
|
},
|
|
parseAssessannex(assessannex) {
|
this.resetAttachments();
|
if (!assessannex) return;
|
try {
|
const list =
|
typeof assessannex === "string" ? JSON.parse(assessannex) : assessannex;
|
if (!Array.isArray(list)) return;
|
list.forEach(item => {
|
const type = String(item.type || "");
|
if (this.registerAttachmentData[type]) {
|
this.registerAttachmentData[type].push(item);
|
} else {
|
this.otherAttachments.push(item);
|
}
|
});
|
} catch (e) {
|
console.warn("解析assessannex失败:", e);
|
}
|
},
|
|
getRegisterAttachments(type) {
|
return this.registerAttachmentData[type] || [];
|
},
|
|
// 序列化登记阶段附件,并保留确认阶段等其他附件
|
serializeAssessannex() {
|
const all = [...this.otherAttachments];
|
this.registerAttachmentTypes.forEach(t => {
|
all.push(...(this.registerAttachmentData[t.value] || []));
|
});
|
return JSON.stringify(all);
|
},
|
|
getCurrentTypeLabel() {
|
const type = this.registerAttachmentTypes.find(
|
t => t.value === this.currentUploadType
|
);
|
return type ? type.label : "";
|
},
|
|
openUploadDialog(type) {
|
this.currentUploadType = type;
|
this.tempFileList = [];
|
this.uploadDialogVisible = true;
|
this.$nextTick(() => {
|
if (this.$refs.uploadRef) {
|
this.$refs.uploadRef.clearFiles();
|
}
|
});
|
},
|
|
beforeUpload(file) {
|
const allowedTypes = [
|
"application/pdf",
|
"image/jpeg",
|
"image/png",
|
"application/msword",
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
];
|
const maxSize = 10 * 1024 * 1024;
|
const isTypeOk =
|
allowedTypes.includes(file.type) ||
|
file.name.endsWith(".pdf") ||
|
file.name.endsWith(".jpg") ||
|
file.name.endsWith(".jpeg") ||
|
file.name.endsWith(".png") ||
|
file.name.endsWith(".doc") ||
|
file.name.endsWith(".docx");
|
if (!isTypeOk) {
|
this.$message.error(
|
"文件格式不支持,请上传pdf、jpg、png、doc或docx格式文件"
|
);
|
return false;
|
}
|
if (file.size > maxSize) {
|
this.$message.error("文件大小不能超过10MB");
|
return false;
|
}
|
return true;
|
},
|
|
handleFileChange(file, fileList) {
|
this.tempFileList = fileList;
|
},
|
|
handleTempRemove(file, fileList) {
|
this.tempFileList = fileList;
|
},
|
|
handleUploadSuccess(response, file) {
|
if (response.code !== 200) {
|
this.$message.error(response.msg || "上传失败");
|
return;
|
}
|
const newAttachment = {
|
id: Date.now(),
|
fileName: file.name,
|
fileUrl: response.url,
|
fileSize: file.size,
|
fileType: this.getFileExtension(file.name),
|
type: this.currentUploadType,
|
uploadTime: this.getCurrentTime(),
|
uploader: "当前用户"
|
};
|
if (this.registerAttachmentData[this.currentUploadType]) {
|
this.registerAttachmentData[this.currentUploadType].push(newAttachment);
|
}
|
this.$message.success("上传成功");
|
this.uploadLoading = false;
|
this.uploadDialogVisible = false;
|
this.tempFileList = [];
|
},
|
|
submitUpload() {
|
if (this.tempFileList.length === 0) {
|
this.$message.warning("请先选择要上传的文件");
|
return;
|
}
|
this.uploadLoading = true;
|
this.$refs.uploadRef.submit();
|
},
|
|
handleRemoveAttachment(type, index) {
|
this.$confirm("确定要删除这个附件吗?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
const container = this.registerAttachmentData[type];
|
if (container && container[index]) {
|
container.splice(index, 1);
|
this.$message.success("附件删除成功");
|
}
|
})
|
.catch(() => {});
|
},
|
|
handlePreview(file) {
|
this.currentPreviewFile = {
|
fileName: file.fileName,
|
fileUrl: file.fileUrl,
|
fileType: this.getFileType(file.fileName)
|
};
|
this.previewVisible = true;
|
},
|
|
handleDownload(file) {
|
const fileUrl = file.fileUrl;
|
const fileName = file.fileName;
|
if (fileUrl) {
|
const link = document.createElement("a");
|
link.href = fileUrl;
|
link.download = fileName;
|
link.style.display = "none";
|
document.body.appendChild(link);
|
link.click();
|
document.body.removeChild(link);
|
this.$message.success("开始下载文件");
|
} else {
|
this.$message.warning("文件路径不存在,无法下载");
|
}
|
},
|
|
getFileType(fileName) {
|
if (!fileName) return "other";
|
const extension = this.getFileExtension(fileName);
|
const imageTypes = ["jpg", "jpeg", "png"];
|
const pdfTypes = ["pdf"];
|
const officeTypes = ["doc", "docx"];
|
if (imageTypes.includes(extension)) return "image";
|
if (pdfTypes.includes(extension)) return "pdf";
|
if (officeTypes.includes(extension)) return "office";
|
return "other";
|
},
|
|
getFileExtension(filename) {
|
return filename
|
.split(".")
|
.pop()
|
.toLowerCase();
|
},
|
|
formatFileSize(size) {
|
if (!size) return "0 B";
|
const k = 1024;
|
const sizes = ["B", "KB", "MB", "GB"];
|
const i = Math.floor(Math.log(size) / Math.log(k));
|
return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
},
|
|
formatDateTime(dateTime) {
|
if (!dateTime) return "";
|
try {
|
const date = new Date(dateTime);
|
if (isNaN(date.getTime())) return dateTime;
|
const year = date.getFullYear();
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
const day = String(date.getDate()).padStart(2, "0");
|
const hours = String(date.getHours()).padStart(2, "0");
|
const minutes = String(date.getMinutes()).padStart(2, "0");
|
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
} catch (error) {
|
return dateTime;
|
}
|
},
|
|
getCurrentTime() {
|
const now = new Date();
|
return `${now.getFullYear()}-${(now.getMonth() + 1)
|
.toString()
|
.padStart(2, "0")}-${now
|
.getDate()
|
.toString()
|
.padStart(2, "0")} ${now
|
.getHours()
|
.toString()
|
.padStart(2, "0")}:${now
|
.getMinutes()
|
.toString()
|
.padStart(2, "0")}:${now
|
.getSeconds()
|
.toString()
|
.padStart(2, "0")}`;
|
},
|
|
// 保存登记阶段附件到亲属确认表 assessannex
|
async saveAssessannex() {
|
const infoid = this.formData.id;
|
if (!infoid) return;
|
const assessannex = this.serializeAssessannex();
|
try {
|
if (this.confirmationRecord && this.confirmationRecord.id) {
|
// 已存在确认表记录:仅更新附件字段,保留其余信息
|
await relativesEdit({ ...this.confirmationRecord, assessannex });
|
} else {
|
// 确认表记录不存在:新增完整记录(携带登记表基础信息)
|
await relativesAdd(this.buildConfirmationRecord(infoid, assessannex));
|
}
|
} catch (e) {
|
console.warn("保存登记阶段附件失败:", e);
|
this.$message.warning("登记阶段附件保存失败,请重试");
|
}
|
},
|
|
// 构建新增亲属确认表记录:携带捐献者基础信息,而非仅 infoid + assessannex
|
buildConfirmationRecord(infoid, assessannex) {
|
const f = this.formData;
|
return {
|
infoid,
|
caseNo: f.caseNo || "",
|
name: f.name || "",
|
sex: f.sex || "",
|
age: f.age != null ? f.age : "",
|
diagnosisname: f.diagnosisname || "",
|
treatmenthospitalname: f.treatmenthospitalname || "",
|
relativeconfirmationsign: "0",
|
state: 2,
|
assessannex
|
};
|
},
|
|
handleClose() {
|
console.log("关闭弹框");
|
this.isEdit = false;
|
this.submitLoading = false;
|
this.formData = this.getDefaultFormData();
|
this.residenceAddress = {};
|
this.registerAddress = {};
|
this.resetAttachments();
|
this.$emit("closed");
|
},
|
|
async handleSubmit() {
|
const valid = await this.$refs.formRef.validate().catch(() => false);
|
if (!valid) {
|
this.$message.error("请确认表单必填信息完整后提交");
|
return;
|
}
|
// 额外校验现居住地和住址的省市区是否已选择
|
if (
|
!this.formData.residenceprovincename ||
|
!this.formData.residencecountyname
|
) {
|
this.$message.error("请完善现居住地的省市区信息");
|
return;
|
}
|
if (!this.formData.registerprovince || !this.formData.registercityname) {
|
this.$message.error("请完善住址的省市区信息");
|
return;
|
}
|
this.submitLoading = true;
|
try {
|
const submitData = this.processSubmitData();
|
console.log("提交数据:", submitData);
|
|
const result = await updateDonatebaseinfo(submitData);
|
if (result.code === 200) {
|
await this.saveAssessannex();
|
this.$message.success(this.isEdit ? "更新成功" : "新增成功");
|
this.$emit("success", result.data);
|
console.log(1122);
|
|
this.handleClose();
|
} else {
|
this.$message.error(result.msg || "操作失败");
|
}
|
} catch (error) {
|
console.error("操作失败:", error);
|
this.$message.error("操作失败");
|
} finally {
|
this.submitLoading = false;
|
}
|
},
|
|
processSubmitData() {
|
const data = { ...this.formData };
|
|
// 处理数组字段为字符串
|
const arrayFields = [
|
"diseasetype",
|
"infectious",
|
"selfwill",
|
"othercases",
|
"infosources",
|
"kinship",
|
"patientstate"
|
];
|
arrayFields.forEach(field => {
|
if (Array.isArray(data[field])) {
|
data[field] = data[field].join(",");
|
} else if (!data[field]) {
|
data[field] = "";
|
}
|
});
|
|
// 处理日期字段
|
if (data.birthday) {
|
data.birthday = this.$moment(data.birthday).format(
|
"YYYY-MM-DD HH:mm:ss"
|
);
|
}
|
if (data.reporttime) {
|
data.reporttime = this.$moment(data.reporttime).format(
|
"YYYY-MM-DD HH:mm:ss"
|
);
|
}
|
if (data.donatetime) {
|
data.donatetime = this.$moment(data.donatetime).format(
|
"YYYY-MM-DD HH:mm:ss"
|
);
|
}
|
if (data.contacttime) {
|
data.contacttime = this.$moment(data.contacttime).format(
|
"YYYY-MM-DD HH:mm:ss"
|
);
|
}
|
|
// 设置默认值
|
if (!data.recordstate) {
|
data.recordstate = "0";
|
}
|
if (!data.workflow) {
|
data.workflow = 0;
|
}
|
|
return data;
|
},
|
}
|
};
|
</script>
|
|
<style scoped>
|
.form-section {
|
margin-bottom: 20px;
|
}
|
|
.form-section:last-child {
|
margin-bottom: 0;
|
}
|
|
.attachment-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin-bottom: 12px;
|
}
|
|
.upload-title {
|
font-size: 14px;
|
font-weight: 600;
|
color: #303133;
|
}
|
|
.empty-attachment {
|
padding: 12px 0;
|
}
|
</style>
|