sd
2025-07-28 84f19ab0d37599400959e85e63cfda5df4869bc8
src/pages/cameraAccess/components/SceneRule.vue
@@ -22,7 +22,7 @@
            </el-select>
          </el-form-item>
          <el-form-item label="时间段">
            <el-select v-model="sceneForm.workingTimes" placeholder="请选择" size="mini">
            <el-select v-model="sceneForm.workTimeId" placeholder="请选择" size="mini">
              <el-option v-for="item in VideoManageData.TimeRules" :key="item.id" :label="item.name"
                :value="item.id"></el-option>
            </el-select>
@@ -442,7 +442,7 @@
          message: "事件等级不能为空",
        });
        return false;
      } else if (!this.sceneForm.workingTimes) {
      } else if (!this.sceneForm.workTimeId) {
        this.$notify({
          type: "warning",
          message: "时间段不能为空",
@@ -454,19 +454,20 @@
          message: "检测内容不能为空",
        });
        return false;
      } else if (!this.sceneForm.workingTimes) {
      } else if (!this.sceneForm.warningRules) {
        this.$notify({
          type: "warning",
          message: "预警规则不能为空",
        });
        return false;
      } else if (!this.sceneForm.knowsList) {
        this.$notify({
          type: "warning",
          message: "知识库不能为空",
        });
        return false;
      }
      //  else if (!this.sceneForm.knowsList) {
      //   this.$notify({
      //     type: "warning",
      //     message: "知识库不能为空",
      //   });
      //   return false;
      // }
      return true;
    },
    saveSceneRule() {
@@ -487,19 +488,21 @@
      //     labelName: timeOption ? timeOption.name : ''
      //   }
      // })
      const fileIds = this.sceneForm.knowsList.map(
        path => {
          // 提取最后一级的文件ID并转换为数字
          const id = path[path.length - 1];
          return Number(id); // 或者使用 parseInt(id) 或 +id
        }
      )
      let fileIds = []
      if (this.sceneForm.knowsList) {
        fileIds = this.sceneForm.knowsList.map(
          path => {
            // 提取最后一级的文件ID并转换为数字
            const id = path[path.length - 1];
            return Number(id); // 或者使用 parseInt(id) 或 +id
          }
        )
      }
      this.sceneForm.taskName = this.sceneForm.scene_name
      this.sceneForm.eventLevel = this.sceneForm.alarm_level
      this.sceneForm.checks = this.sceneForm.checkContents
      this.sceneForm.rules = this.sceneForm.warningRules
      // this.sceneForm.workTimes = workTimes
      this.sceneForm.workTimeId = this.sceneForm.workingTimes
      this.sceneForm.taskDescription = this.sceneForm.desc
      this.sceneForm.knows = fileIds,
        this.onSaveScene(this.sceneForm);