WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/business/maintain/maintainInfo.vue
@@ -6,16 +6,20 @@
      <div slot="header" class="clearfix">
        <span class="detail-title">评估各项记录</span>
        <el-button
          v-if="!isReadOnly"
          type="primary"
          size="mini"
          :loading="saveLoading"
          @click="toggleEditMode"
          style="float: right;margin-left: 20px;"
        >
          保存编辑
        </el-button>
        <el-button
          v-if="!isReadOnly"
          type="success"
          size="mini"
          :loading="saveLoading"
          @click="accomplish"
          style="float: right;margin-left: 20px;"
        >
@@ -30,6 +34,7 @@
            <div slot="header" class="clearfix">
              <span class="detail-title">培养结果记录</span>
              <el-button
                v-if="!isReadOnly"
                type="primary"
                size="mini"
                icon="el-icon-plus"
@@ -120,6 +125,7 @@
                </template>
              </el-table-column>
              <el-table-column
                v-if="!isReadOnly"
                label="操作"
                align="center"
                width="200"
@@ -151,6 +157,7 @@
            <div slot="header" class="clearfix">
              <span class="detail-title">护理核查记录</span>
              <el-button
                v-if="!isReadOnly"
                type="primary"
                size="mini"
                icon="el-icon-plus"
@@ -196,6 +203,7 @@
                </template>
              </el-table-column>
              <el-table-column
                v-if="!isReadOnly"
                label="操作"
                align="center"
                width="180"
@@ -228,7 +236,7 @@
          <liver-kidney-panel
            ref="liverKidney"
            :initial-data="assessmentData.liverKidney"
            :is-editing="isEdit && activeTab === 'liverKidney'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'liverKidney'"
            @data-change="handleLiverKidneyDataChange"
          />
        </el-tab-pane>
@@ -238,7 +246,7 @@
          <blood-routine-panel
            ref="bloodRoutine"
            :initial-data="assessmentData.bloodRoutine"
            :is-editing="isEdit && activeTab === 'bloodRoutine'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'bloodRoutine'"
            @data-change="handleBloodRoutineDataChange"
          />
        </el-tab-pane>
@@ -248,7 +256,7 @@
          <urine-routine-panel
            ref="urineRoutine"
            :initial-data="assessmentData.urineRoutine"
            :is-editing="isEdit && activeTab === 'urineRoutine'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'urineRoutine'"
            @data-change="handleUrineRoutineDataChange"
          />
        </el-tab-pane>
@@ -256,7 +264,7 @@
          <heart-lab-panel
            ref="heartLab"
            :initial-data="assessmentData.heartLab"
            :is-editing="isEdit && activeTab === 'heartLab'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'heartLab'"
            @data-change="handleHeartLabDataChange"
          />
        </el-tab-pane>
@@ -264,7 +272,7 @@
          <lung-lab-panel
            ref="lungLab"
            :initial-data="assessmentData.lungLab"
            :is-editing="isEdit && activeTab === 'lungLab'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'lungLab'"
            @data-change="handleLungLabDataChange"
          />
        </el-tab-pane>
@@ -272,7 +280,7 @@
          <pancreas-lab-panel
            ref="pancreasLab"
            :initial-data="assessmentData.pancreasLab"
            :is-editing="isEdit && activeTab === 'pancreasLab'"
            :is-editing="!isReadOnly && isEdit && activeTab === 'pancreasLab'"
            @data-change="handlePancreasLabDataChange"
          />
        </el-tab-pane>
@@ -516,6 +524,7 @@
<script>
import { maintainList, maintainedit, maintainAdd } from "@/api/businessApi";
import { getDonatebaseinfo } from "@/api/project/donatebaseinfo";
import Pagination from "@/components/Pagination";
import UploadAttachment from "@/components/UploadAttachment";
import FilePreviewDialog from "@/components/FilePreviewDialog";
@@ -558,6 +567,7 @@
      isEdit: true,
      currentMaintenanceId: null,
      isEditMode: false,
      saveLoading: false,
      form: {
        id: undefined,
        caseNo: "",
@@ -676,6 +686,12 @@
  watch: {
    $route(to, from) {
      this.loadMaintenanceData();
    }
  },
  computed: {
    // 查看模式:只读,禁用表单并隐藏保存按钮
    isReadOnly() {
      return this.$route.query.mode === "view";
    }
  },
  methods: {
@@ -805,7 +821,17 @@
    },
    // 保存所有数据
    async handleSave() {
      if (this.saveLoading) return;
      this.saveLoading = true;
      try {
        // 新增时校验是否已有相同患者
        if (!this.currentMaintenanceId) {
          const exists = await this.checkPatientExists();
          if (exists) {
            this.$message.warning("该患者已存在,请勿重复添加");
            return;
          }
        }
        const saveData = {
          ...this.form,
          itemDesc: {
@@ -851,6 +877,28 @@
      } catch (error) {
        console.error("保存数据失败:", error);
        this.$message.error("保存失败");
      } finally {
        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 maintainList({ inpatientno, pageNum: 1, pageSize: 1 });
        const list = res.data || [];
        return list.some(item => item && item.id != null && item.id !== "");
      } catch (e) {
        return false;
      }
    },
    // 5. 在 methods 中添加数据处理方法
@@ -1373,7 +1421,6 @@
}
.paper-form {
  border-top: 1px solid #d0d3db;
  border-left: 1px solid #d0d3db;
  background: #fff;
}
@@ -1381,6 +1428,22 @@
.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 {
@@ -1402,11 +1465,11 @@
.paper-form >>> .col-full { flex: 0 0 100%; }
.paper-form >>> .el-form-item__label {
  flex: 0 0 120px;
  width: 120px !important;
  flex: 0 0 150px;
  width: 150px !important;
  float: none;
  padding: 0 8px !important;
  background: #f3f5f9;
  background: #ecf5ff;
  border-right: 1px solid #d0d3db;
  display: flex;
  align-items: center;
@@ -1416,8 +1479,7 @@
  font-weight: 600;
  color: #2c3038;
  line-height: 1.3;
  white-space: normal;
  word-break: break-all;
  white-space: nowrap;
}
.paper-form >>> .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
  color: #f56c6c;
@@ -1435,4 +1497,20 @@
  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>