| | |
| | | </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> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | |
| | | |
| | | </div> |
| | | <div class="right"> |
| | | <el-form-item label="任务描述"> |
| | |
| | | <template slot-scope="scope"> |
| | | <span v-html="scope.row.group_text"></span> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table-column>workTimeId --> |
| | | <el-table-column label="时间段" prop="time_name" align="center"> |
| | | <template slot-scope="scope"> |
| | | {{(scope.row.workingTime || []).map(r => r.labelName).join(' / ') || ''}} |
| | | <!-- {{(scope.row.workingTime || []).map(r => r.labelName).join(' / ') || ''}} --> |
| | | <span v-for="(tag, idx) in VideoManageData.TimeRules.filter(t => t.id === scope.row.workTimeId)" |
| | | :key="idx"> |
| | | {{ tag.name }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="检测内容" prop="checkContent" align="center"> |
| | |
| | | import RuleEditor from "@/components/subComponents/RuleEditor"; |
| | | import SceneEditor from "./scene/Editor"; |
| | | import { getSoundList } from "@/api/event"; |
| | | import { forEach } from "jszip"; |
| | | |
| | | export default { |
| | | name: "SceneRuleEditor", |
| | |
| | | message: "事件等级不能为空", |
| | | }); |
| | | return false; |
| | | } else if (!this.sceneForm.workingTimes) { |
| | | } else if (!this.sceneForm.workTimeId) { |
| | | this.$notify({ |
| | | type: "warning", |
| | | message: "时间段不能为空", |
| | |
| | | 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() { |
| | |
| | | // this.sceneForm.rules = editorResp.rules; |
| | | // this.sceneForm.id = editorResp.id; |
| | | // this.sceneForm.group_text = editorResp.text; |
| | | const workTimes = [this.sceneForm.workingTimes].map(id => { |
| | | const timeOption = this.VideoManageData.TimeRules.find(opt => opt.id === id) |
| | | return { |
| | | labelId: id, |
| | | labelName: timeOption ? timeOption.name : '' |
| | | } |
| | | }) |
| | | const fileIds = this.sceneForm.knowsList.map( |
| | | path => { |
| | | // 提取最后一级的文件ID并转换为数字 |
| | | const id = path[path.length - 1]; |
| | | return Number(id); // 或者使用 parseInt(id) 或 +id |
| | | } |
| | | ) |
| | | // const workTimes = [this.sceneForm.workingTimes].map(id => { |
| | | // const timeOption = this.VideoManageData.TimeRules.find(opt => opt.id === id) |
| | | // return { |
| | | // labelId: id, |
| | | // labelName: timeOption ? timeOption.name : '' |
| | | // } |
| | | // }) |
| | | 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.workTimes = workTimes |
| | | this.sceneForm.taskDescription = this.sceneForm.desc |
| | | this.sceneForm.knows = fileIds, |
| | | this.onSaveScene(this.sceneForm); |