feat(device): 核查计划检查日期精确到日;提前审核增加归档提醒;删除放开至未开始/待批准行
已修改2个文件
141 ■■■■■ 文件已修改
src/views/CNAS/resourceDemand/device/component/checkRecord.vue 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/checkRecord.vue
@@ -141,6 +141,7 @@
  findExaminePlanDetail,
  resolveExaminePlanDetail,
  updateDeviceExaminePlanDetail,
  getDeviceById,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import LimsAttachment from '@/components/Attachment/lims-attachment.vue'
@@ -178,6 +179,7 @@
      selectedDeviceId: '',
      submitFormLoading: false,
      userList: [],
      planDueDate: '',
      rules: {
        checkMethod: [{ required: true, message: '请填写核查方式', trigger: 'blur' }],
      },
@@ -209,6 +211,15 @@
        fileName: row.fileName || '',
        fileUrl: row.fileUrl || '',
        planDetailsId: row.planDetailsId,
      }
      this.planDueDate = ''
      if (row.deviceId && /^\d{4}-\d{2}$/.test(this.form.checkTime)) {
        getDeviceById({ deviceId: row.deviceId }).then(res => {
          const due = res.data && res.data.nextExamineDate
          if (due && String(due).slice(0, 7) === this.form.checkTime) {
            this.planDueDate = String(due).slice(0, 10)
          }
        }).catch(() => {})
      }
    },
    // 新增核查记录:自选设备,提交时自动匹配/创建本轮计划明细
@@ -328,6 +339,48 @@
    },
    // 提交审核
    examine(statue) {
      const checkTime = this.form.checkTime || ''
      const now = new Date()
      const nowMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
      const checkMonth = checkTime.slice(0, 7)
      const isEarlyReview = statue === 1 && /^\d{4}-\d{2}/.test(checkTime) && checkMonth > nowMonth
      if (!isEarlyReview) {
        this.submitReview(statue)
        return
      }
      const isMonthOnly = /^\d{4}-\d{2}$/.test(checkTime)
      const nowYear = nowMonth.slice(0, 4)
      const todayStr = `${nowMonth}-${String(now.getDate()).padStart(2, '0')}`
      const plannedText = isMonthOnly
        ? (this.planDueDate ? `${this.planDueDate}(计划月份 ${checkTime})` : `${checkTime}(系统计划只登记到月份)`)
        : checkTime
      const head = `<div class="er-head">该条记录的计划核查时间为 <b>${plannedText}</b>,当前审核日期是 <b>${todayStr}</b>,属于<b>提前审核</b>。</div>`
      const items = isMonthOnly
        ? [
          `本轮记录按实际审核月份归档:核查时间登记为 <b>${nowMonth}</b>(实际审核日期 ${todayStr}),并归入 <b>${nowYear} 年设备核查计划</b>(切到 ${nowYear} 年可看到,状态显示“通过”)。`,
          `系统会按设备的核查周期自动生成下一轮待核查任务(在下次核查日期所属年份的计划中),初始状态“未开始”——这是正常现象,不是审核没生效。`,
          `设备档案的最近核查日期更新为 <b>${todayStr}</b>,下次核查日期按核查周期自动计算。`
        ]
        : [
          `该记录保留原核查日期 <b>${checkTime}</b>,审核状态显示“通过”。`,
          `系统会按设备的核查周期自动生成下一轮待核查任务(在下次核查日期所属年份的计划中),初始状态“未开始”,这是正常现象。`,
          `设备档案的最近核查日期更新为 <b>${todayStr}</b>,下次核查日期按核查周期自动计算。`
        ]
      const content = `${head}<div class="er-title">通过后系统会做三件事:</div>` +
        `<ol class="er-list">${items.map(item => `<li>${item}</li>`).join('')}</ol>` +
        `<div class="er-question">是否确认通过?</div>`
      this.$confirm(content, '提前审核提醒', {
        confirmButtonText: '确认通过',
        cancelButtonText: '取消',
        type: 'warning',
        dangerouslyUseHTMLString: true,
        customClass: 'early-review-message',
      }).then(() => {
        this.submitReview(statue, isMonthOnly)
      }).catch(() => {})
    },
    // 真正提交审核
    submitReview(statue, isMonthOnly = false) {
      this.submitFormLoading = true
      const params = {
        planDetailsId: this.form.planDetailsId,
@@ -335,7 +388,12 @@
      }
      reviewExamineRecord(params).then(res => {
        if (res.code == 200) {
          if (statue === 1 && isMonthOnly) {
            const now = new Date()
            this.$message.success(`审核通过,本轮已归入 ${now.getFullYear()} 年设备核查计划`)
          } else {
          this.$message.success(statue === 1 ? '审核通过' : '已退回')
          }
          this.resetForm()
        }
        this.submitFormLoading = false
@@ -447,3 +505,51 @@
  margin-bottom: 12px;
}
</style>
<style>
.early-review-message {
  width: 560px !important;
  max-width: calc(100vw - 40px);
}
.early-review-message .el-message-box__message {
  line-height: 1.8;
}
.early-review-message .er-head {
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.8;
  color: #303133;
  background: #fdf6ec;
  border-left: 4px solid #e6a23c;
  border-radius: 4px;
}
.early-review-message .er-title {
  margin-bottom: 8px;
  font-weight: 600;
  color: #303133;
}
.early-review-message .er-list {
  margin: 0 0 0 4px;
  padding-left: 20px;
  list-style: decimal;
}
.early-review-message .er-list li {
  margin-bottom: 10px;
  line-height: 1.8;
  color: #303133;
}
.early-review-message .er-list li:last-child {
  margin-bottom: 0;
}
.early-review-message .er-question {
  margin-top: 16px;
  color: #606266;
}
</style>
src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -90,7 +90,7 @@
              @click="handleRecord(scope.row)">审核</el-button>
            <el-button v-if="scope.row.recordStatus === 2 || scope.row.recordStatus === 3"
              size="small" link type="primary" @click="handleDown(scope.row)">导出</el-button>
            <el-button v-if="scope.row.recordStatus === 0 && scope.row.recordContrastStatus === 0"
            <el-button v-if="scope.row.recordStatus === 0 || scope.row.recordStatus === 1"
              size="small" link type="danger" @click="deleteFun1(scope.row.planDetailsId)">删除</el-button>
          </template>
        </el-table-column>
@@ -114,10 +114,14 @@
            </el-col>
            <el-col :span="12">
              <el-form-item label="检查日期:" prop="checkTime">
                <el-date-picker v-model="form.checkTime" :disabled="operationType === 'view'" clearable
                  format="YYYY-MM" placeholder="选择检查日期" size="small" style="width:100%" type="month"
                  value-format="YYYY-MM">
                <el-input v-if="operationType === 'view'" :model-value="formatCheckMonth(null, null, form.checkTime)"
                  disabled size="small"></el-input>
                <template v-else>
                  <el-date-picker v-model="checkTimeEditValue" clearable format="YYYY-MM-DD" placeholder="选择检查日期"
                    size="small" style="width:100%" type="date" value-format="YYYY-MM-DD">
                </el-date-picker>
                  <div v-if="isMonthOnlyCheckTime" class="check-time-tip">系统登记只到月份,选择具体日期后将按日保存</div>
                </template>
              </el-form-item>
            </el-col>
            <el-col :span="8">
@@ -500,7 +504,7 @@
    },
    // 明细-删除
    deleteFun1(id) {
      this.$confirm('删除后,若该设备还有审核通过的核查记录,档案的最近核查日期将回退到最近一次完成记录;若没有,则清空档案的核查日期和核查周期。是否继续?', '提示', {
      this.$confirm('删除后,该行未审核的核查记录及附件会一并删除;若该设备还有审核通过的核查记录,档案的最近核查日期将回退到最近一次完成记录;若没有,则清空档案的核查日期和核查周期。是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
@@ -650,6 +654,19 @@
      }
      return list
    },
    // 日期控件只接受 YYYY-MM-DD;系统登记的待核查行只有年月,未改日期时不能把“日”写进表单
    checkTimeEditValue: {
      get() {
        const val = this.form.checkTime || ''
        return /^\d{4}-\d{2}$/.test(val) ? `${val}-01` : val
      },
      set(val) {
        this.form.checkTime = val || ''
      }
    },
    isMonthOnlyCheckTime() {
      return /^\d{4}-\d{2}$/.test(this.form.checkTime || '')
    },
  },
}
</script>
@@ -737,6 +754,14 @@
  margin-bottom: 12px;
}
.check-time-tip {
  width: 100%;
  font-size: 12px;
  line-height: 1.4;
  color: #909399;
  margin-top: 2px;
}
.export-panel {
  border: 1px solid #e4e7ed;
  border-radius: 6px;