WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/business/allocation/allocationInfo.vue
@@ -10,20 +10,20 @@
      <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="请选择分配状态">
            <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'" />
              style="width: 100%" :disabled="form.allocationStatus == '1' || isReadOnly" />
          </el-form-item>
        </div>
        <div class="form-row">
          <el-form-item label="负责人" prop="registrationName" class="col-half">
              <el-input v-model="form.registrationName" />
              <el-input v-model="form.registrationName" :disabled="isReadOnly" />
          </el-form-item>
        </div>
      </el-form>
@@ -43,12 +43,12 @@
          <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'" />
                style="margin-top: 10px; width: 300px;" :disabled="form.allocationStatus == '1' || isReadOnly" />
          </el-form-item>
        </div>
@@ -95,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>
@@ -103,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>
@@ -111,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>
@@ -119,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
@@ -143,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>
@@ -169,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'"
@@ -252,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" />
@@ -292,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>
@@ -300,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>
@@ -447,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";
@@ -564,6 +565,10 @@
    };
  },
  computed: {
    // 查看模式:只读,禁用表单并隐藏保存按钮
    isReadOnly() {
      return this.$route.query.mode === "view";
    },
    // 当前用户信息
    currentUser() {
      return JSON.parse(sessionStorage.getItem("user") || "{}");
@@ -572,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;
    },
    // 待审核记录数量
@@ -1293,6 +1299,7 @@
    // 保存基本信息
    async handleSave() {
      if (this.saveLoading) return;
      this.$refs.form.validate(async valid => {
        if (!valid) {
          this.$message.warning("请完善表单信息");
@@ -1301,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:
@@ -1346,6 +1361,27 @@
      });
    },
    // 新增时校验是否已有相同患者(按住院号)
    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;
      }
    },
    // 确认完成分配
    async handleConfirmAllocation() {
      if (this.incompleteRecords > 0) {