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 +++++++++++++++++++++++++++++++++----
src/Pool/TreeData.ts | 6 +++
2 files changed, 73 insertions(+), 9 deletions(-)
diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 7598c5b..954bc5c 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -72,6 +72,8 @@
// 璁板綍鎽勫儚鏈烘墍灞炵殑鐖惰妭鐐瑰悕绉�
public cameraParents: object
+ // 璁板綍鎵�鏈夌殑瀛愯妭鐐�
+ public childNodes: Array<object>
constructor() {
this.openeds = [true, true, false]
@@ -115,6 +117,7 @@
this.clusterId = ""
this.devId = ""
this.cameraParents = {}
+ this.childNodes = []
}
setVideoArr(index: number, value: object, vue: any): void {
@@ -350,6 +353,7 @@
} else {
if (n.type != "MENU") {
this.cameraParents[n.id] = parentName
+ this.childNodes.push(n)
}
}
})
@@ -436,6 +440,8 @@
async fetchTreeData() {
this.cameraParents = {}
+ this.childNodes = []
+
if (this.openeds[0]) {
await this.fetchLocalTree()
}
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"></span>
+ 瀵煎嚭鏁版嵁
+ </div>
+ </div> -->
+ <span class="iconfont" style="font-size: 16px"></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