| | |
| | | :tableRuleList="tableRuleList" |
| | | :onSaveScene="saveSceneRule" |
| | | @delete-rule="showRules" |
| | | v-loading="loadingRuleList" |
| | | ></scene-rule> |
| | | </div> |
| | | </div> |
| | |
| | | }, |
| | | computed: { |
| | | selectedCameraIds() { |
| | | let ids = []; |
| | | if (this.TreeDataPool.treeActiveName == 'dataStack') { |
| | | if (this.TreeDataPool.checkedLocalVedio.length > 0) { |
| | | ids = this.TreeDataPool.checkedLocalVedio.map(i => { |
| | | return i.id; |
| | | }) |
| | | |
| | | } |
| | | } else { |
| | | if (this.TreeDataPool.selectedNodes.length > 0) { |
| | | ids = this.TreeDataPool.selectedNodes; |
| | | } |
| | | } |
| | | |
| | | return ids; |
| | | return this.TreeDataPool.selectedNodes; |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | | loadingRuleList: false, |
| | | Carmeras: [], |
| | | Camera: new VideoRuleData(), |
| | | tasksTable: {}, |
| | |
| | | prevEl: ".pre-border" |
| | | } |
| | | }, |
| | | showSysInfo: false |
| | | showSysInfo: false, |
| | | requestSeq: "" |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | initCameraData() { |
| | | this.$nextTick(() => { |
| | | this.Carmeras = []; |
| | | this.loading = false; |
| | | this.showSysInfo = true; |
| | | if (this.TreeDataPool.treeActiveName == 'dataStack') { |
| | | this.TreeDataPool.checkedLocalVedio.forEach(camera => { |
| | | this.Carmeras.push(new VideoRuleData(camera.id)); |
| | | |
| | | this.selectedCameraIds.forEach(cid => { |
| | | this.Carmeras.push(new VideoRuleData(cid)); |
| | | }); |
| | | } else { |
| | | this.TreeDataPool.selectedNodes.forEach(camera => { |
| | | this.Carmeras.push(new VideoRuleData(camera)); |
| | | }); |
| | | } |
| | | |
| | | this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id; |
| | | this.showRules(); |
| | | }) |
| | |
| | | //this.Camera.baseImg = url |
| | | }, |
| | | getCanvasData() { }, |
| | | newUid() { |
| | | |
| | | let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; |
| | | let originChar = "0123456789abcdef"; |
| | | let len = originChar.length; |
| | | return originStr.replace(/x/g, function (match) { |
| | | return originChar.charAt(Math.floor(Math.random() * len)); |
| | | }); |
| | | }, |
| | | showRules() { |
| | | this.tableRuleList = []; |
| | | |
| | | if (this.selectedCameraIds.length > 0) { |
| | | this.loadingRuleList = true; |
| | | let seq = this.newUid(); |
| | | this.requestSeq = seq; |
| | | |
| | | getLinkSceneRule({ cameraIds: this.selectedCameraIds }).then( |
| | | rsp => { |
| | | if (rsp && rsp.success) { |
| | | this.loadingRuleList = false; |
| | | if (rsp && rsp.success && seq === this.requestSeq) { |
| | | |
| | | this.tableRuleList = rsp.data; |
| | | |
| | |
| | | } |
| | | // this.TreeDataPool.fetchTreeData(); |
| | | } |
| | | ); |
| | | ).catch(() => { |
| | | this.loadingRuleList = false; |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | |
| | | saveSceneRule(groupRule) { |
| | | const payload = { ...groupRule } |
| | | if (!payload.rules) { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "规则参数有误" |
| | | }); |
| | | |
| | | return |
| | | } |
| | | |
| | | payload.cameraIds = this.selectedCameraIds; |
| | | |
| | | saveLinkScene(payload).then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | //this.Camera.update(); |
| | | this.initCameraData(); |
| | | // this.showRules(); |
| | | this.$notify({ |
| | | type: "success", |
| | | message: "任务保存成功!" |
| | |
| | | }).catch(err => { |
| | | this.$message({ |
| | | type: "error", |
| | | message: "保存失败!" + err.data |
| | | message: "保存失败!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | position: relative; |
| | | .devide{ |
| | | height: 10px; |
| | | background: #E9EBF2; |
| | | background: #e9ebf2; |
| | | } |
| | | .top { |
| | | width: 100%; |
| | |
| | | .add-btn:hover { |
| | | color: #2249b4; |
| | | } |
| | | |
| | | } |
| | | </style> |
| | | <style lang="scss" scoped> |