From d50b0eafa1fcee6e547255cff5b85fe61730860f Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期日, 09 十月 2022 17:46:03 +0800
Subject: [PATCH] 添加摄像机导出功能

---
 src/components/CameraLeft.vue |   76 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 insertions(+), 9 deletions(-)

diff --git a/src/components/CameraLeft.vue b/src/components/CameraLeft.vue
index 422c23e..120f8f0 100644
--- a/src/components/CameraLeft.vue
+++ b/src/components/CameraLeft.vue
@@ -74,6 +74,28 @@
                   </el-tooltip>
                 </div>
 
+                <!-- 瀵煎嚭璁惧 -->
+                <div class="tree-edit export-btn" v-show="!TreeDataPool.readonly">
+                  <el-tooltip content="瀵煎嚭璁惧" placement="bottom" popper-class="atooltip">
+                    <download-excel
+                      class="export-excel-wrapper"
+                      :data="TreeDataPool.childNodes"
+                      :fields="json_fields"
+                      :name="'鎽勫儚鏈哄垪琛�.xlsx'"
+                    >
+                      <!-- 涓婇潰鍙互鑷畾涔夎嚜宸辩殑鏍峰紡锛岃繕鍙互寮曠敤鍏朵粬缁勪欢button -->
+                      <!-- <el-button type="primary" size="small">瀵煎嚭EXCEL</el-button> -->
+                      <!-- <div class="btnArea">
+                      <div class="button light">
+                        <span class="iconfont">&#xe643;</span>
+                        瀵煎嚭鏁版嵁
+                      </div>
+                    </div> -->
+                      <span class="iconfont" style="font-size: 16px">&#xe643;</span>
+                    </download-excel>
+                  </el-tooltip>
+                </div>
+
                 <!-- 鏍戞搷浣滈攣 -->
                 <div class="tree-edit tree-lock" v-show="showLock">
                   <button @click="lockSwitch">
@@ -401,7 +423,32 @@
       importAreaId: "",
       menuLoading: false,
       clusterName: "",
-      cluster: ""
+      cluster: "",
+      json_fields: {
+        閮ㄩ棬: {
+          field: "id",
+          //鑷畾涔夊洖璋冨嚱鏁�
+          callback: (value) => {
+            let org = ""
+            if (this.TreeDataPool.cameraParents.hasOwnProperty(value)) {
+              org = this.TreeDataPool.cameraParents[value]
+            }
+            return org
+          }
+        },
+        // 鍛婅鏍囪: "",
+        // 鏁存敼鎻忚堪: "",
+        鎽勫儚鏈洪�氶亾鍙�: "rtsp",
+        鎽勫儚鏈篒D: "id",
+        鎽勫儚鏈哄悕绉�: "name",
+        寮�鍚垎鏋�: {
+          field: "isAI",
+          //鑷畾涔夊洖璋冨嚱鏁�
+          callback: (value) => {
+            return value ? "鏄�" : "鍚�"
+          }
+        }
+      }
     }
   },
   created() {
@@ -571,6 +618,9 @@
       this.TreeDataPool.localCurrentPage = current
     },
 
+    exportCameras() {
+      console.log(this.TreeDataPool.treeData)
+    },
     importCameras(area) {
       this.importAreaId = area
       this.$refs["import-btn"].click()
@@ -918,12 +968,6 @@
     color: #000;
   }
 }
-.area-add {
-  right: 62px;
-}
-.camera-add {
-  right: 36px;
-}
 
 .closeIcon,
 .openIcon {
@@ -939,9 +983,23 @@
   margin-right: 6px;
 }
 
-.import-btn {
-  right: 10px;
+.area-add {
+  right: 85px;
 }
+
+.camera-add {
+  right: 60px;
+}
+
+.import-btn {
+  right: 35px;
+}
+
+.export-btn {
+  right: 10px;
+  transform: rotate(90deg);
+}
+
 .tree-font {
   font-family: PingFangSC-Medium;
   font-size: 14px;

--
Gitblit v1.8.0