吴羡
15 小时以前 c6e96cdb8b1cfb51e9a45bf86c38d1353e983127
src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
@@ -162,7 +162,13 @@
      this.selectionRows = selection
    },
    changeMachineName() {
      this.selectionRows.map(val => {
      const existingIds = new Set(this.calibrationPlanDetailList.map(item => item.deviceId))
      let skipped = 0
      this.selectionRows.forEach(val => {
        if (existingIds.has(val.id)) {
          skipped++
          return
        }
        // 将 val.nextCalibrationDate 转换为 Date 对象并减去 5 天
        let nextCalibrationDate = val.nextCalibrationDate ? new Date(val.nextCalibrationDate) : null;
        if (nextCalibrationDate) {
@@ -177,7 +183,11 @@
          verificationUnit: val.calibrationServices,
          deviceAmount: 1
        })
        existingIds.add(val.id)
      })
      if (skipped > 0) {
        this.$message.warning(`已跳过 ${skipped} 台已在计划中的设备`)
      }
      this.addEquipDia = false
      this.rowDrop()
    },
@@ -209,6 +219,18 @@
    },
    // 提交新增
    submitForm() {
      if (!this.form.planName) {
        this.$message.warning('请输入计划名称')
        return
      }
      if (!this.form.planYear) {
        this.$message.warning('请选择年份')
        return
      }
      if (!this.calibrationPlanDetailList.length) {
        this.$message.warning('请添加设备')
        return
      }
      this.form.calibrationPlanDetailList = this.HaveJson(this.calibrationPlanDetailList)
      this.submitFormLoading = true
      if (this.operationType === 'add') {
@@ -225,7 +247,7 @@
      } else {
        updateDeviceCalibrationPlan(this.form).then(res => {
          if (res.code == 200) {
            this.$message.success('新增成功')
            this.$message.success('修改成功')
            this.closeDialog()
            this.$emit('closeDia')
          }