WXL
3 天以前 c8e9849cb5f24848df0174c13bfbbff37bb08a5a
src/views/business/maintain/maintainInfo.vue
@@ -52,10 +52,54 @@
              />
              <el-table-column label="培养结果" align="center" prop="result">
                <template slot-scope="scope">
                  <el-tag
                    :type="scope.row.result === '阴性' ? 'success' : 'danger'"
                    effect="plain"
                  <!-- 阳性结果带悬浮提示 -->
                  <el-tooltip
                    v-if="
                      scope.row.result === '阳性' && scope.row.positiveDetails
                    "
                    effect="light"
                    placement="top"
                    :open-delay="200"
                    popper-class="custom-positive-tooltip"
                  >
                    <div slot="content">
                      <div
                        style="font-weight: bold; color: #f56c6c; margin-bottom: 8px;"
                      >
                        <i class="el-icon-warning"></i> 阳性结果详情
                      </div>
                      <div
                        style="color: #606266; line-height: 1.6; white-space: pre-wrap;"
                      >
                        {{ scope.row.positiveDetails }}
                      </div>
                    </div>
                    <el-tag
                      type="danger"
                      effect="plain"
                      @click="handleResultClick(scope.row)"
                      style="cursor: pointer;"
                    >
                      {{ scope.row.result }}
                      <i class="el-icon-info" style="margin-left: 4px;"></i>
                    </el-tag>
                  </el-tooltip>
                  <!-- 阳性但没有详情的 -->
                  <el-tag
                    v-else-if="
                      scope.row.result === '阳性' && !scope.row.positiveDetails
                    "
                    type="danger"
                    effect="plain"
                    @click="handleResultClick(scope.row)"
                    style="cursor: pointer;"
                  >
                    {{ scope.row.result }}
                  </el-tag>
                  <!-- 阴性结果 -->
                  <el-tag v-else type="success" effect="plain">
                    {{ scope.row.result }}
                  </el-tag>
                </template>
@@ -208,6 +252,30 @@
            @data-change="handleUrineRoutineDataChange"
          />
        </el-tab-pane>
        <el-tab-pane label="心脏化验" name="heartLab">
          <heart-lab-panel
            ref="heartLab"
            :initial-data="assessmentData.heartLab"
            :is-editing="isEdit && activeTab === 'heartLab'"
            @data-change="handleHeartLabDataChange"
          />
        </el-tab-pane>
        <el-tab-pane label="肺脏化验" name="lungLab">
          <lung-lab-panel
            ref="lungLab"
            :initial-data="assessmentData.lungLab"
            :is-editing="isEdit && activeTab === 'lungLab'"
            @data-change="handleLungLabDataChange"
          />
        </el-tab-pane>
        <el-tab-pane label="胰腺化验" name="pancreasLab">
          <pancreas-lab-panel
            ref="pancreasLab"
            :initial-data="assessmentData.pancreasLab"
            :is-editing="isEdit && activeTab === 'pancreasLab'"
            @data-change="handlePancreasLabDataChange"
          />
        </el-tab-pane>
      </el-tabs>
    </el-card>
@@ -263,6 +331,7 @@
                v-model="cultureForm.result"
                placeholder="请选择培养结果"
                style="width: 100%"
                @change="handleResultChange"
              >
                <el-option label="阴性" value="阴性" />
                <el-option label="阳性" value="阳性" />
@@ -270,7 +339,19 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item
          v-if="cultureForm.result === '阳性'"
          label="阳性详情"
          prop="positiveDetails"
        >
          <el-input
            type="textarea"
            :rows="2"
            v-model="cultureForm.positiveDetails"
            placeholder="请输入阳性结果的详细信息"
            clearable
          />
        </el-form-item>
        <el-form-item label="附件">
          <UploadAttachment
            ref="cultureUploadAttachment"
@@ -441,6 +522,9 @@
import LiverKidneyPanel from "@/components/MaintainComponents/LiverKidneyPanel.vue";
import BloodRoutinePanel from "@/components/MaintainComponents/BloodRoutinePanel.vue";
import UrineRoutinePanel from "@/components/MaintainComponents/UrineRoutinePanel.vue";
import HeartLabPanel from "@/components/MaintainComponents/HeartLabPanel.vue";
import LungLabPanel from "@/components/MaintainComponents/LungLabPanel.vue";
import PancreasLabPanel from "@/components/MaintainComponents/PancreasLabPanel.vue";
import CaseBasicInfo from "@/components/CaseBasicInfo";
import store from "@/store";
import dayjs from "dayjs";
@@ -454,7 +538,10 @@
    LiverKidneyPanel,
    BloodRoutinePanel,
    UrineRoutinePanel,
    CaseBasicInfo
    CaseBasicInfo,
    HeartLabPanel,
    LungLabPanel,
    PancreasLabPanel
  },
  dicts: [
    "sys_donornode",
@@ -502,6 +589,7 @@
        cultureType: "",
        sampleTime: "",
        result: "阴性",
        positiveDetails: "", // 新增:阳性详情
        attachments: []
      },
      cultureFileList: [],
@@ -514,7 +602,8 @@
        ],
        result: [
          { required: true, message: "请选择培养结果", trigger: "change" }
        ]
        ],
        positiveDetails: [] // 动态验证规则
      },
      cultureTypeOptions: [
        { value: "1", label: "血培养" },
@@ -522,6 +611,7 @@
        { value: "3", label: "尿培养" },
        { value: "4", label: "伤口分泌物" },
        { value: "5", label: "脑脊液培养" },
        { value: "5", label: "皮肤" },
        { value: "6", label: "其他" }
      ],
@@ -570,6 +660,9 @@
        liverKidney: {},
        bloodRoutine: {},
        urineRoutine: {},
        heartLab: {}, // 新增
        lungLab: {}, // 新增
        pancreasLab: {}, // 新增
        cultureResults: [],
        nursingRecords: []
      }
@@ -643,6 +736,15 @@
              if (itemDescData.urineRoutine) {
                this.assessmentData.urineRoutine = itemDescData.urineRoutine;
              }
              if (itemDescData.heartLab) {
                this.assessmentData.heartLab = itemDescData.heartLab;
              }
              if (itemDescData.lungLab) {
                this.assessmentData.lungLab = itemDescData.lungLab;
              }
              if (itemDescData.pancreasLab) {
                this.assessmentData.pancreasLab = itemDescData.pancreasLab;
              }
            } catch (error) {
              console.error("解析itemDesc JSON失败:", error);
            }
@@ -661,7 +763,46 @@
        this.recordLoading = false;
      }
    },
    // 处理培养结果选择变化
    handleResultChange(value) {
      this.$nextTick(() => {
        if (value === "阳性") {
          this.cultureRules.positiveDetails = [
            { required: true, message: "请输入阳性详情", trigger: "blur" }
          ];
        } else {
          this.cultureRules.positiveDetails = [];
          this.cultureForm.positiveDetails = "";
        }
        // 清除验证
        if (this.$refs.cultureForm) {
          this.$refs.cultureForm.clearValidate("positiveDetails");
        }
      });
    },
    // 处理点击培养结果标签
    handleResultClick(row) {
      if (row.result === "阳性" && row.positiveDetails) {
        this.$alert(
          `<div style="padding: 10px;">
        <h4 style="margin-bottom: 10px; color: #f56c6c;">阳性详情:</h4>
        <div style="background: #fef0f0; padding: 15px; border-radius: 4px; border-left: 4px solid #f56c6c;">
          <p style="margin: 0; white-space: pre-wrap; line-height: 1.5;">${row.positiveDetails}</p>
        </div>
      </div>`,
          "阳性结果详情",
          {
            dangerouslyUseHTMLString: true,
            confirmButtonText: "关闭",
            customClass: "result-details-dialog",
            showClose: false
          }
        );
      } else if (row.result === "阳性") {
        this.$message.warning("该阳性记录暂无详情信息");
      }
    },
    // 保存所有数据
    async handleSave() {
      try {
@@ -671,6 +812,9 @@
            liverKidney: this.assessmentData.liverKidney,
            bloodRoutine: this.assessmentData.bloodRoutine,
            urineRoutine: this.assessmentData.urineRoutine,
            heartLab: this.assessmentData.heartLab, // 新增
            lungLab: this.assessmentData.lungLab, // 新增
            pancreasLab: this.assessmentData.pancreasLab, // 新增
            cultureResults: this.cultureList,
            nursingRecords: this.recordList
          }
@@ -680,7 +824,7 @@
        }
        this.extracontentinfo.specialMedicalHistory = this.form.specialMedicalHistory;
        let response;
        if (this.isEditMode && this.currentMaintenanceId) {
        if (this.currentMaintenanceId) {
          saveData.id = this.currentMaintenanceId;
          response = await maintainedit(saveData);
        } else {
@@ -689,7 +833,7 @@
        if (response.code === 200) {
          this.$message.success("保存成功");
          this.isEdit = false;
          // this.isEdit = false;
          if (!this.currentMaintenanceId) {
            this.currentMaintenanceId = response.data;
          }
@@ -709,13 +853,22 @@
        this.$message.error("保存失败");
      }
    },
    // 5. 在 methods 中添加数据处理方法
    handleHeartLabDataChange(data) {
      this.assessmentData.heartLab = data;
    },
    handleLungLabDataChange(data) {
      this.assessmentData.lungLab = data;
    },
    handlePancreasLabDataChange(data) {
      this.assessmentData.pancreasLab = data;
    },
    // 切换编辑模式
    toggleEditMode() {
      this.isEdit = !this.isEdit;
      if (!this.isEdit) {
        this.handleSave();
      }
      // this.isEdit = !this.isEdit;
      // if (!this.isEdit) {
      // }
      this.handleSave();
    },
    accomplish() {
      this.$confirm("是否完成该案例捐献确认步骤?", "提醒", {
@@ -747,9 +900,13 @@
      });
    },
    // 5. 修改编辑培养记录方法
    handleEditCulture(row) {
      this.cultureDialogTitle = "编辑培养记录";
      this.cultureForm = { ...row };
      this.cultureForm = {
        ...row,
        positiveDetails: row.positiveDetails || "" // 确保有positiveDetails字段
      };
      this.cultureFileList = row.attachments
        ? row.attachments.map(item => ({
            uid: item.id || Math.random(),
@@ -763,27 +920,44 @@
      this.cultureDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.cultureForm && this.$refs.cultureForm.clearValidate();
        // 如果编辑时是阳性结果,设置验证规则
        if (row.result === "阳性") {
          this.cultureRules.positiveDetails = [
            { required: true, message: "请输入阳性详情", trigger: "blur" }
          ];
        }
      });
    },
    // 6. 修改保存培养记录方法
    handleSaveCulture() {
      this.$refs.cultureForm.validate(valid => {
        if (valid) {
          this.cultureSaveLoading = true;
          if (this.cultureForm.id) {
          // 构建保存数据
          const saveData = {
            ...this.cultureForm,
            // 如果是阴性,清空阳性详情
            positiveDetails:
              this.cultureForm.result === "阳性"
                ? this.cultureForm.positiveDetails || ""
                : ""
          };
          if (saveData.id) {
            const index = this.cultureList.findIndex(
              item => item.id === this.cultureForm.id
              item => item.id === saveData.id
            );
            if (index !== -1) {
              this.cultureList.splice(index, 1, { ...this.cultureForm });
              this.cultureList.splice(index, 1, { ...saveData });
            }
          } else {
            this.cultureForm.id = Date.now();
            this.cultureList.push({ ...this.cultureForm });
            saveData.id = Date.now();
            this.cultureList.push({ ...saveData });
          }
          this.$message.success(this.cultureForm.id ? "修改成功" : "新增成功");
          this.$message.success(saveData.id ? "修改成功" : "新增成功");
          this.cultureDialogVisible = false;
          this.cultureSaveLoading = false;
        }
@@ -1171,4 +1345,25 @@
  font-size: 13px;
  margin-left: 8px;
}
/* 7. 添加一些样式 */
.result-details-dialog {
  width: 500px;
}
.result-details-dialog .el-message-box__content {
  padding: 0;
}
.result-details-dialog .el-message-box__header {
  background: #fef0f0;
  border-bottom: 1px solid #fde2e2;
}
.result-details-dialog .el-message-box__title {
  color: #f56c6c;
  font-weight: bold;
}
.custom-positive-tooltip {
  max-width: 400px;
}
</style>