sd
2025-08-05 72b025d6b43271ae88541ea23c92070b3b2acc96
src/pages/cameraAccess/components/SceneRule.vue
@@ -12,9 +12,9 @@
          <el-form-item label="图标">
            <!-- 图片预览 -->
            <div class="icon-preview-container">
              <el-image v-if="sceneForm.iconUrl" :src="sceneForm.iconUrl" fit="cover" />
              <el-image :src="sceneForm.iconUrl?sceneForm.iconUrl + '?t=' + timestamp:'/opt/smart/icon/task_icon.png'" fit="cover" />
              <!-- <el-image v-else src="@/assets/img/容器@1x.png" fit="cover" /> -->
              <img style="width: 60px;" v-else src="@/assets/img/容器@1x.png" />
              <!-- <img style="width: 60px;" v-else src="@/assets/img/容器@1x.png" /> -->
            </div>
          </el-form-item>
          <el-form-item label="事件等级">
@@ -58,8 +58,7 @@
                :value="item.ruleId"></el-option>
            </el-select> -->
            <ruleSelect :initial-rules="VideoManageData.ruleOptions" :selected-rule="currentRule"
             @rule-selected="handleRuleSelect"
              @rule-created="handleRuleCreate" />
              @rule-selected="handleRuleSelect" @rule-created="handleRuleCreate" />
          </el-form-item>
          <!-- 知识库 -->
          <el-form-item label="关联知识库" size="mini">
@@ -249,6 +248,9 @@
      this.editScene = false;
    },
  },
  created() {
    this.userInfo = sessionStorage.getItem("userInfo") && JSON.parse(sessionStorage.getItem("userInfo"))
  },
  mounted() {
    // window.addEventListener('resize', this.windowSizeChange)
    this.getSounds();
@@ -258,7 +260,9 @@
  },
  data() {
    return {
      currentRule:null,// 初始无选中规则
      timestamp: Date.now(),  // 时间戳用于强制刷新图片
      userInfo: {},
      currentRule: null,// 初始无选中规则
      knowledgeProps: {
        multiple: true, // 支持多选
        value: 'id',    // 指定选项值字段
@@ -290,6 +294,10 @@
      // console.log('选中规则:', rule);
      this.sceneForm.warningRules = [rule.ruleId]
      this.sceneForm.ruleName = null
      this.sceneForm.iconUrl = rule.iconUrl
      // 更新时间戳强制刷新图片
      this.timestamp = Date.now();
      console.info(this.sceneForm.iconUrl)
      // 执行预警判断逻辑
    },
    handleRuleCreate(newRule) {
@@ -380,6 +388,7 @@
        time_rule_id: "",
        voice: {},
        voiceId: "",
        iconUrl:""
      };
      // this.$refs.sceneEditor.cleanRule();
      // this.$refs.sceneEditor.getSdkConnection();
@@ -544,9 +553,9 @@
      // this.sceneForm.workTimes = workTimes
      this.sceneForm.taskDescription = this.sceneForm.desc
      this.sceneForm.knows = fileIds,
        this.sceneForm.createUser = this.userInfo.id
      // console.info(this.sceneForm)
        this.onSaveScene(this.sceneForm);
      this.onSaveScene(this.sceneForm);
    },
    handleDelScene(groupRule) {