Prechádzať zdrojové kódy

林业云图首页左侧

彭宇 2 rokov pred
rodič
commit
47cb59c0cf
2 zmenil súbory, kde vykonal 28 pridanie a 14 odobranie
  1. 5 4
      src/views/date.vue
  2. 23 10
      src/views/forest.vue

+ 5 - 4
src/views/date.vue

@@ -279,7 +279,7 @@
 				let checkD = y + "-" + m + "-" + d;
 				let today = this.getToday().date;
 				if (checkD == today) {
-					return true;
+          return true;
 				} else {
 					return false;
 				}
@@ -347,6 +347,7 @@
 				}
 				this.$emit("setDate", response);
 				//   console.log(response);
+        this.$emit("selectDay", date);
 			},
 			//改变年月
 			changYearMonth(y, m) {
@@ -386,11 +387,11 @@
 	.d-state-zc {
 		background-color: $date-state1;
 	}
-	
+
 	.d-state-t10 {
 		background-color: $date-state2;
 	}
-	
+
 	.d-state-b10 {
 		background-color: $date-state3;
 	}
@@ -485,7 +486,7 @@
 							border-radius: 5px;
 						}
 
-						
+
 
 
 						&.choose {

+ 23 - 10
src/views/forest.vue

@@ -227,7 +227,7 @@
 						<dv-border-box-13  backgroundColor="#040b1f" style="padding-bottom: 1rem;">
 							<img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
 							<div class="i-list-con small-bottom-margin h-30">
-								<dateChoose></dateChoose>
+								<dateChoose @selectDay="selectDay"></dateChoose>
 							</div>
 						</dv-border-box-13>
 					</div>
@@ -626,10 +626,10 @@
 		},
 		mounted() {
 			this.getBaseInfo()
-			this.getTodayEvents("2022-08-29")
-			this.getDeptEventCount("2022-08-29")
+			this.getTodayEvents(this.getCurrentDataStr())
+			this.getDeptEventCount(this.getCurrentDataStr())
 			/** ----------------------------------weosocket开始------------------------------------- */
-			this.initWebSocket()
+			// this.initWebSocket()
 			/** ----------------------------------weosocket结束------------------------------------- */
 		},
 		data() {
@@ -838,6 +838,19 @@
 		},
 		/** ----------------------------------weosocket结束------------------------------------- */
 		methods: {
+      getCurrentDataStr() {
+        let date = new Date();
+        let y = date.getFullYear();
+        let m = date.getMonth() + 1;
+        m = m < 10 ? '0' + m : m;
+        let d = date.getDate();
+        d = d < 10 ? '0' + d : d;
+        return y + '-' + m + '-' + d;
+      },
+      selectDay(day){//日历点击
+        this.getTodayEvents(day)
+        this.getDeptEventCount(day)
+      },
 			/** ----------------------------------weosocket开始------------------------------------- */
 			initWebSocket() { //初始化weosocket
 				const wsuri = 'wss://www.hmzzxc.com:10012/websocket/forest-' + Cookies.get('username')
@@ -923,7 +936,7 @@
 
 
 			//事件数量统计chart 样例地址http://192.144.199.210:8080/editor/index.html?chart_id=jTXf0Rv4A3oiBONB
-			eventChartAi(data) {
+			eventChartAi(aiTotal_pre,otherTotal_pre) {
 				// 基于准备好的dom,初始化echarts实例
 				let myChart = echarts.init(document.getElementById('chart-event-ai'))
 				myChart.setOption({
@@ -996,7 +1009,7 @@
 							}
 						},
 						data: [{
-							value: data,
+							value: aiTotal_pre,
 							symbolPosition: 'end'
 						}]
 					}, {
@@ -1010,7 +1023,7 @@
 								color: '#196d59'
 							}
 						},
-						data: [100 - data]
+						data: [otherTotal_pre]
 					}, {
 						name: 'AI',
 						//底部立体柱
@@ -1052,7 +1065,7 @@
 						silent: true,
 						barWidth: 20,
 						barGap: '-100%', // Make series be overlap
-						data: [data]
+						data: [aiTotal_pre]
 					}, {
 						name: '其他',
 						//上部立体柱
@@ -1067,7 +1080,7 @@
 						silent: true,
 						barWidth: 20,
 						barGap: '-100%', // Make series be overlap
-						data: [100 - data],
+						data: [otherTotal_pre],
 						// itemStyle: {
 						//     normal: {
 						//         color: 'rgba(29,67,243,1)',
@@ -1495,7 +1508,7 @@
           this.readySure_pre=res.data.readySure_pre;
           this.totalStr=res.data.totalStr;
           this.total=res.data.total;
-          this.eventChartAi(this.aiTotal_pre);
+          this.eventChartAi(this.aiTotal_pre,this.otherTotal_pre);
 					that.markersList = []
 					if (res.data.eventListAll != null && res.data.eventListAll.length > 0) {
 						for (let i = 0; i < res.data.eventListAll.length; i++) {