<template>
|
<div class="app-container">
|
<!-- 搜索筛选区域 -->
|
<el-card class="filter-card">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" class="demo-form-inline">
|
<el-form-item label="姓名" prop="name">
|
<el-input v-model="queryParams.name" placeholder="请输入患者姓名" clearable style="width: 200px" />
|
</el-form-item>
|
<el-form-item label="上报医院" prop="caseNo">
|
<el-input v-model="queryParams.caseNo" placeholder="请输入上报案例编号" clearable style="width: 200px" />
|
</el-form-item>
|
<el-form-item label="上报状态" prop="reportStatus">
|
<el-select v-model="queryParams.reportStatus" placeholder="请选择状态" clearable style="width: 200px">
|
<el-option label="全部" value="" />
|
<el-option label="已阅读" value="2" />
|
<el-option label="已同意" value="3" />
|
<el-option label="已驳回" value="4" />
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
|
<!-- 操作按钮区域 - 修改删除按钮的禁用条件 -->
|
<el-row :gutter="10" class="mb8">
|
<el-col :span="1.5">
|
<el-button type="danger" plain icon="el-icon-delete" :disabled="multiple || hasApprovedSelected()"
|
@click="handleDelete">
|
删除
|
</el-button>
|
</el-col>
|
</el-row>
|
|
<!-- 数据表格 -->
|
<el-table v-loading="loading" :data="caseList" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="编号" align="center" prop="caseNo" width="150" fixed />
|
<el-table-column label="姓名" align="center" prop="name" width="100" fixed />
|
<el-table-column label="上报状态" align="center" prop="reportStatus" width="100">
|
<template #default="scope">
|
<el-tag :type="scope.row.reportStatus | statusFilter">
|
{{ scope.row.reportStatus | statusTextFilter }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="转运" align="center" width="100">
|
<template #default="scope">
|
<el-tag :type="getTransportStatusTag(scope.row)">
|
{{ getTransportStatusText(scope.row) }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="性别" align="center" prop="sex" width="80">
|
<template #default="scope">
|
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
|
</template>
|
</el-table-column>
|
<el-table-column label="年龄" align="center" prop="age" width="80" />
|
<el-table-column label="血型" align="center" prop="bloodType" width="80">
|
<template #default="scope">
|
<dict-tag :options="dict.type.sys_BloodType" :value="scope.row.bloodType" />
|
</template>
|
</el-table-column>
|
<el-table-column label="疾病诊断" align="center" prop="diagnosisname" min-width="200" show-overflow-tooltip />
|
<el-table-column label="GCS评分" align="center" prop="gcsScore" width="80" show-overflow-tooltip />
|
<el-table-column label="上报医院" align="center" prop="treatmenthospitalname" width="150" />
|
<el-table-column label="上报时间" align="center" prop="reporttime" width="160" />
|
<el-table-column label="操作" align="center" fixed="right" width="300">
|
<template #default="scope">
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)">详情</el-button>
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" icon="el-icon-check" @click="handleApprove(scope.row)"
|
v-if="scope.row.reportStatus == '2' && scope.row.delFlag == 0">确认</el-button>
|
<!-- 移除转运按钮 -->
|
<el-button v-if="scope.row.serviceTransport.length" size="mini" type="primary"
|
@click="goToTransportDetail(scope.row.name)">查看转运单</el-button>
|
<el-button v-if="
|
scope.row.reportStatus == 3 &&
|
!scope.row.serviceTransport.length &&
|
scope.row.isTransport == 2
|
" size="mini" type="success" @click="Createatransferorder(scope.row)">创建转运单</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!-- 分页 -->
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
@pagination="getList" />
|
|
<!-- 案例详情弹框 -->
|
<el-dialog :title="detailTitle" :visible.sync="detailOpen" width="900px" append-to-body
|
:close-on-click-modal="false">
|
<case-detail :caseData="currentCase" @close="detailOpen = false" />
|
</el-dialog>
|
|
<!-- 确认弹框 -->
|
<el-dialog title="案例确认" :visible.sync="approveOpen" width="80vw" append-to-body class="approve-dialog">
|
<!-- 使用 div 布局替代 el-container -->
|
<div class="approve-dialog-content">
|
<!-- 左侧:案例详情 -->
|
<div class="approve-detail-left">
|
<div class="approve-detail-preview">
|
<h3 style="margin-bottom: 15px; color: #303133;">案例详情预览</h3>
|
<case-detail :caseData="currentCase" :showtitle="false" />
|
</div>
|
</div>
|
|
<!-- 右侧:确认表单 -->
|
<div class="approve-form-right">
|
<el-form ref="approveForm" :model="approveForm" :rules="approveRules" label-width="100px">
|
<el-form-item label="确认结果" prop="approveResult">
|
<el-radio-group v-model="approveForm.approveResult" @change="handleApproveResultChange">
|
<el-radio label="3">同意</el-radio>
|
<el-radio label="4">驳回</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
|
<!-- 当选择"同意"时显示转运选项 -->
|
<el-form-item v-if="approveForm.approveResult == '3'" label="是否需要转运" prop="isTransport">
|
<el-radio-group v-model="approveForm.isTransport">
|
<el-radio label="1">不需要</el-radio>
|
<el-radio label="2">需要</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
|
<!-- 当选择"驳回"时显示驳回原因 -->
|
<div v-if="approveForm.approveResult == '4'">
|
<el-form-item label="驳回原因" prop="rejectType">
|
<el-radio-group v-model="approveForm.rejectType">
|
<el-radio label="1">好转</el-radio>
|
<el-radio label="2">死亡</el-radio>
|
<el-radio label="3">不符合捐献标准</el-radio>
|
<el-radio label="4">家属放弃捐献</el-radio>
|
<el-radio label="5">其他</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
|
<el-form-item label="驳回意见" prop="confirmResult">
|
<el-input type="textarea" v-model="approveForm.confirmResult" placeholder="请输入详细的驳回意见" :rows="6"
|
maxlength="500" show-word-limit />
|
</el-form-item>
|
</div>
|
|
<!-- 当选择"同意"时显示确认意见 -->
|
<el-form-item v-if="approveForm.approveResult == '3'" label="确认意见" prop="confirmResult">
|
<el-input type="textarea" v-model="approveForm.confirmResult" placeholder="请输入确认意见" :rows="6"
|
maxlength="500" show-word-limit />
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="approveOpen = false">取消</el-button>
|
<el-button type="primary" @click="submitApprove">确定</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 新增/编辑案例弹框 -->
|
<el-dialog :title="`${isEditing ? '编辑' : '新增'}案例`" :visible.sync="editOpen" width="68%" append-to-body
|
:close-on-click-modal="false" @close="handleEditClose">
|
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="120px">
|
<!-- 基本信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-user" style="color: #409EFF; margin-right: 8px;"></i>
|
<span>基本信息</span>
|
</div>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="案例编号" prop="caseNo">
|
<el-input v-model="editForm.caseNo" placeholder="请输入案例编号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="患者姓名" prop="name">
|
<el-input v-model="editForm.name" placeholder="请输入患者姓名" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="性别" prop="sex">
|
<el-select v-model="editForm.sex" placeholder="请选择性别" style="width: 100%">
|
<el-option label="男" value="1" />
|
<el-option label="女" value="2" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="年龄" prop="age">
|
<el-input-number v-model="editForm.age" :min="0" :max="120" placeholder="请输入年龄" style="width: 100%" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="年龄单位" prop="ageunit">
|
<el-select v-model="editForm.ageunit" placeholder="请选择年龄单位" style="width: 100%">
|
<el-option label="岁" value="year" />
|
<el-option label="月" value="month" />
|
<el-option label="天" value="day" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="血型" prop="bloodType">
|
<el-select v-model="editForm.bloodType" placeholder="请选择血型" style="width: 100%">
|
<el-option label="A型" :value="'A型'" />
|
<el-option label="B型" :value="'B型'" />
|
<el-option label="O型" :value="'O型'" />
|
<el-option label="AB型" :value="'AB型'" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="Rh阴性" prop="rhYin">
|
<el-radio-group v-model="editForm.rhYin">
|
<el-radio label="0">否</el-radio>
|
<el-radio label="1">是</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="出生日期" prop="birthday">
|
<el-date-picker v-model="editForm.birthday" type="date" placeholder="选择出生日期" value-format="yyyy-MM-dd"
|
style="width: 100%" />
|
</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="editForm.idcardtype" placeholder="请选择证件类型" style="width: 100%">
|
<el-option v-for="item in dict.type.sys_IDType" :label="item.label" :value="item.value" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="证件号码" prop="idcardno">
|
<el-input v-model="editForm.idcardno" placeholder="请输入证件号码" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="民族" prop="nation">
|
<el-input v-model="editForm.nation" placeholder="请输入民族" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="国籍" prop="nationality">
|
<el-input v-model="editForm.nationality" placeholder="请输入国籍" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="籍贯" prop="nativeplace">
|
<el-input v-model="editForm.nativeplace" placeholder="请输入籍贯" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="学历" prop="education">
|
<!-- <el-input v-model="editForm.education" placeholder="请输入学历" /> -->
|
<el-select v-model="editForm.education" placeholder="请选择学历类型" style="width: 100%">
|
<el-option v-for="item in dict.type.sys_education" :label="item.label" :value="item.value" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="职业" prop="occupation">
|
<!-- <el-input v-model="editForm.occupation" placeholder="请输入职业" /> -->
|
<el-select v-model="editForm.occupation" placeholder="请选择职业类型" style="width: 100%">
|
<el-option v-for="item in dict.type.sys_occupation" :label="item.label" :value="item.value" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="联系电话" prop="phone">
|
<el-input v-model="editForm.phone" placeholder="请输入联系电话" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 地址信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-location-information" style="color: #67C23A; margin-right: 8px;"></i>
|
<span>地址信息</span>
|
</div>
|
|
<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="editForm.residenceaddress" placeholder="请输入详细地址" style="margin-top: 8px" />
|
</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="editForm.registeraddress" placeholder="请输入详细地址" style="margin-top: 8px" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 医疗信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-first-aid-kit" style="color: #E6A23C; margin-right: 8px;"></i>
|
<span>医疗信息</span>
|
</div>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="疾病诊断" prop="diagnosisname">
|
<el-input v-model="editForm.diagnosisname" placeholder="请输入疾病诊断名称" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="GCS评分" prop="gcsScore">
|
<el-input v-model="editForm.gcsScore" placeholder="请输入GCS评分" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-form-item label="病情概况" prop="illnessoverview">
|
<el-input v-model="editForm.illnessoverview" type="textarea" :rows="3" placeholder="请输入病情概况" maxlength="500"
|
show-word-limit />
|
</el-form-item>
|
|
<el-form-item label="病人状况" prop="patientstate">
|
<el-input v-model="editForm.patientstate" type="textarea" :rows="2" placeholder="请输入病人状况" maxlength="200"
|
show-word-limit />
|
</el-form-item>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="传染病情况" prop="infectious">
|
<el-checkbox-group v-model="editForm.infectious">
|
<el-checkbox v-for="item in dict.type.sys_Infectious" :label="item.value" :value="item.value">{{
|
item.label }}</el-checkbox>
|
</el-checkbox-group>
|
<!-- <el-input
|
v-model="editForm.infectious"
|
placeholder="请输入传染病情况"
|
/> -->
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="传染病其他说明">
|
<el-input v-model="editForm.infectiousOther" placeholder="请输入传染病其他说明" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-form-item label="是否需要转运" prop="isTransport">
|
<el-radio-group v-model="editForm.isTransport">
|
<el-radio label="1">不需要</el-radio>
|
<el-radio label="2">需要</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-card>
|
|
<!-- 医院信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-office-building" style="color: #909399; margin-right: 8px;"></i>
|
<span>医院信息</span>
|
</div>
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="ICU评估医生" prop="icuDoctor">
|
<el-input v-model="editForm.icuDoctor" placeholder="请输入ICU评估医生" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="ICU医生电话" prop="icuDoctorPhone">
|
<el-input v-model="editForm.icuDoctorPhone" placeholder="请输入ICU医生手机号" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="治疗医院" prop="treatmenthospitalname">
|
<el-input v-model="editForm.treatmenthospitalname" placeholder="请输入治疗医院名称" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="治疗科室" prop="treatmentdeptname">
|
<el-input v-model="editForm.treatmentdeptname" placeholder="请输入治疗科室名称" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="住院号" prop="inpatientno">
|
<el-input v-model="editForm.inpatientno" placeholder="请输入住院号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="部门名称" prop="deptName">
|
<el-input v-model="editForm.deptName" placeholder="请输入部门名称" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="部门编号" prop="deptNo">
|
<el-input v-model="editForm.deptNo" placeholder="请输入部门编号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="上报医院" prop="toHospital">
|
<el-input v-model="editForm.toHospital" placeholder="请输入上报的医院" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 上报信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-s-data" style="color: #F56C6C; margin-right: 8px;"></i>
|
<span>上报信息</span>
|
</div>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="报告者姓名" prop="infoName">
|
<el-input v-model="editForm.infoName" placeholder="请输入报告者姓名" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="报告者电话" prop="reporterphone">
|
<el-input v-model="editForm.phone" placeholder="请输入报告者联系电话" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="协调员姓名" prop="coordinatorName">
|
<el-input v-model="editForm.coordinatorName" placeholder="请输入协调员姓名" />
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="12">
|
<el-form-item label="协调员编号" prop="coordinatorNo">
|
<el-input
|
v-model="editForm.coordinatorNo"
|
placeholder="请输入协调员编号"
|
/>
|
</el-form-item>
|
</el-col> -->
|
</el-row>
|
|
<el-form-item label="上报状态" prop="reportStatus">
|
<el-select v-model="editForm.reportStatus" placeholder="请选择上报状态" style="width: 100%" :disabled="isEditing">
|
<el-option label="已上报" value="1" />
|
<el-option label="已阅读" value="2" />
|
<el-option label="已同意" value="3" />
|
<el-option label="已驳回" value="4" />
|
</el-select>
|
</el-form-item>
|
</el-card>
|
|
<!-- 附件信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-folder" style="color: #409EFF; margin-right: 8px;"></i>
|
<span>附件信息</span>
|
</div>
|
|
<!-- 上传组件(直接放置,无分类选择) -->
|
<div class="upload-wrapper">
|
<UploadAttachment
|
ref="uploadAttachment"
|
:file-list="attachmentFileList"
|
:limit="attachmentLimit"
|
:accept="attachmentAccept"
|
@change="handleAttachmentChange"
|
@upload-success="handleUploadSuccess"
|
@upload-error="handleUploadError"
|
@remove="handleAttachmentRemove"
|
/>
|
<div style="font-size:12px; color:#909399; margin-top:4px;">
|
当前上传分类:<el-tag size="small" type="info">{{ activeTab === '未分类' ? '未分类' : activeTab }}</el-tag>
|
(切换 Tab 可改变上传分类)
|
</div>
|
</div>
|
|
<!-- 附件列表 - 分类Tab展示,支持修改分类 -->
|
<div class="attachment-list" v-if="editForm.annexfilesList && editForm.annexfilesList.length > 0">
|
<el-tabs v-model="activeTab" type="border-card">
|
<el-tab-pane
|
v-for="category in categories"
|
:key="category"
|
:label="category + '(' + getCategoryCount(category) + ')'"
|
:name="category"
|
>
|
<el-table :data="getCategoryFiles(category)" style="width: 100%" size="small" border>
|
<el-table-column label="文件名" min-width="180">
|
<template #default="scope">
|
<i class="el-icon-document" style="margin-right: 8px; color: #409EFF;"></i>
|
<span class="file-name">{{ scope.row.fileName }}</span>
|
</template>
|
</el-table-column>
|
<!-- 可编辑分类下拉 -->
|
<el-table-column label="分类" width="150">
|
<template #default="scope">
|
<el-select
|
v-model="scope.row.fileType"
|
size="small"
|
@change="updateAttachmentCategory(scope.row, $event)"
|
placeholder="选择分类"
|
>
|
<el-option label="登记表附件" value="登记表附件" />
|
<el-option label="证件照" value="证件照" />
|
<el-option label="疾病诊断治疗" value="疾病诊断治疗" />
|
<el-option label="未分类" value="" />
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column label="文件类型" width="100">
|
<template #default="scope">
|
<el-tag size="small">{{ getFileType(scope.row.fileName) }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="创建时间" width="160">
|
<template #default="scope">
|
<span>{{ formatDateTime(scope.row.createTime) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="备注" min-width="130" show-overflow-tooltip>
|
<template #default="scope">
|
<span>{{ scope.row.remart || "无" }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="180" fixed="right">
|
<template #default="scope">
|
<el-button size="mini" type="primary" @click="handlePreview(scope.row)">预览</el-button>
|
<el-button size="mini" type="danger" @click="handleRemoveAttachmentByFile(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
</el-card>
|
|
<!-- 备注信息 -->
|
<el-card class="form-section" shadow="never">
|
<div slot="header" class="section-header">
|
<i class="el-icon-edit" style="color: #67C23A; margin-right: 8px;"></i>
|
<span>备注信息</span>
|
</div>
|
<el-form-item prop="remark">
|
<el-input v-model="editForm.remark" type="textarea" :rows="4" placeholder="请输入备注信息" maxlength="500"
|
show-word-limit />
|
</el-form-item>
|
</el-card>
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="handleEditClose">取消</el-button>
|
<el-button type="primary" :loading="saveLoading" @click="handleSave">保存</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 文件预览弹窗 -->
|
<FilePreviewDialog :visible="previewVisible" :file="currentPreviewFile" @close="previewVisible = false"
|
@download="handleDownload" />
|
</div>
|
</template>
|
|
<script>
|
import CaseDetail from "./caseDetail";
|
import UploadAttachment from "@/components/UploadAttachment";
|
import FilePreviewDialog from "@/components/FilePreviewDialog";
|
import {
|
donateList,
|
donateInfo,
|
donateDel,
|
donateEdit,
|
donateAdd
|
} from "@/api/businessApi/index";
|
import LiAreaSelect from "@/components/Address";
|
|
import dayjs from "dayjs";
|
|
export default {
|
name: "CaseList",
|
components: {
|
CaseDetail,
|
LiAreaSelect,
|
UploadAttachment,
|
FilePreviewDialog
|
},
|
dicts: [
|
"sys_user_sex",
|
"sys_BloodType",
|
"sys_Infectious",
|
"sys_IDType",
|
"sys_education",
|
"sys_occupation"
|
],
|
|
data() {
|
const validateConfirmResult = (rule, value, callback) => {
|
if (this.approveForm.approveResult === "4" && !value) {
|
callback(new Error("驳回时必须填写驳回意见"));
|
} else {
|
callback();
|
}
|
};
|
return {
|
// 遮罩层
|
loading: false,
|
saveLoading: false,
|
// 选中数组
|
ids: [],
|
residenceAddress: {},
|
registerAddress: {},
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
currentCategory: "登记表附件", // 当前上传分类
|
activeTab: "登记表附件", // 当前激活的Tab
|
presetCategories: ["登记表附件", "证件照", "疾病诊断治疗"], // 预设分类列表
|
// 总条数
|
total: 0,
|
// 案例表格数据
|
caseList: [],
|
// 详情弹框是否显示
|
detailOpen: false,
|
// 确认弹框是否显示
|
approveOpen: false,
|
// 编辑弹框是否显示
|
editOpen: false,
|
// 编辑状态
|
isEditing: false,
|
// 详情弹框标题
|
detailTitle: "",
|
// 当前操作的案例
|
currentCase: {},
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
caseNo: undefined,
|
name: undefined,
|
reportStatus: undefined
|
},
|
// 确认表单
|
approveForm: {
|
id: null,
|
approveResult: "3",
|
confirmResult: "",
|
rejectType: "", // 驳回原因
|
isTransport: "", // 是否需要转运
|
createTransport: false, // 是否需要创建转运单
|
isDonate: "0" // 是否捐献,0-未捐献,1-已捐献
|
},
|
// 确认表单验证
|
approveRules: {
|
approveResult: [
|
{ required: true, message: "请选择确认结果", trigger: "change" }
|
],
|
confirmResult: [{ validator: validateConfirmResult, trigger: "blur" }],
|
rejectType: {
|
required: false,
|
validator: (rule, value, callback) => {
|
if (this.approveForm.approveResult == "4" && !value) {
|
callback(new Error("请选择驳回原因"));
|
} else {
|
callback();
|
}
|
},
|
trigger: "change"
|
},
|
isTransport: [
|
{ required: true, message: "请选择是否需要转运", trigger: "change" }
|
]
|
},
|
// 编辑表单
|
editForm: this.getDefaultFormData(),
|
// 表单验证规则
|
editRules: {
|
caseNo: [
|
{ required: true, message: "请输入案例编号", trigger: "blur" }
|
],
|
name: [{ required: true, message: "请输入患者姓名", trigger: "blur" }],
|
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
|
age: [{ required: true, message: "请输入年龄", trigger: "blur" }],
|
diagnosisname: [
|
{ required: true, message: "请输入疾病诊断", trigger: "blur" }
|
],
|
treatmenthospitalname: [
|
{ required: true, message: "请输入治疗医院", trigger: "blur" }
|
],
|
reportStatus: [
|
{ required: true, message: "请选择上报状态", trigger: "change" }
|
]
|
},
|
// 附件相关配置
|
attachmentLimit: 10,
|
attachmentAccept: ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx",
|
attachmentFileList: [],
|
// 预览相关
|
previewVisible: false,
|
currentPreviewFile: null
|
};
|
},
|
filters: {
|
statusFilter(reportStatus) {
|
const statusMap = {
|
"1": "info", // 已上报
|
"2": "warning", // 已阅读(待确认)
|
"3": "success", // 已同意
|
"4": "danger" // 已驳回
|
};
|
return statusMap[reportStatus] || "info";
|
},
|
statusTextFilter(reportStatus) {
|
const statusMap = {
|
"1": "已上报",
|
"2": "已阅读",
|
"3": "已同意",
|
"4": "已驳回"
|
};
|
return statusMap[reportStatus] || "未知状态";
|
}
|
},
|
created() {
|
this.getList();
|
},
|
computed: {
|
// 获取所有存在的分类(按固定顺序),包含“未分类”
|
categories() {
|
// 固定返回所有预设分类 + 未分类,无论是否有文件
|
return ['登记表附件', '证件照', '疾病诊断治疗', '未分类'];
|
}
|
},
|
methods: {
|
/** 查询案例列表 */
|
async getList() {
|
this.loading = true;
|
try {
|
const response = await donateList(this.queryParams);
|
this.caseList = response.rows || response.data || [];
|
this.total = response.total || this.caseList.length;
|
} catch (error) {
|
console.error("获取案例列表失败:", error);
|
this.$modal.msgError("获取案例列表失败");
|
this.caseList = [];
|
this.total = 0;
|
} finally {
|
this.loading = false;
|
}
|
},
|
handleResidenceAddressChange(address) {
|
this.editForm.residenceprovince = address.sheng;
|
this.editForm.residencecity = address.shi;
|
this.editForm.residencetown = address.qu;
|
},
|
|
handleRegisterAddressChange(address) {
|
console.log(this.registerAddress, "registerAddress11");
|
|
this.editForm.registerprovince = address.sheng;
|
this.editForm.registercity = address.shi;
|
this.editForm.registertown = address.qu;
|
},
|
/** 确认结果变化处理 */
|
handleApproveResultChange(value) {
|
if (value == "3") {
|
// 选择同意时,重置驳回原因
|
this.approveForm.rejectType = "";
|
this.approveForm.isDonate = "0"; // 重置为未捐献
|
} else if (value == "4") {
|
// 选择驳回时,重置转运选项
|
this.approveForm.isTransport = "1";
|
this.approveForm.createTransport = false;
|
}
|
|
// 清除验证
|
this.$nextTick(() => {
|
if (this.$refs.approveForm) {
|
this.$refs.approveForm.clearValidate();
|
}
|
});
|
},
|
|
// 转运相关方法
|
/** 获取转运状态标签样式 */
|
getTransportStatusTag(row) {
|
if (row.isTransport == "1") {
|
return "info"; // 不需要转运
|
}
|
if (
|
row.serviceTransport &&
|
Array.isArray(row.serviceTransport) &&
|
row.serviceTransport.length > 0
|
) {
|
// 根据转运单状态显示不同颜色
|
const transport = row.serviceTransport[0];
|
if (transport.transitStatus) {
|
switch (transport.transitStatus.toString()) {
|
case "1":
|
return "warning"; // 待转运
|
case "2":
|
return "primary"; // 转运中
|
case "3":
|
return "success"; // 转运完成
|
case "4":
|
return "danger"; // 转运取消
|
case "5":
|
return "info"; // 暂存
|
default:
|
return "info";
|
}
|
}
|
return "primary"; // 有转运信息但无状态
|
}
|
return "success"; // 需要转运但无转运信息
|
},
|
|
/** 获取转运状态文本 */
|
getTransportStatusText(row) {
|
if (row.isTransport == "1") {
|
return "无需转运";
|
}
|
if (
|
row.serviceTransport &&
|
Array.isArray(row.serviceTransport) &&
|
row.serviceTransport.length > 0
|
) {
|
const transport = row.serviceTransport[0];
|
if (transport.transitStatus) {
|
switch (transport.transitStatus.toString()) {
|
case "1":
|
return "待转运";
|
case "2":
|
return "转运中";
|
case "3":
|
return "转运完成";
|
case "4":
|
return "转运取消";
|
case "5":
|
return "暂存";
|
default:
|
return "有转运单";
|
}
|
}
|
return "有转运单";
|
}
|
return "未知";
|
},
|
|
/** 跳转到创建转运单页面 */
|
Createatransferorder(res) {
|
console.log(res);
|
|
this.$router.push({
|
path: "/report/transfer",
|
query: {
|
autoCreate: "true",
|
caseId: res.id,
|
caseNo: res.caseNo,
|
patName: res.name,
|
age: res.age,
|
sex: res.sex,
|
diagnosisname: res.diagnosisname,
|
treatmentHospitalName: res.treatmenthospitalname
|
}
|
});
|
},
|
|
/** 多选框选中数据 */
|
handleSelectionChange(selection) {
|
console.log(selection, "22");
|
|
this.ids = selection.map(item => item.id);
|
console.log(this.ids, "33");
|
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.queryParams = {
|
pageNum: 1,
|
pageSize: 10,
|
caseNo: undefined,
|
name: undefined,
|
reportStatus: undefined
|
};
|
this.getList();
|
},
|
|
/** 详情按钮操作 */
|
async handleDetail(row) {
|
try {
|
this.currentCase = row;
|
if (this.currentCase.registerprovincename) {
|
this.residenceAddress = {
|
sheng: this.currentCase.registerprovincename,
|
shi: this.currentCase.registercityname,
|
qu: this.currentCase.registertownname
|
};
|
}
|
// 户籍地址
|
if (this.currentCase.residenceprovincename) {
|
this.registerAddress = {
|
sheng: this.currentCase.residenceprovincename,
|
shi: this.currentCase.residencecountyname,
|
qu: this.currentCase.residencetownname
|
};
|
}
|
// 如果状态是"已上报"(1),则更新为"已阅读"(2)
|
if (this.currentCase.reportStatus == "1") {
|
try {
|
const updateData = {
|
...this.currentCase,
|
reportStatus: "2",
|
updateTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
updateBy: this.$store.state.user?.name || "当前用户"
|
};
|
|
await donateEdit(updateData);
|
this.currentCase.reportStatus = "2";
|
this.currentCase.updateTime = updateData.updateTime;
|
row.reportStatus = "2";
|
this.$modal.msgSuccess("状态已更新为已阅读");
|
} catch (updateError) {
|
console.error("状态更新失败:", updateError);
|
}
|
}
|
|
this.detailTitle = `案例详情 - ${this.currentCase.caseNo ||
|
row.caseNo}`;
|
this.detailOpen = true;
|
console.log(this.currentCase, "this.currentCase");
|
} catch (error) {
|
console.error("获取案例详情失败:", error);
|
this.currentCase = row;
|
this.detailTitle = `案例详情 - ${row.caseNo}`;
|
this.detailOpen = true;
|
}
|
},
|
// 获取某分类的文件数量
|
getCategoryCount(category) {
|
return this.editForm.annexfilesList.filter(item => {
|
const type = item.fileType || "";
|
if (category === "未分类") {
|
return !this.presetCategories.includes(type);
|
}
|
return type === category;
|
}).length;
|
},
|
// 获取某分类的文件列表
|
getCategoryFiles(category) {
|
return this.editForm.annexfilesList.filter(item => {
|
const type = item.fileType || "";
|
if (category === "未分类") {
|
return !this.presetCategories.includes(type);
|
}
|
return type === category;
|
});
|
},
|
// 更新附件分类(下拉修改时触发)
|
updateAttachmentCategory(row, newVal) {
|
const target = this.editForm.annexfilesList.find(item => item === row);
|
if (target) {
|
target.fileType = newVal; // 可能为空字符串
|
// 同步更新 attachmentFileList
|
const fileItem = this.attachmentFileList.find(f => f.raw === row);
|
if (fileItem) {
|
fileItem.raw.fileType = newVal;
|
fileItem.fileType = newVal || "未分类";
|
}
|
// 可选:如果当前激活的tab没有文件了,自动切换到第一个有文件的tab
|
const currentTabHasFiles =
|
this.getCategoryFiles(this.activeTab).length > 0;
|
if (!currentTabHasFiles) {
|
const firstCategory = this.categories[0];
|
if (firstCategory) this.activeTab = firstCategory;
|
}
|
}
|
},
|
// 按文件对象删除(用于表格中的删除按钮)
|
handleRemoveAttachmentByFile(file) {
|
const index = this.editForm.annexfilesList.findIndex(
|
item => item === file
|
);
|
if (index > -1) {
|
this.editForm.annexfilesList.splice(index, 1);
|
// 同步删除 attachmentFileList
|
const fileIndex = this.attachmentFileList.findIndex(
|
f => f.raw === file || f.url === file.fileUrl
|
);
|
if (fileIndex > -1) {
|
this.attachmentFileList.splice(fileIndex, 1);
|
}
|
this.$message.success("附件删除成功");
|
}
|
},
|
/** 编辑按钮操作 */
|
async handleEdit(row) {
|
try {
|
const response = await donateInfo(row.id);
|
if (response.code == 200 || response.data) {
|
this.isEditing = true;
|
const data = response.data || response;
|
// 确保附件都有 fileType 字段,默认为空字符串
|
if (data.annexfilesList) {
|
data.annexfilesList = data.annexfilesList.map(item => ({
|
...item,
|
fileType: item.fileType || ""
|
}));
|
this.attachmentFileList = this.parseAttachmentToFileList(
|
data.annexfilesList
|
);
|
} else {
|
this.attachmentFileList = [];
|
}
|
if (data.registerprovincename) {
|
this.residenceAddress = {
|
sheng: data.residenceprovincename,
|
shi: data.residencecountyname,
|
qu: data.residencetownname
|
};
|
}
|
// 户籍地址
|
if (data.residenceprovincename) {
|
this.registerAddress = {
|
sheng: data.registerprovincename,
|
shi: data.registercityname,
|
qu: data.registertownname
|
};
|
}
|
this.currentCase = data;
|
this.editForm = { ...data };
|
this.editForm.idcardtype = this.editForm.idcardtype?.toString() ?? "";
|
console.log(this.editForm.idcardtype);
|
this.editForm.infectious = this.editForm.infectious
|
.split(",")
|
.filter(item => item.trim() !== "");
|
|
this.editOpen = true;
|
this.$nextTick(() => {
|
this.$refs.editForm && this.$refs.editForm.clearValidate();
|
});
|
} else {
|
this.$message.error(response.msg || "获取记录失败");
|
}
|
} catch (error) {
|
console.error("获取记录失败:", error);
|
this.$modal.msgError("获取记录失败");
|
}
|
},
|
hasApprovedSelected() {
|
if (!this.ids || this.ids.length === 0) return false;
|
return this.caseList.some(
|
item => this.ids.includes(item.id) && item.reportStatus === "3"
|
);
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.isEditing = false;
|
this.editForm = this.getDefaultFormData();
|
this.attachmentFileList = [];
|
this.editOpen = true;
|
this.$nextTick(() => {
|
this.$refs.editForm && this.$refs.editForm.clearValidate();
|
});
|
},
|
|
/** 确认按钮操作 */
|
async handleApprove(row) {
|
try {
|
const response = await donateInfo(row.id);
|
this.currentCase = response.data || response || row;
|
|
this.approveForm.id = row.id;
|
this.approveForm.approveResult = "3";
|
this.approveForm.confirmResult = "";
|
this.approveForm.rejectType = "";
|
this.approveForm.isTransport = row.isTransport || "1";
|
this.approveForm.isDonate = "0";
|
|
this.$nextTick(() => {
|
if (this.$refs.approveForm) {
|
this.$refs.approveForm.clearValidate();
|
}
|
});
|
|
this.approveOpen = true;
|
} catch (error) {
|
console.error("获取案例详情失败:", error);
|
this.currentCase = row;
|
this.approveForm.id = row.id;
|
this.approveForm.approveResult = "3";
|
this.approveForm.confirmResult = "";
|
this.approveOpen = true;
|
this.$modal.msgError("获取详情失败,但已打开确认窗口");
|
}
|
},
|
|
/** 提交确认 */
|
async submitApprove() {
|
try {
|
const valid = await this.$refs.approveForm.validate();
|
if (!valid) return;
|
|
// 准备确认数据
|
const approveData = {
|
...this.currentCase,
|
reportStatus: this.approveForm.approveResult,
|
confirmResult: this.approveForm.confirmResult,
|
approvername: this.$store.state.user?.name || "当前用户",
|
approvetime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
updateTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
updateBy: this.$store.state.user?.name || "当前用户"
|
};
|
|
// 处理确认结果
|
if (this.approveForm.approveResult == "3") {
|
// 同意
|
approveData.isTransport = this.approveForm.isTransport;
|
|
// 如果不需要转运,设置isDonate为1
|
if (this.approveForm.isTransport == "1") {
|
approveData.isDonate = "1";
|
} else {
|
approveData.isDonate = "0";
|
}
|
} else if (this.approveForm.approveResult == "4") {
|
// 驳回
|
approveData.rejectType = this.approveForm.rejectType;
|
approveData.isTransport = "1"; // 驳回的案例不需要转运
|
approveData.isDonate = "0"; // 驳回的案例标记为已捐献
|
}
|
|
// 保存案例确认信息
|
await donateEdit(approveData);
|
|
this.$modal.msgSuccess("确认成功");
|
|
// 关闭确认对话框
|
this.approveOpen = false;
|
|
// 刷新列表
|
this.getList();
|
|
// 如果同意且需要转运,跳转到转运单创建页面
|
if (
|
this.approveForm.approveResult == "3" &&
|
this.approveForm.isTransport == "2"
|
) {
|
this.$router.push({
|
path: "/report/transfer",
|
query: {
|
autoCreate: "true",
|
caseId: this.currentCase.id,
|
caseNo: this.currentCase.caseNo,
|
patName: this.currentCase.name,
|
age: this.currentCase.age,
|
sex: this.currentCase.sex,
|
diagnosisname: this.currentCase.diagnosisname,
|
treatmentHospitalName: this.currentCase.treatmenthospitalname
|
}
|
});
|
}
|
} catch (error) {
|
console.error("确认失败:", error);
|
if (error !== "cancel") {
|
this.$modal.msgError("确认失败");
|
}
|
}
|
},
|
|
/** 删除按钮操作 - 修改,增加已同意校验 */
|
async handleDelete(row) {
|
console.log(this.ids, "1");
|
console.log(row, "2");
|
|
let ids = this.ids;
|
console.log(ids);
|
|
const deleteItems = this.caseList.filter(item => ids.includes(item.id));
|
|
// 检查是否有已同意的案例
|
const approvedItems = deleteItems.filter(
|
item => item.reportStatus === "3"
|
);
|
if (approvedItems.length > 0) {
|
const names = approvedItems.map(item => item.caseNo).join(",");
|
this.$modal.msgWarning(`已同意的案例不可删除:${names}`);
|
return;
|
}
|
|
try {
|
await this.$modal.confirm(
|
'是否确认删除潜在捐献者为"' + ids.join(",") + '"的数据项?'
|
);
|
|
// 逐个删除,一个案例调用一次删除接口
|
let successCount = 0;
|
let failCount = 0;
|
let failIds = [];
|
|
for (const id of ids) {
|
try {
|
await donateDel(id);
|
successCount++;
|
} catch (error) {
|
console.error(`删除ID ${id} 失败:`, error);
|
failCount++;
|
failIds.push(id);
|
}
|
}
|
|
// 显示删除结果
|
if (failCount === 0) {
|
this.$modal.msgSuccess(`成功删除 ${successCount} 个案例`);
|
} else {
|
this.$modal.msgWarning(
|
`成功删除 ${successCount} 个案例,${failCount} 个案例删除失败(ID: ${failIds.join(
|
","
|
)})`
|
);
|
}
|
|
this.getList();
|
} catch (error) {
|
if (error !== "cancel") {
|
console.error("删除操作取消或失败:", error);
|
this.$modal.msgError("删除失败");
|
}
|
}
|
},
|
|
/** 获取默认表单数据 */
|
getDefaultFormData() {
|
return {
|
id: undefined,
|
caseNo: undefined,
|
name: undefined,
|
sex: undefined,
|
age: undefined,
|
ageunit: "year",
|
bloodType: undefined,
|
rhYin: "0",
|
birthday: undefined,
|
idcardtype: "1",
|
idcardno: undefined,
|
nation: undefined,
|
nationality: undefined,
|
nativeplace: undefined,
|
education: undefined,
|
occupation: undefined,
|
phone: undefined,
|
// 户籍地址
|
registerprovincename: undefined,
|
registercityname: undefined,
|
registertownname: undefined,
|
registercommunityname: undefined,
|
registeraddress: undefined,
|
// 现住地址
|
residenceprovincename: undefined,
|
residencecountyname: undefined,
|
residencetownname: undefined,
|
residencecommunityname: undefined,
|
residenceaddress: undefined,
|
// 医疗信息
|
diagnosisname: undefined,
|
illnessoverview: undefined,
|
patientstate: undefined,
|
gcsScore: undefined,
|
infectious: undefined,
|
infectiousOther: undefined,
|
isTransport: "1",
|
isDonate: "0", // 新增:是否捐献
|
rejectType: undefined, // 新增:驳回原因
|
// 医院信息
|
treatmenthospitalname: undefined,
|
treatmentdeptname: undefined,
|
inpatientno: undefined,
|
deptName: undefined,
|
deptNo: undefined,
|
toHospital: undefined,
|
// 上报信息
|
infoName: undefined,
|
infoNo: undefined,
|
reporterphone: undefined,
|
coordinatorName: undefined,
|
coordinatorNo: undefined,
|
terminationCase: "0",
|
reportStatus: "1", // 默认已上报
|
// 附件
|
annexfilesList: [],
|
// 其他
|
remark: undefined,
|
createBy: undefined,
|
createTime: undefined,
|
updateBy: undefined,
|
updateTime: undefined,
|
delFlag: 0
|
};
|
},
|
|
/** 附件转换 */
|
parseAttachmentToFileList(attachments) {
|
if (!attachments || !Array.isArray(attachments)) return [];
|
return attachments.map((item, index) => ({
|
uid: item.id || `attachment-${index}-${Date.now()}`,
|
name: item.fileName,
|
url: item.path || item.fileUrl,
|
status: 'success',
|
raw: item,
|
fileType: item.fileType || '' // 空字符串表示未分类
|
}));
|
}
|
,
|
|
/** 附件变化处理 */
|
handleAttachmentChange(fileList) {
|
this.attachmentFileList = fileList;
|
},
|
|
/** 附件上传成功处理 */
|
handleUploadSuccess({ file, fileList, response }) {
|
if (response && response.code == 200) {
|
if (!this.editForm.annexfilesList) {
|
this.editForm.annexfilesList = [];
|
}
|
// 根据当前激活的 Tab 决定分类(未分类 Tab 对应空字符串)
|
const category = this.activeTab === '未分类' ? '' : this.activeTab;
|
const attachmentObj = {
|
fileName: file.name,
|
path: response.data || file.url,
|
fileUrl: response.data || file.url,
|
type: this.getFileExtension(file.name),
|
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
remart: file.raw?.remart || '',
|
caseNo: this.editForm.caseNo,
|
fileType: category // 使用 activeTab 决定
|
};
|
this.editForm.annexfilesList.push(attachmentObj);
|
// 同步更新 attachmentFileList
|
this.attachmentFileList.push({
|
uid: attachmentObj.path,
|
name: attachmentObj.fileName,
|
url: attachmentObj.path,
|
status: 'success',
|
raw: attachmentObj,
|
fileType: category
|
});
|
this.$message.success('文件上传成功');
|
}
|
},
|
|
/** 附件上传错误处理 */
|
handleUploadError({ file, fileList, error }) {
|
console.error("附件上传失败:", error);
|
this.$message.error("文件上传失败,请重试");
|
},
|
|
/** 附件移除处理 */
|
handleAttachmentRemove(file) {
|
if (file.url && this.editForm.annexfilesList) {
|
const index = this.editForm.annexfilesList.findIndex(
|
item => item.path == file.url || item.fileUrl == file.url
|
);
|
if (index > -1) {
|
this.editForm.annexfilesList.splice(index, 1);
|
}
|
}
|
},
|
|
/** 手动删除附件 */
|
handleRemoveAttachment(index) {
|
this.editForm.annexfilesList.splice(index, 1);
|
this.attachmentFileList.splice(index, 1);
|
this.$message.success("附件删除成功");
|
},
|
|
/** 文件预览 */
|
handlePreview(file) {
|
this.currentPreviewFile = {
|
fileName: file.fileName,
|
fileUrl: file.path || file.fileUrl,
|
fileType: this.getFileType(file.fileName)
|
};
|
this.previewVisible = true;
|
},
|
|
/** 文件下载 */
|
handleDownload(file) {
|
const fileUrl = file.path || 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 = fileName
|
.split(".")
|
.pop()
|
.toLowerCase();
|
const imageTypes = ["jpg", "jpeg", "png", "gif", "bmp", "webp"];
|
const pdfTypes = ["pdf"];
|
const officeTypes = ["doc", "docx", "xls", "xlsx"];
|
|
if (imageTypes.includes(extension)) return "image";
|
if (pdfTypes.includes(extension)) return "pdf";
|
if (officeTypes.includes(extension)) return "office";
|
return "other";
|
},
|
|
/** 获取文件扩展名 */
|
getFileExtension(filename) {
|
if (!filename) return "";
|
return filename
|
.split(".")
|
.pop()
|
.toLowerCase();
|
},
|
|
/** 日期时间格式化 */
|
formatDateTime(dateTime) {
|
if (!dateTime) return "";
|
return dayjs(dateTime).format("YYYY-MM-DD HH:mm:ss");
|
},
|
|
/** 关闭编辑对话框 */
|
handleEditClose() {
|
this.editOpen = false;
|
this.currentCase = {};
|
this.editForm = this.getDefaultFormData();
|
this.attachmentFileList = [];
|
this.$nextTick(() => {
|
this.$refs.editForm && this.$refs.editForm.clearValidate();
|
});
|
},
|
goToTransportDetail(name) {
|
this.$router.push({
|
path: "/report/transfer",
|
query: {
|
autoCreate: "true",
|
patName: name
|
}
|
});
|
},
|
/** 保存表单 */
|
async handleSave() {
|
try {
|
const valid = await this.$refs.editForm.validate();
|
if (!valid) return;
|
|
const pendingFiles = this.attachmentFileList.filter(
|
item => item.status !== "success"
|
);
|
if (pendingFiles.length > 0) {
|
this.$message.warning(
|
"还有文件未上传完成,请先上传所有文件或移除未上传的文件"
|
);
|
return;
|
}
|
|
this.saveLoading = true;
|
|
const requestData = { ...this.editForm };
|
requestData.infectious = requestData.infectious.join(",");
|
let response;
|
|
requestData.isDonate = requestData.isDonate
|
? requestData.isDonate
|
: "0";
|
|
if (this.isEditing) {
|
response = await donateEdit(requestData);
|
} else {
|
// 新增时设置创建信息
|
requestData.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
requestData.createBy = this.$store.state.user?.name || "当前用户";
|
response = await donateAdd(requestData);
|
}
|
|
if (response.code == 200) {
|
this.$message.success(this.isEditing ? "修改成功" : "新增成功");
|
this.handleEditClose();
|
this.getList();
|
} else {
|
this.$message.error(response.msg || "操作失败");
|
}
|
} catch (error) {
|
console.error("保存失败:", error);
|
this.$message.error("操作失败,请稍后重试");
|
} finally {
|
this.saveLoading = false;
|
}
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.app-container {
|
padding: 20px;
|
}
|
|
.filter-card {
|
margin-bottom: 20px;
|
}
|
|
.mb8 {
|
margin-bottom: 8px;
|
}
|
|
/* 表单区域样式 */
|
.form-section {
|
margin-bottom: 16px;
|
}
|
|
.section-header {
|
display: flex;
|
align-items: center;
|
font-weight: bold;
|
color: #303133;
|
}
|
|
.dialog-footer {
|
text-align: right;
|
padding: 20px 0 0;
|
}
|
|
/* 附件样式 */
|
.attachment-section {
|
margin-bottom: 16px;
|
}
|
|
.attachment-header {
|
display: flex;
|
align-items: center;
|
margin-bottom: 16px;
|
padding: 8px 0;
|
border-bottom: 1px solid #ebeef5;
|
}
|
|
.attachment-title {
|
font-weight: bold;
|
margin: 0 8px;
|
}
|
|
.attachment-tip {
|
font-size: 12px;
|
color: #909399;
|
}
|
|
.attachment-list {
|
margin-top: 16px;
|
}
|
|
.list-title {
|
font-weight: bold;
|
margin-bottom: 12px;
|
color: #303133;
|
}
|
|
.file-name {
|
font-size: 13px;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
|
/* 确认弹框样式 */
|
.approve-dialog>>>.el-dialog__body {
|
padding: 0;
|
}
|
|
.approve-detail-preview {
|
height: 100%;
|
}
|
|
.approve-dialog-content {
|
display: flex;
|
height: 600px;
|
/* 可以调整高度 */
|
overflow: hidden;
|
}
|
|
.approve-detail-left {
|
width: 50%;
|
background: #f8f9fa;
|
padding: 20px;
|
overflow-y: auto;
|
border-right: 1px solid #e4e7ed;
|
}
|
|
.approve-form-right {
|
width: 50%;
|
padding: 20px;
|
overflow-y: auto;
|
}
|
|
.approve-detail-preview {
|
height: 100%;
|
}
|
|
/* 响应式调整 */
|
@media (max-width: 1200px) {
|
.approve-dialog-content {
|
flex-direction: column;
|
height: auto;
|
max-height: 80vh;
|
}
|
|
.approve-detail-left,
|
.approve-form-right {
|
width: 100%;
|
height: auto;
|
}
|
|
.approve-detail-left {
|
border-right: none;
|
border-bottom: 1px solid #e4e7ed;
|
}
|
}
|
|
/* 响应式设计 */
|
@media (max-width: 1200px) {
|
.approve-dialog {
|
width: 95% !important;
|
}
|
|
.el-aside {
|
width: 50% !important;
|
}
|
}
|
</style>
|