WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/business/allocation/allocationInfo.vue
@@ -1,43 +1,36 @@
<template>
  <div class="organ-allocation-detail">
    <case-basic-info :case-id="caseId" :show-attachment="true" />
    <case-basic-info :case-id="caseId" :show-attachment="true":column="3" />
    <!-- 基本信息部分 -->
    <el-card class="detail-card">
    <el-card class="detail-card paper-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">器官分配基本信息</span>
      </div>
      <el-form :model="form" ref="form" :rules="rules" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="分配状态" prop="allocationStatus">
              <el-select v-model="form.allocationStatus" placeholder="请选择分配状态">
                <el-option v-for="dict in dict.type.organ_allocation_status || []" :key="dict.value" :label="dict.label"
                  :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分配时间" prop="allocationTime">
              <el-date-picker v-model="form.allocationTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%" :disabled="form.allocationStatus == '1'" />
            </el-form-item>
          </el-col>
        </el-row>
      <el-form :model="form" ref="form" :rules="rules" label-width="120px" class="paper-form">
        <div class="form-row">
          <el-form-item label="分配状态" prop="allocationStatus" class="col-half">
            <el-select v-model="form.allocationStatus" placeholder="请选择分配状态" :disabled="isReadOnly">
              <el-option v-for="dict in dict.type.organ_allocation_status || []" :key="dict.value" :label="dict.label"
                :value="dict.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="分配时间" prop="allocationTime" class="col-half">
            <el-date-picker v-model="form.allocationTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
              style="width: 100%" :disabled="form.allocationStatus == '1' || isReadOnly" />
          </el-form-item>
        </div>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="负责人" prop="registrationName">
              <el-input v-model="form.registrationName" />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="form-row">
          <el-form-item label="负责人" prop="registrationName" class="col-half">
              <el-input v-model="form.registrationName" :disabled="isReadOnly" />
          </el-form-item>
        </div>
      </el-form>
    </el-card>
    <!-- 器官分配记录部分 -->
    <el-card class="allocation-card">
    <el-card class="allocation-card paper-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">器官分配记录</span>
        <div style="float: right;">
@@ -45,25 +38,22 @@
        </div>
      </div>
      <el-form ref="allocationForm" :rules="allocationRules" :model="allocationData" label-position="right">
        <el-row>
          <el-col>
            <el-form-item label-width="100px" label="分配器官">
      <el-form ref="allocationForm" :rules="allocationRules" :model="allocationData" label-position="right" class="paper-form">
        <div class="form-row">
          <el-form-item label-width="100px" label="分配器官" class="col-full">
              <el-checkbox-group v-model="selectedOrgans" @change="handleOrganSelectionChange">
                <el-checkbox v-for="dict in dict.type.sys_Organ || []" :key="dict.value" :label="dict.value"
                  :disabled="form.allocationStatus == '1'">
                  :disabled="form.allocationStatus == '1' || isReadOnly">
                  {{ dict.label }}
                </el-checkbox>
              </el-checkbox-group>
              <el-input v-if="showOtherInput" v-model="otherOrganInput" placeholder="请输入其他器官名称"
                style="margin-top: 10px; width: 300px;" :disabled="form.allocationStatus == '1'" />
            </el-form-item>
          </el-col>
        </el-row>
                style="margin-top: 10px; width: 300px;" :disabled="form.allocationStatus == '1' || isReadOnly" />
          </el-form-item>
        </div>
        <el-row>
          <el-col>
            <el-form-item>
        <div class="form-row">
          <el-form-item class="col-full">
              <el-table :data="displayOrgans" v-loading="loading" border style="width: 100%"
                :row-class-name="getOrganRowClassName">
                <el-table-column label="序号" type="index" width="60" align="center" fixed></el-table-column>
@@ -105,7 +95,7 @@
                  <template slot-scope="scope">
                    <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.applicanttime"
                      type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择开始接收时间" :disabled="form.allocationStatus == '1' ||
                        scope.row.allocationstatus == '3'
                        scope.row.allocationstatus == '3' || isReadOnly
                        " />
                  </template>
                </el-table-column>
@@ -113,7 +103,7 @@
                  <template slot-scope="scope">
                    <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.organgettime"
                      type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择分配接收时间" :disabled="form.allocationStatus == '1' ||
                        scope.row.allocationstatus == '3'
                        scope.row.allocationstatus == '3' || isReadOnly
                        " />
                  </template>
                </el-table-column>
@@ -121,7 +111,7 @@
                <el-table-column label="受体姓氏" align="center" width="120" prop="name">
                  <template slot-scope="scope">
                    <el-input v-model="scope.row.name" placeholder="受体姓氏" :disabled="form.allocationStatus == '1' ||
                      scope.row.allocationstatus == '3'
                      scope.row.allocationstatus == '3' || isReadOnly
                      " />
                  </template>
                </el-table-column>
@@ -129,7 +119,7 @@
                <el-table-column label="移植医院" align="center" width="200" prop="transplanthospitalname">
                  <template slot-scope="scope">
                    <el-autocomplete v-model="scope.row.transplanthospitalname" :fetch-suggestions="queryHospitalSearch"
                      placeholder="请选择或输入移植医院" style="width: 100%" clearable></el-autocomplete>
                      placeholder="请选择或输入移植医院" style="width: 100%" :disabled="isReadOnly" clearable></el-autocomplete>
                  </template>
                  <!-- <template slot-scope="scope">
                    <el-select
@@ -153,7 +143,7 @@
                    <div v-if="scope.row.allocationstatus != '3'">
                      <el-input type="textarea" clearable v-model="scope.row.reallocationreason" placeholder="请输入说明"
                        :disabled="form.allocationStatus == '1' ||
                          scope.row.allocationstatus == '3'
                          scope.row.allocationstatus == '3' || isReadOnly
                          " />
                    </div>
                    <div v-else>
@@ -179,7 +169,7 @@
                </el-table-column>
                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width"
                  v-if="form.allocationStatus !== '1'" fixed="right">
                  v-if="!isReadOnly && form.allocationStatus !== '1'" fixed="right">
                  <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-copy-document"
                      @click="handleRedistribution(scope.row)" :disabled="scope.row.allocationstatus == '3'"
@@ -202,8 +192,7 @@
                </el-table-column>
              </el-table>
            </el-form-item>
          </el-col>
        </el-row>
        </div>
        <!-- 分配统计信息 -->
        <!-- <div
@@ -263,7 +252,7 @@
      </div>
      <!-- 使用 UploadAttachment 组件 -->
      <UploadAttachment ref="uploadAttachment" :file-list="attachmentFileList" :limit="attachmentLimit"
      <UploadAttachment v-if="!isReadOnly" ref="uploadAttachment" :file-list="attachmentFileList" :limit="attachmentLimit"
        :accept="attachmentAccept" :multiple="true" @change="handleAttachmentChange"
        @upload-success="handleUploadSuccess" @upload-error="handleUploadError" @remove="handleAttachmentRemove" />
@@ -303,7 +292,7 @@
              <el-button size="mini" type="success" @click="handleDownloadAttachment(scope.row)">
                下载
              </el-button>
              <el-button size="mini" type="danger" @click="handleRemoveAttachment(scope.$index)">
              <el-button v-if="!isReadOnly" size="mini" type="danger" @click="handleRemoveAttachment(scope.$index)">
                删除
              </el-button>
            </template>
@@ -311,7 +300,7 @@
        </el-table>
      </div>
    </el-card>
    <div style="text-align: center; margin: 30px 0;">
    <div v-if="!isReadOnly" style="text-align: center; margin: 30px 0;">
      <el-button type="primary" @click="handleSave" :loading="saveLoading">
        保存
      </el-button>
@@ -458,6 +447,7 @@
  allocationedit,
  donateorganBaseinfoInfo
} from "@/api/businessApi";
import { getDonatebaseinfo } from "@/api/project/donatebaseinfo";
import UploadAttachment from "@/components/UploadAttachment";
import FilePreviewDialog from "@/components/FilePreviewDialog";
import OrgSelecter from "@/views/project/components/orgselect";
@@ -575,6 +565,10 @@
    };
  },
  computed: {
    // 查看模式:只读,禁用表单并隐藏保存按钮
    isReadOnly() {
      return this.$route.query.mode === "view";
    },
    // 当前用户信息
    currentUser() {
      return JSON.parse(sessionStorage.getItem("user") || "{}");
@@ -583,15 +577,16 @@
    return (this.allocationData.serviceDonateorganList || [])
      .filter(item => item.delFlag !== 1);
  },
    // 不完整的记录数量
    // 不完整的记录数量(重分配记录不参与校验)
    incompleteRecords() {
      if (!this.allocationData.serviceDonateorganList) return 0;
      return this.allocationData.serviceDonateorganList.filter(
        record =>
          !record.applicanttime ||
          !record.organgettime ||
          !record.name ||
          !record.transplanthospitalname
          record.allocationstatus != "3" &&
          (!record.applicanttime ||
            !record.organgettime ||
            !record.name ||
            !record.transplanthospitalname)
      ).length;
    },
    // 待审核记录数量
@@ -1304,6 +1299,7 @@
    // 保存基本信息
    async handleSave() {
      if (this.saveLoading) return;
      this.$refs.form.validate(async valid => {
        if (!valid) {
          this.$message.warning("请完善表单信息");
@@ -1312,6 +1308,14 @@
        this.saveLoading = true;
        try {
          // 新增时校验是否已有相同患者
          if (!this.form.id) {
            const exists = await this.checkPatientExists();
            if (exists) {
              this.$message.warning("该患者已存在,请勿重复添加");
              return;
            }
          }
          const saveData = {
            ...this.form,
            serviceDonateorganList:
@@ -1355,6 +1359,27 @@
          this.saveLoading = false;
        }
      });
    },
    // 新增时校验是否已有相同患者(按住院号)
    async checkPatientExists() {
      let inpatientno = this.form.inpatientno;
      if (!inpatientno && this.caseId) {
        try {
          const caseRes = await getDonatebaseinfo(this.caseId);
          inpatientno = (caseRes.data && caseRes.data.inpatientno) || "";
        } catch (e) {
          inpatientno = "";
        }
      }
      if (!inpatientno) return false;
      try {
        const res = await allocationList({ inpatientno, pageNum: 1, pageSize: 1 });
        const list = res.data || [];
        return list.some(item => item && item.id != null && item.id !== "");
      } catch (e) {
        return false;
      }
    },
    // 确认完成分配
@@ -1887,4 +1912,103 @@
    font-size: 11px;
  }
}
/* ===== 纸质表格网格样式 ===== */
.paper-card >>> .el-card__body {
  padding: 16px;
}
.paper-form {
  border-left: 1px solid #d0d3db;
  background: #fff;
}
.paper-form >>> .form-row {
  display: flex;
  width: 100%;
  border-top: 1px solid #d0d3db;
  /* 上移1px与上一行的border-bottom重叠,两行之间只显示一条1px细线 */
  margin-top: -1px;
}
.paper-form >>> .form-row:first-child {
  margin-top: 0;
}
/* 行尾空白填充:不满整行的右侧自动补一个空白格子,网格保持闭合(右侧适当留白) */
.paper-form >>> .form-row::after {
  content: "";
  flex: 1 1 0;
  min-height: 42px;
  background: linear-gradient(to left, #d0d3db 1px, transparent 1px),
    linear-gradient(to top, #d0d3db 1px, transparent 1px);
  background-color: #fff;
}
.paper-form >>> .el-form-item {
  flex: 0 0 33.3333%;
  display: flex;
  margin: 0;
  background: #fff;
  border-right: 1px solid #d0d3db;
  border-bottom: 1px solid #d0d3db;
}
.paper-form >>> .el-form-item::after,
.paper-form >>> .el-form-item::before {
  display: none;
}
.paper-form >>> .col-1-3 { flex: 0 0 33.3333%; }
.paper-form >>> .col-half { flex: 0 0 50%; }
.paper-form >>> .col-2-3 { flex: 0 0 66.6666%; }
.paper-form >>> .col-full { flex: 0 0 100%; }
.paper-form >>> .el-form-item__label {
  flex: 0 0 150px;
  width: 150px !important;
  float: none;
  padding: 0 8px !important;
  background: #ecf5ff;
  border-right: 1px solid #d0d3db;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #2c3038;
  line-height: 1.3;
  white-space: nowrap;
}
.paper-form >>> .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
  color: #f56c6c;
  margin-right: 2px;
}
.paper-form >>> .el-form-item__content {
  flex: 1;
  margin-left: 0 !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: #fff;
  min-height: 42px;
  line-height: 1.4;
}
/* 控件宽度适中,不铺满整格(内容短时输入框不再拉得很长) */
.paper-form >>> .el-form-item__content .el-input,
.paper-form >>> .el-form-item__content .el-select,
.paper-form >>> .el-form-item__content .el-cascader {
  width: 220px;
  max-width: 100%;
}
.paper-form >>> .el-form-item__content .el-date-editor {
  width: 240px;
  max-width: 100%;
}
.paper-form >>> .el-form-item__content .el-range-editor {
  width: 360px;
  max-width: 100%;
}
</style>