From edba26ba8377814d94b65b4a1a1fe04f0365afc9 Mon Sep 17 00:00:00 2001
From: whyczyk <525500596@qq.com>
Date: 星期一, 18 十月 2021 14:59:41 +0800
Subject: [PATCH] 模块添加双击放大功能

---
 src/components/charts/MonCap.vue |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/src/components/charts/MonCap.vue b/src/components/charts/MonCap.vue
index 2824b65..b6e7f80 100644
--- a/src/components/charts/MonCap.vue
+++ b/src/components/charts/MonCap.vue
@@ -1,5 +1,5 @@
 <template>
-	<div class="flex-box" @click="toParentPage">
+	<div class="flex-box" @click="toParentPage" @dblclick="dblclick">
 		<div class="flex-box-body">
 			<circle-chart id="circleChart" ref="circleChart"></circle-chart>
 		</div>
@@ -57,6 +57,41 @@
 		}
 	},
 	methods: {
+		findParents(node, select) {
+			var parent = node.parentNode;
+			if (parent === null || parent.className.indexOf(select) != -1) {
+				return parent;
+			} else {
+				return this.findParents(parent, select);
+			}
+		},
+		dblclick(e) {
+			this.isAllScreen = !this.isAllScreen
+			let parents = this.findParents(e.currentTarget, 'vdr')
+			if (this.isAllScreen) {
+				this.parentsStyle = JSON.parse(JSON.stringify(parents.style));
+				parents.style.transform = 'none';
+				parents.style.width = '100%';
+				parents.style.height = '100%';
+				parents.style.position = 'fixed';
+				parents.style.left = 0;
+				parents.style.right = 0;
+				parents.style.bottom = 0;
+				parents.style.top = 0;
+				parents.style.zIndex = 99999;
+			} else {
+				parents.style.transform = this.parentsStyle.transform;
+				parents.style.width = this.parentsStyle.width;
+				parents.style.height = this.parentsStyle.height;
+				parents.style.position = this.parentsStyle.position;
+				parents.style.left = 'initial';
+				parents.style.right = 'initial';
+				parents.style.bottom = 'initial';
+				parents.style.top = 'initial';
+				parents.style.zIndex = 'auto';
+			}
+			this.$refs.circleChart.resize();
+		},
 		toParentPage() {
 			window.parent.parent.postMessage({
 				cmd: "syncPage",

--
Gitblit v1.9.1