| | |
| | | <!-- 基础信息 --> |
| | | <div slot="header" class="clearfix"> |
| | | <span class="detail-title">捐献确认信息</span> |
| | | <el-button |
| | | <!-- <el-button |
| | | type="primary" |
| | | style="float: right;margin-left: 20px;" |
| | | @click="handleSave" |
| | |
| | | :loading="saveLoading" |
| | | > |
| | | 确认完成 |
| | | </el-button> |
| | | </el-button> --> |
| | | </div> |
| | | |
| | | <el-form :model="form" ref="form" label-width="120px"> |
| | |
| | | <el-input v-model="form.coordinatedusernamet" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <!-- <el-col :span="8"> |
| | | <el-form-item label="业务人员" prop="responsibleusername"> |
| | | <el-input v-model="form.responsibleusername" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> --> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <!-- <el-col :span="8"> |
| | | <el-form-item label="确认状态" prop="relativeconfirmationsign"> |
| | | <el-select |
| | | v-model="form.relativeconfirmationsign" |
| | | style="width: 100%" |
| | | |
| | | > |
| | | <el-option label="未确认" value="0" /> |
| | | <el-option label="家属确认" value="1" /> |
| | | <el-option label="不同意捐献" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <!-- <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="签字时间" prop="signdate"> |
| | | <el-date-picker |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="8"> |
| | | <el-form-item label="血型" prop="bloodtype"> |
| | | <el-input v-model="form.bloodtype" /> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | </el-row> |
| | | |
| | | <!-- <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="证件号码" prop="idcardno"> |
| | | <el-input v-model="form.idcardno" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> --> |
| | | |
| | | <!-- 亲属信息 --> |
| | | <!-- 亲属信息 --> |
| | | <el-divider content-position="left">亲属确认信息</el-divider> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属姓名" prop="relativeconfirmationsignname"> |
| | | <el-input |
| | | v-model="form.relativeconfirmationsignname" |
| | | placeholder="请输入亲属姓名" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="与捐赠者关系" prop="signfamilyrelations"> |
| | | <el-select |
| | | v-model="form.signfamilyrelations" |
| | | placeholder="请选择与捐赠者关系" |
| | | > |
| | | <el-option |
| | | v-for="dict in dict.type.sys_FamilyRelation || []" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属身份证" prop="relativeidcardno"> |
| | | <el-input |
| | | v-model="form.relativeidcardno" |
| | | placeholder="请输入亲属证件号码" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属电话" prop="relativephone"> |
| | | <el-input |
| | | v-model="form.relativephone" |
| | | placeholder="请输入亲属联系电话" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-bottom: 10px;"> |
| | | <el-alert |
| | | title="第一条数据为主要亲属,需填写完整的姓名、关系、身份证和电话信息" |
| | | type="info" |
| | | show-icon |
| | | :closable="false" |
| | | style="margin-bottom: 15px;" |
| | | > |
| | | </el-alert> |
| | | <el-row style="margin-top: 15px;"> |
| | | <el-button |
| | | style="float: right; margin-bottom: 5px;" |
| | | type="primary" |
| | | size="mini" |
| | | icon="el-icon-plus" |
| | | @click="openOtherFamilyDialog()" |
| | | @click="openFamilyDialog(false)" |
| | | > |
| | | 添加其他家属 |
| | | </el-button> |
| | | </el-row> |
| | | <el-table :data="otherFamilyList" size="small" border> |
| | | <el-table-column label="姓名" prop="name" /> |
| | | <el-table-column label="与捐赠者关系" prop="relation"> |
| | | <el-table :data="familyMemberList" size="small" border> |
| | | <el-table-column label="序号" width="60" align="center"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.$index + 1 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="姓名" prop="name" min-width="120"> |
| | | <template slot-scope="scope"> |
| | | <span :class="{ 'main-family': scope.$index === 0 }">{{ |
| | | scope.row.name |
| | | }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="与捐赠者关系" prop="relation" min-width="140"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag |
| | | :options="dict.type.sys_FamilyRelation" |
| | |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="联系电话" prop="phone" /> |
| | | |
| | | <el-table-column label="操作" width="120" align="center"> |
| | | <el-table-column label="身份证号" prop="idcard" min-width="180"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.$index === 0">{{ scope.row.idcard }}</span> |
| | | <span v-else style="color: #909399;">-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="联系电话" prop="phone" min-width="130"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.$index === 0">{{ scope.row.phone }}</span> |
| | | <span v-else style="color: #909399;">-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="类型" width="70" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.$index === 0" type="warning" size="small" |
| | | >主要</el-tag |
| | | > |
| | | <el-tag v-else type="info" size="small">其他</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | @click="editOtherFamily(scope.$index)" |
| | | @click="editFamilyMember(scope.$index)" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.$index > 0" |
| | | size="mini" |
| | | type="text" |
| | | style="color:red" |
| | | @click="deleteOtherFamily(scope.$index)" |
| | | @click="deleteFamilyMember(scope.$index)" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | <span v-else style="color: #909399; font-size: 12px;" |
| | | >不可删除</span |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <el-row> |
| | | <el-form-item label-width="100px" label="捐献决定"> |
| | | <el-checkbox-group v-model="organdecision"> |
| | |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- 添加这里:底部居中按钮 --> |
| | | |
| | | <!-- 附件信息 - 按类型分类 --> |
| | | <el-card class="attachment-card"> |
| | | <div slot="header" class="clearfix"> |
| | | <span class="detail-title">相关附件上传</span> |
| | | </div> |
| | | |
| | | <!-- 附件类型选项卡 --> |
| | | <el-tabs v-model="activeAttachmentType" type="card"> |
| | | <el-tab-pane |
| | | v-for="type in attachmentTypes" |
| | |
| | | </el-tooltip> |
| | | </div> |
| | | |
| | | <!-- 当前类型的附件列表 --> |
| | | <div class="attachment-list"> |
| | | <el-table |
| | | :data="getAttachmentsByType(type.value)" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="文件类型" width="100" align="center"> |
| | | <el-table-column label="文件类型" width="90" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag size="small">{{ |
| | | getFileType(scope.row.fileName) |
| | |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="文件大小" width="100" align="center"> |
| | | <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="160" align="center"> |
| | | <el-table-column label="上传时间" width="155" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ formatDateTime(scope.row.uploadTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="操作" width="150" align="center"> |
| | | <el-table-column label="操作" width="145" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 空状态提示 --> |
| | | <div |
| | | v-if="getAttachmentsByType(type.value).length === 0" |
| | | class="empty-attachment" |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | <!-- 其他家属弹窗 --> |
| | | <!-- 底部操作按钮 --> |
| | | <div style="text-align: center; margin: 30px 0;"> |
| | | <el-button |
| | | type="primary" |
| | | @click="handleSave" |
| | | :loading="saveLoading" |
| | | style="margin-right: 20px; min-width: 140px;" |
| | | > |
| | | 保存确认信息 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | @click="accomplish" |
| | | :loading="saveLoading" |
| | | style="min-width: 140px;" |
| | | > |
| | | 确认完成 |
| | | </el-button> |
| | | </div> |
| | | <!-- 家属弹窗 --> |
| | | <el-dialog |
| | | :title="isEditOtherFamily ? '编辑其他家属' : '添加其他家属'" |
| | | :visible.sync="otherFamilyDialogVisible" |
| | | width="400px" |
| | | :title="familyDialogTitle" |
| | | :visible.sync="familyDialogVisible" |
| | | width="420px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :model="currentOtherFamily" label-width="100px"> |
| | | <el-form :model="currentFamilyMember" label-width="110px"> |
| | | <el-form-item label="姓名" prop="name"> |
| | | <el-input v-model="currentOtherFamily.name" /> |
| | | <el-input |
| | | v-model="currentFamilyMember.name" |
| | | placeholder="请输入姓名" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="关系" prop="relation"> |
| | | <el-select v-model="currentOtherFamily.relation" style="width:100%"> |
| | | <el-form-item label="与捐赠者关系" prop="relation"> |
| | | <el-select |
| | | v-model="currentFamilyMember.relation" |
| | | style="width:100%" |
| | | placeholder="请选择关系" |
| | | > |
| | | <el-option |
| | | v-for="dict in dict.type.sys_FamilyRelation" |
| | | :key="dict.value" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="电话" prop="phone"> |
| | | <el-input v-model="currentOtherFamily.phone" /> |
| | | </el-form-item> |
| | | <template v-if="currentFamilyMember.isMain"> |
| | | <el-form-item label="身份证号" prop="idcard"> |
| | | <el-input |
| | | v-model="currentFamilyMember.idcard" |
| | | placeholder="请输入身份证号" |
| | | maxlength="18" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="联系电话" prop="phone"> |
| | | <el-input |
| | | v-model="currentFamilyMember.phone" |
| | | placeholder="请输入联系电话" |
| | | maxlength="11" |
| | | /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | |
| | | <span slot="footer"> |
| | | <el-button @click="otherFamilyDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" @click="saveOtherFamily">确定</el-button> |
| | | <el-button @click="familyDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" @click="saveFamilyMember">确定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 上传对话框 --> |
| | | <el-dialog |
| | | :title="`上传${getCurrentTypeLabel}附件`" |
| | | :visible.sync="uploadDialogVisible" |
| | | width="500px" |
| | | width="480px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-upload |
| | |
| | | data() { |
| | | return { |
| | | caseId: null, |
| | | |
| | | // 是否编辑模式 |
| | | isEdit: false, |
| | | // 表单数据 |
| | | form: { |
| | | id: undefined, |
| | | infoid: undefined, |
| | |
| | | relativeidcardno: "", |
| | | relativephone: "", |
| | | relativeRemark: "", |
| | | assessannex: "", // JSON字符串存储所有附件 |
| | | otherFamilyMembers: "" // ✅ 新增 |
| | | assessannex: "", |
| | | otherFamilyMembers: "" |
| | | }, |
| | | // 统一亲属列表(第一条为主要亲属,其余为其他亲属) |
| | | familyMemberList: [], |
| | | // 当前编辑的家属(弹窗用) |
| | | currentFamilyMember: { |
| | | name: "", |
| | | relation: "", |
| | | phone: "", |
| | | idcard: "", |
| | | isMain: false |
| | | }, |
| | | isEditFamilyMember: false, |
| | | editFamilyMemberIndex: -1, |
| | | familyDialogVisible: false, |
| | | familyDialogTitle: "添加家属", |
| | | |
| | | uploadAction: process.env.VUE_APP_BASE_API + "/common/upload", |
| | | headers: { |
| | | Authorization: "Bearer " + getToken() |
| | | }, |
| | | // 其他家属表格数据 |
| | | otherFamilyList: [], |
| | | |
| | | // 当前编辑的其他家属(弹窗用) |
| | | currentOtherFamily: { |
| | | name: "", |
| | | relation: "", |
| | | phone: "" |
| | | }, |
| | | |
| | | // 是否编辑模式(其他家属) |
| | | isEditOtherFamily: false, |
| | | editOtherFamilyIndex: -1, |
| | | |
| | | // 其他家属弹窗 |
| | | otherFamilyDialogVisible: false, |
| | | organdecision: [], |
| | | organdecisionOther: "", |
| | | organselection: [ |
| | |
| | | "眼角膜", |
| | | "其他" |
| | | ], |
| | | // 加载状态 |
| | | loading: false, |
| | | saveLoading: false, |
| | | infoid: null, |
| | | // 附件相关数据 |
| | | activeAttachmentType: "1", |
| | | attachmentLoading: false, |
| | | uploadDialogVisible: false, |
| | | uploadLoading: false, |
| | | tempFileList: [], |
| | | currentUploadType: "", |
| | | // 预览相关 |
| | | previewVisible: false, |
| | | currentPreviewFile: null, |
| | | |
| | | // 附件类型定义 |
| | | attachmentTypes: [ |
| | | { value: "1", label: "人体器官潜在捐献者登记表" }, |
| | | { value: "2", label: "人体器官捐献亲属确认登记表" }, |
| | |
| | | { value: "5", label: "脑死亡判定知情同意书" }, |
| | | { value: "6", label: "心死亡判定知情同意书" } |
| | | ], |
| | | |
| | | // 附件数据结构 - 按类型分开存储 |
| | | attachmentData: { |
| | | "1": [], // 类型1的附件列表 |
| | | "1": [], |
| | | "2": [], |
| | | "3": [], |
| | | "4": [], |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 获取详情 |
| | | async getDetail(infoid) { |
| | | this.loading = true; |
| | | try { |
| | | const response = await relativesList({ infoid }); |
| | | |
| | | if (response.code === 200) { |
| | | this.handleDetailData(response); |
| | | } else { |
| | |
| | | } |
| | | }, |
| | | |
| | | // 处理详情数据 |
| | | handleDetailData(response) { |
| | | let detailData = null; |
| | | |
| | | // 根据接口实际返回的数据结构进行调整 |
| | | if (response.data) { |
| | | if (Array.isArray(response.data)) { |
| | | detailData = response.data[0] || {}; |
| | |
| | | } else { |
| | | detailData = response; |
| | | } |
| | | // 处理其他家属数据 |
| | | if (detailData.otherFamilyMembers) { |
| | | try { |
| | | this.otherFamilyList = |
| | | typeof detailData.otherFamilyMembers === "string" |
| | | ? JSON.parse(detailData.otherFamilyMembers) |
| | | : detailData.otherFamilyMembers || []; |
| | | } catch (e) { |
| | | this.otherFamilyList = []; |
| | | } |
| | | } |
| | | // 映射字段到表单 |
| | | |
| | | this.form = { |
| | | ...this.form, |
| | | id: detailData.id || this.$route.query.id, |
| | | infoid: detailData.infoid || infoid, |
| | | infoid: detailData.infoid || this.infoid, |
| | | caseNo: detailData.caseNo || "", |
| | | name: detailData.name || "", |
| | | sex: detailData.sex || "", |
| | |
| | | assessannex: detailData.assessannex || "" |
| | | }; |
| | | |
| | | // 处理捐献决定数据 |
| | | // 初始化家属列表 |
| | | this.familyMemberList = []; |
| | | if (detailData.relativeconfirmationsignname) { |
| | | this.familyMemberList.push({ |
| | | name: detailData.relativeconfirmationsignname, |
| | | relation: detailData.signfamilyrelations || "", |
| | | phone: detailData.relativephone || "", |
| | | idcard: detailData.relativeidcardno || "" |
| | | }); |
| | | } |
| | | if (detailData.otherFamilyMembers) { |
| | | try { |
| | | const otherMembers = |
| | | typeof detailData.otherFamilyMembers === "string" |
| | | ? JSON.parse(detailData.otherFamilyMembers) |
| | | : detailData.otherFamilyMembers || []; |
| | | otherMembers.forEach(member => { |
| | | this.familyMemberList.push({ |
| | | name: member.name, |
| | | relation: member.relation, |
| | | phone: member.phone || "", |
| | | idcard: member.idcard || "" |
| | | }); |
| | | }); |
| | | } catch (e) { |
| | | console.warn("解析其他家属数据失败:", e); |
| | | } |
| | | } |
| | | |
| | | if (detailData.organdecision) { |
| | | this.organdecision = Array.isArray(detailData.organdecision) |
| | | ? detailData.organdecision |
| | | : detailData.organdecision.split(","); |
| | | } |
| | | console.log(this.organdecision, "this.organdecision"); |
| | | |
| | | // 处理附件数据 - 从assessannex字段解析JSON并按类型分类 |
| | | this.processAssessannexData(); |
| | | }, |
| | | |
| | | // 处理assessannex字段数据并按类型分类 |
| | | processAssessannexData() { |
| | | if (this.form.assessannex) { |
| | | try { |
| | |
| | | typeof this.form.assessannex === "string" |
| | | ? JSON.parse(this.form.assessannex) |
| | | : this.form.assessannex; |
| | | |
| | | // 清空现有数据 |
| | | Object.keys(this.attachmentData).forEach(key => { |
| | | this.attachmentData[key] = []; |
| | | }); |
| | | |
| | | // 按类型分类存储 |
| | | if (Array.isArray(annexData)) { |
| | | annexData.forEach(attachment => { |
| | | const type = attachment.type || "1"; // 默认到第一种类型 |
| | | const type = attachment.type || "1"; |
| | | if (this.attachmentData[type]) { |
| | | this.attachmentData[type].push(attachment); |
| | | } |
| | |
| | | } |
| | | }, |
| | | |
| | | // 根据类型获取附件列表 |
| | | getAttachmentsByType(type) { |
| | | return this.attachmentData[type] || []; |
| | | }, |
| | | |
| | | // 打开上传对话框 |
| | | openUploadDialog(type) { |
| | | this.currentUploadType = type; |
| | | this.tempFileList = []; |
| | |
| | | }); |
| | | }, |
| | | |
| | | // 上传前校验[7](@ref) |
| | | beforeUpload(file) { |
| | | const allowedTypes = [ |
| | | "application/pdf", |
| | |
| | | "application/msword", |
| | | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" |
| | | ]; |
| | | |
| | | const maxSize = 10 * 1024 * 1024; // 10MB |
| | | |
| | | // 校验文件类型 |
| | | const maxSize = 10 * 1024 * 1024; |
| | | const isTypeOk = |
| | | allowedTypes.includes(file.type) || |
| | | file.name.endsWith(".pdf") || |
| | |
| | | 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; |
| | | }, |
| | |
| | | this.$message.error(response.msg || "上传失败"); |
| | | return; |
| | | } |
| | | |
| | | const newAttachment = { |
| | | id: Date.now(), |
| | | fileName: file.name, |
| | |
| | | uploadTime: this.getCurrentTime(), |
| | | uploader: "当前用户" |
| | | }; |
| | | |
| | | this.attachmentData[this.currentUploadType].push(newAttachment); |
| | | this.updateAssessannexField(); |
| | | |
| | | this.$message.success("上传成功"); |
| | | this.uploadLoading = false; |
| | | this.uploadDialogVisible = false; |
| | |
| | | this.$message.warning("请先选择要上传的文件"); |
| | | return; |
| | | } |
| | | |
| | | this.uploadLoading = true; |
| | | this.$refs.uploadRef.submit(); // ✅ 只调用一次 |
| | | this.$refs.uploadRef.submit(); |
| | | }, |
| | | |
| | | // 删除附件 |
| | | handleRemoveAttachment(type, index) { |
| | | this.$confirm("确定要删除这个附件吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | |
| | | if (this.attachmentData[type] && this.attachmentData[type][index]) { |
| | | this.attachmentData[type].splice(index, 1); |
| | | this.$message.success("附件删除成功"); |
| | | this.updateAssessannexField(); // 更新存储字段 |
| | | this.updateAssessannexField(); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | openOtherFamilyDialog(index) { |
| | | this.isEditOtherFamily = typeof index === "number"; |
| | | this.editOtherFamilyIndex = index || -1; |
| | | |
| | | this.currentOtherFamily = this.isEditOtherFamily |
| | | ? { ...this.otherFamilyList[index] } |
| | | : { name: "", relation: "", phone: "" }; |
| | | // 家属操作方法 |
| | | openFamilyDialog(isMain) { |
| | | this.isEditFamilyMember = false; |
| | | this.editFamilyMemberIndex = -1; |
| | | this.familyDialogTitle = "添加其他家属"; |
| | | |
| | | this.otherFamilyDialogVisible = true; |
| | | // 如果还没有任何家属,则添加主要亲属 |
| | | if (this.familyMemberList.length === 0) { |
| | | this.currentFamilyMember = { |
| | | name: "", |
| | | relation: "", |
| | | phone: "", |
| | | idcard: "", |
| | | isMain: true |
| | | }; |
| | | this.familyDialogTitle = "添加主要亲属"; |
| | | } else { |
| | | this.currentFamilyMember = { |
| | | name: "", |
| | | relation: "", |
| | | phone: "", |
| | | idcard: "", |
| | | isMain: false |
| | | }; |
| | | } |
| | | |
| | | this.familyDialogVisible = true; |
| | | }, |
| | | editOtherFamily(index) { |
| | | this.openOtherFamilyDialog(index); |
| | | |
| | | editFamilyMember(index) { |
| | | this.isEditFamilyMember = true; |
| | | this.editFamilyMemberIndex = index; |
| | | const member = this.familyMemberList[index]; |
| | | this.currentFamilyMember = { |
| | | name: member.name, |
| | | relation: member.relation, |
| | | phone: member.phone || "", |
| | | idcard: member.idcard || "", |
| | | isMain: index === 0 |
| | | }; |
| | | this.familyDialogTitle = index === 0 ? "编辑主要亲属" : "编辑其他家属"; |
| | | this.familyDialogVisible = true; |
| | | }, |
| | | deleteOtherFamily(index) { |
| | | this.$confirm("确认删除该家属?", "提示", { type: "warning" }).then( |
| | | () => { |
| | | this.otherFamilyList.splice(index, 1); |
| | | this.updateOtherFamilyField(); |
| | | } |
| | | ); |
| | | |
| | | deleteFamilyMember(index) { |
| | | if (index === 0) { |
| | | this.$message.warning("主要亲属不可删除"); |
| | | return; |
| | | } |
| | | this.$confirm("确认删除该家属?", "提示", { type: "warning" }) |
| | | .then(() => { |
| | | this.familyMemberList.splice(index, 1); |
| | | this.updateFamilyMemberField(); |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | saveOtherFamily() { |
| | | if ( |
| | | !this.currentOtherFamily.name || |
| | | !this.currentOtherFamily.relation || |
| | | !this.currentOtherFamily.phone |
| | | ) { |
| | | this.$message.warning("请填写完整信息"); |
| | | |
| | | saveFamilyMember() { |
| | | if (!this.currentFamilyMember.name) { |
| | | this.$message.warning("请输入姓名"); |
| | | return; |
| | | } |
| | | if (!this.currentFamilyMember.relation) { |
| | | this.$message.warning("请选择与捐赠者关系"); |
| | | return; |
| | | } |
| | | |
| | | if (this.isEditOtherFamily) { |
| | | this.otherFamilyList.splice(this.editOtherFamilyIndex, 1, { |
| | | ...this.currentOtherFamily |
| | | }); |
| | | } else { |
| | | this.otherFamilyList.push({ ...this.currentOtherFamily }); |
| | | // 如果是主要亲属,验证身份证和电话 |
| | | if (this.currentFamilyMember.isMain) { |
| | | if (!this.currentFamilyMember.idcard) { |
| | | this.$message.warning("请输入主要亲属的身份证号"); |
| | | return; |
| | | } |
| | | if ( |
| | | !/^(\d{15}|\d{18}|\d{17}(\d|X|x))$/.test( |
| | | this.currentFamilyMember.idcard |
| | | ) |
| | | ) { |
| | | this.$message.warning("请输入正确的身份证号"); |
| | | return; |
| | | } |
| | | if (!this.currentFamilyMember.phone) { |
| | | this.$message.warning("请输入主要亲属的联系电话"); |
| | | return; |
| | | } |
| | | if (!/^1[3-9]\d{9}$/.test(this.currentFamilyMember.phone)) { |
| | | this.$message.warning("请输入正确的手机号"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.updateOtherFamilyField(); |
| | | this.otherFamilyDialogVisible = false; |
| | | const memberData = { |
| | | name: this.currentFamilyMember.name, |
| | | relation: this.currentFamilyMember.relation, |
| | | phone: this.currentFamilyMember.isMain |
| | | ? this.currentFamilyMember.phone |
| | | : "", |
| | | idcard: this.currentFamilyMember.isMain |
| | | ? this.currentFamilyMember.idcard |
| | | : "" |
| | | }; |
| | | |
| | | if (this.isEditFamilyMember) { |
| | | this.familyMemberList.splice(this.editFamilyMemberIndex, 1, memberData); |
| | | } else { |
| | | this.familyMemberList.push(memberData); |
| | | } |
| | | |
| | | this.updateFamilyMemberField(); |
| | | this.familyDialogVisible = false; |
| | | this.$message.success(this.isEditFamilyMember ? "编辑成功" : "添加成功"); |
| | | }, |
| | | updateOtherFamilyField() { |
| | | this.form.otherFamilyMembers = JSON.stringify(this.otherFamilyList); |
| | | |
| | | updateFamilyMemberField() { |
| | | if (this.familyMemberList.length > 0) { |
| | | const mainMember = this.familyMemberList[0]; |
| | | this.form.relativeconfirmationsignname = mainMember.name; |
| | | this.form.signfamilyrelations = mainMember.relation; |
| | | this.form.relativeidcardno = mainMember.idcard || ""; |
| | | this.form.relativephone = mainMember.phone || ""; |
| | | |
| | | const otherMembers = this.familyMemberList.slice(1).map(member => ({ |
| | | name: member.name, |
| | | relation: member.relation, |
| | | phone: member.phone || "", |
| | | idcard: member.idcard || "" |
| | | })); |
| | | this.form.otherFamilyMembers = JSON.stringify(otherMembers); |
| | | } else { |
| | | this.form.relativeconfirmationsignname = ""; |
| | | this.form.signfamilyrelations = ""; |
| | | this.form.relativeidcardno = ""; |
| | | this.form.relativephone = ""; |
| | | this.form.otherFamilyMembers = "[]"; |
| | | } |
| | | }, |
| | | // 更新assessannex存储字段 |
| | | |
| | | updateAssessannexField() { |
| | | // 将所有类型的附件合并为一个数组 |
| | | const allAttachments = []; |
| | | Object.values(this.attachmentData).forEach(attachments => { |
| | | allAttachments.push(...attachments); |
| | | }); |
| | | |
| | | // 更新到表单字段 |
| | | this.form.assessannex = JSON.stringify(allAttachments); |
| | | }, |
| | | |
| | | // 文件预览 |
| | | handlePreview(file) { |
| | | this.currentPreviewFile = { |
| | | fileName: 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; |
| | |
| | | } |
| | | }, |
| | | |
| | | // 获取文件类型 |
| | | 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(".") |
| | |
| | | .toLowerCase(); |
| | | }, |
| | | |
| | | // 文件大小格式化 |
| | | formatFileSize(size) { |
| | | if (!size) return "0 B"; |
| | | const k = 1024; |
| | |
| | | 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")}`; |
| | | }, |
| | | |
| | | accomplish() { |
| | | this.$confirm("是否完成该案例捐献确认步骤?", "提醒", { |
| | | confirmButtonText: "确定", |
| | |
| | | this.form.state = 3; |
| | | this.handleSave(); |
| | | }) |
| | | |
| | | .catch(() => {}); |
| | | }, |
| | | |
| | | // 保存确认信息 |
| | | async handleSave() { |
| | | try { |
| | | await this.$refs.form.validate(); |
| | | this.saveLoading = true; |
| | | |
| | | this.updateOtherFamilyField(); |
| | | this.updateFamilyMemberField(); |
| | | this.updateAssessannexField(); |
| | | |
| | | const saveData = { |
| | | ...this.form, |
| | | infoid: this.infoid, |
| | | organdecision: this.organdecision.join(","), |
| | | organdecisionOther: this.organdecisionOther |
| | | // assessannex字段已在updateAssessannexField中更新 |
| | | }; |
| | | if (saveData.state == 1 || !saveData.state) { |
| | | saveData.state = 2; |
| | | } |
| | | |
| | | let response = null; |
| | | if (saveData.id) { |
| | | response = await relativesEdit(saveData); |
| | |
| | | |
| | | .detail-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .main-family { |
| | | font-weight: bold; |
| | | color: #e6a23c; |
| | | } |
| | | |
| | | .attachment-card { |
| | |
| | | |
| | | .empty-attachment { |
| | | text-align: center; |
| | | padding: 40px 0; |
| | | padding: 30px 0; |
| | | color: #909399; |
| | | } |
| | | |