From ca3145442e5b65e9daefb5e3bce09e220eead265 Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期一, 26 九月 2022 18:47:56 +0800
Subject: [PATCH] 摄像机管理 时间段 过滤

---
 src/api/timeRule.ts                                   |   19 +++++----
 src/views/hashrate/CameraManage/index.vue             |    2 
 src/views/hashrate/CameraManage/CameraRules/index.vue |    8 +++
 src/Pool/VideoManageData.ts                           |   41 ++++++++++----------
 4 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/src/Pool/VideoManageData.ts b/src/Pool/VideoManageData.ts
index fb11ffd..ad533e8 100644
--- a/src/Pool/VideoManageData.ts
+++ b/src/Pool/VideoManageData.ts
@@ -1,6 +1,6 @@
-import { getAllTimeRule, saveTimeRule } from "@/api/timeRule";
-import { findDictionaryByType } from "@/api/dictionary";
-import { findBaseByRuleEditor } from "@/api/es";
+import { getAllTimeRule, saveTimeRule } from "@/api/timeRule"
+import { findDictionaryByType } from "@/api/dictionary"
+import { findBaseByRuleEditor } from "@/api/es"
 
 const AllDayRule = [
   { day: 1, time_range: [{ start: "00:00", end: "24:00" }] },
@@ -12,27 +12,26 @@
   { day: 7, time_range: [{ start: "00:00", end: "24:00" }] }
 ]
 
-
 export default class VideoManageData {
-  public SepTasks: Array<object> = [];
-  public TimeRules: Array<object> = [];
-  public Dictionary: object = {};
-  public TagList: Array<object> = [];
-  public TimeRuleSum: number = 0;
+  public SepTasks: Array<object> = []
+  public TimeRules: Array<object> = []
+  public Dictionary: object = {}
+  public TagList: Array<object> = []
+  public TimeRuleSum: number = 0
 
   public init() {
     // this.getAllSeparateTasks();
-    this.getTimeRule();
-    this.getDictionary();
-  //  this.getTagList();
+    this.getTimeRule()
+    this.getDictionary()
+    //  this.getTagList();
   }
 
   public async getTimeRule() {
-    let rsp: any = await getAllTimeRule();
-    console.log(rsp);
+    let rsp: any = await getAllTimeRule("")
+    console.log(rsp)
 
     if (rsp && rsp.success) {
-      this.TimeRules = rsp.data.timeRules;
+      this.TimeRules = rsp.data.timeRules
       this.TimeRuleSum = this.TimeRules.length
     }
 
@@ -42,26 +41,26 @@
         id: "",
         name: "鍏ㄥぉ",
         time_rule: AllDayRule
-      };
+      }
 
       rsp = await saveTimeRule(newRule)
       if (rsp && rsp.success) {
-        this.getTimeRule();
+        this.getTimeRule()
       }
     }
   }
 
   public async getDictionary() {
-    const rsp: any = await findDictionaryByType();
+    const rsp: any = await findDictionaryByType()
     if (rsp && rsp.success) {
-      this.Dictionary = rsp.data;
+      this.Dictionary = rsp.data
     }
   }
 
   public async getTagList() {
-    const rsp: any = await findBaseByRuleEditor();
+    const rsp: any = await findBaseByRuleEditor()
     if (rsp && rsp.success) {
-      this.TagList = rsp.data;
+      this.TagList = rsp.data
     }
   }
 }
diff --git a/src/api/timeRule.ts b/src/api/timeRule.ts
index 87798f7..5c25b00 100644
--- a/src/api/timeRule.ts
+++ b/src/api/timeRule.ts
@@ -1,24 +1,25 @@
-import request from "@/scripts/httpRequest";
+import request from "@/scripts/httpRequest"
 
-export const getAllTimeRule = () => {
+export const getAllTimeRule = (devId: string) => {
   return request({
     url: "/saas/api-s/cameraTimerule/findAll",
-    method: "get"
-  });
-};
+    method: "get",
+    params: { devId: devId }
+  })
+}
 
 export const deleteTimeRule = (query: any) => {
   return request({
     url: "/saas/api-s/cameraTimerule/delete",
     method: "delete",
     data: query
-  });
-};
+  })
+}
 
 export const saveTimeRule = (params: any) => {
   return request({
     url: "/saas/api-s/cameraTimerule/save",
     method: "post",
     data: params
-  });
-};
+  })
+}
diff --git a/src/views/hashrate/CameraManage/CameraRules/index.vue b/src/views/hashrate/CameraManage/CameraRules/index.vue
index 92e0f3d..d35a536 100644
--- a/src/views/hashrate/CameraManage/CameraRules/index.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/index.vue
@@ -241,6 +241,8 @@
 </template>
 
 <script>
+import { getAllTimeRule } from "@/api/timeRule"
+
 import { jsPlumb } from "jsplumb"
 
 import { savePolygon } from "@/api/polygon"
@@ -529,7 +531,11 @@
     },
 
     // 鍒濆鍖栨憚鍍忔満淇℃伅锛岀埗缁勪欢璋冪敤
-    async initCameraData(id) {
+    async initCameraData(id, devId) {
+      devId ? false : (devId = "")
+      getAllTimeRule(devId).then((rsp) => {
+        this.VideoManageData.TimeRules = rsp.data.timeRules
+      })
       if (!id) {
         return
       }
diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index d5ca7ec..13a95d1 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -67,7 +67,7 @@
           this.$refs.cameraInfo.selectCamera(node)
         }
       } else if (this.activeTab === "鍦烘櫙閰嶇疆") {
-        this.$refs.sepRule.initCameraData(node.id)
+        this.$refs.sepRule.initCameraData(node.id, node.devId)
         if (!this.TreeDataPool.multiple) {
           this.$refs.sepRule.showRules(node.id)
         }

--
Gitblit v1.8.0