董国庆
2026-05-21 a60599a1bf053258cac42ae87d688e46a780dbb5
refactor: 统一各页面加载状态的变量命名

将项目列表和审核计划页面中的通用loading变量重构为贴合业务的专属命名,避免不同模块的加载状态互相干扰,提升代码可读性与可维护性。
2个文件已修改
51 ■■■■■ 已修改文件
screen/src/view/planOfAudit/index.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
screen/src/view/projectList/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
screen/src/view/planOfAudit/index.vue
@@ -144,7 +144,7 @@
        :data="checkList"
        height="800"
        style="border: 2px solid #3d7fff"
        v-loading="loading"
        v-loading="listLoading"
      >
        <el-table-column label="检查计划" prop="planName" min-width="150" />
        <el-table-column label="计划类型" min-width="120">
@@ -246,7 +246,7 @@
      <CustomTable
        :data="checkMaterialList"
        height="630"
        v-loading="loading"
        v-loading="materialListLoading"
      >
        <el-table-column label="检查标题" prop="title" min-width="150" />
        <!-- 以下列仅在非项目端(type != 2)时显示 -->
@@ -291,7 +291,7 @@
      width="1420px"
      @close="closeReportDialog"
    >
      <div style="height: 691px;" class="flex flex-column" v-loading="loading">
      <div style="height: 691px;" class="flex flex-column" v-loading="reportLoading">
        <!-- PDF预览容器 -->
        <div
          v-if="showPreview && pdfUrl"
@@ -321,7 +321,7 @@
      width="1420px"
      @close="closeDetailDialog"
    >
      <div class="oa" style="height: 700px" v-loading="loading">
      <div class="oa" style="height: 700px" v-loading="detailLoading">
        <div class="flex j-between gap--30 mt--30">
          <div class="flex1">
            <div class="SHSR fs--16 lh--16 mb--17 color1">计划名称:</div>
@@ -485,7 +485,10 @@
      reportUrl: '', // 已废弃,保留兼容性
      reportBlobUrl: '', // Blob URL用于下载
      pdfUrl: '', // PDF预览URL
      loading: false,
      listLoading: false,
      materialListLoading: false,
      detailLoading: false,
      reportLoading: false,
      showPreview: false, // 是否显示预览
      reportPopoverVisibleId: null,
@@ -568,7 +571,7 @@
    // 获取检查列表
    async getCheckList () {
      this.loading = true
      this.listLoading = true
      try {
        const params = {
          pageNum: this.currentPage,
@@ -601,7 +604,7 @@
        console.error('获取检查列表失败:', error)
        this.$message.error('获取检查列表失败')
      } finally {
        this.loading = false
        this.listLoading = false
      }
    },
@@ -649,7 +652,7 @@
        return
      }
      this.loading = true
      this.materialListLoading = true
      try {
        const res = await getDeviceDetailCheckPlanList({
          planId: this.currentPlanId,
@@ -662,7 +665,7 @@
        console.error('获取检查资料列表失败:', error)
        this.$message.error('获取检查资料列表失败')
      } finally {
        this.loading = false
        this.materialListLoading = false
      }
    },
@@ -680,7 +683,7 @@
        return
      }
      this.loading = true
      this.detailLoading = true
      try {
        const res = await getDeviceDetailCheckPlanDetail({
          id: this.currentCheckId
@@ -692,7 +695,7 @@
        console.error('获取检查资料详情失败:', error)
        this.$message.error('获取检查资料详情失败')
      } finally {
        this.loading = false
        this.detailLoading = false
      }
    },
@@ -728,7 +731,7 @@
      this.currentRow = row
      this.reportVisible = true
      this.showPreview = false
      this.loading = true
      this.reportLoading = true
      try {
        // 从 sessionStorage 获取模板 ID
@@ -741,7 +744,7 @@
        const checkTaskId = row.id
        if (!checkTaskId) {
          this.$message.error('缺少检查任务ID')
          this.loading = false
          this.reportLoading = false
          this.reportVisible = false
          return
        }
@@ -752,7 +755,7 @@
          if (type === 'safe') {
            if (!safetyId) {
              this.$message.error('缺少安全报告模板ID')
              this.loading = false
              this.reportLoading = false
              this.reportVisible = false
              return
            }
@@ -773,7 +776,7 @@
          } else {
            if (!deviceTemplateId) {
              this.$message.error('缺少设备报告模板ID')
              this.loading = false
              this.reportLoading = false
              this.reportVisible = false
              return
            }
@@ -795,7 +798,7 @@
        } catch (error) {
          console.error('生成Word文档失败:', error)
          this.$message.error(error.message || '生成报告失败')
          this.loading = false
          this.reportLoading = false
          this.reportVisible = false
          return
        }
@@ -803,7 +806,7 @@
        // 检查 Word 文档是否生成成功
        if (!wordBlob || wordBlob.size === 0) {
          this.$message.error('报告生成失败')
          this.loading = false
          this.reportLoading = false
          this.reportVisible = false
          return
        }
@@ -818,7 +821,7 @@
        } catch (error) {
          console.error('获取PDF链接失败:', error)
          this.$message.error(error.message || '获取PDF链接失败')
          this.loading = false
          this.reportLoading = false
          this.reportVisible = false
          return
        }
@@ -833,7 +836,7 @@
        if (!pdfUrl) {
          this.$message.error('获取PDF链接失败')
          this.loading = false
          this.reportLoading = false
          this.reportVisible = false
          return
        }
@@ -864,7 +867,7 @@
        this.showPreview = false
        this.reportVisible = false
      } finally {
        this.loading = false
        this.reportLoading = false
      }
    },
screen/src/view/projectList/index.vue
@@ -211,7 +211,7 @@
        :data="tableData"
        height="800"
        style="border: 2px solid #3d7fff"
        v-loading="loading"
        v-loading="listLoading"
      >
        <el-table-column label="项目名称" prop="name" min-width="150" />
        <el-table-column label="项目类型" min-width="120" prop="type">
@@ -519,7 +519,7 @@
      // 表格数据
      tableData: [],
      loading: false,
      listLoading: false,
      total: 0,
      currentPage: 1,
      pageSize: 10,
@@ -640,7 +640,7 @@
    // 加载表格数据
    async loadTableData () {
      this.loading = true
      this.listLoading = true
      try {
        const params = {
          pageNum: this.currentPage,
@@ -676,7 +676,7 @@
        console.error('加载项目列表失败:', error)
        this.$message.error('加载项目列表失败')
      } finally {
        this.loading = false
        this.listLoading = false
      }
    },