From e9dfe9273d9e5bc120fa2d47699a43c0b8b11584 Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期三, 07 五月 2025 18:59:34 +0800 Subject: [PATCH] 提交 --- admin/src/views/business/carStatistics.vue | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 15 deletions(-) diff --git a/admin/src/views/business/carStatistics.vue b/admin/src/views/business/carStatistics.vue index 6ada707..473fc94 100644 --- a/admin/src/views/business/carStatistics.vue +++ b/admin/src/views/business/carStatistics.vue @@ -34,8 +34,8 @@ <div class="main_content"> <div class="type_wrap"> <div class="title">鍏ㄥ勾鍏ュ洯杞﹁締瓒嬪娍</div> - <div id="echart1" ref="typeRef" v-if="info.cumulativeDataList"></div> - <div style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;" v-else> + <div id="echart1" ref="typeRef" v-show="info.cumulativeDataList"></div> + <div style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;" v-show="!info.cumulativeDataList"> <img style="width: 200px;" src="@/assets/images/default_homeimg.png" alt=""> </div> </div> @@ -56,8 +56,8 @@ placeholder="璇烽�夋嫨"> </el-date-picker> </div> - <div class="echart_2" ref="deptRef" v-if="listZB.length > 0"></div> - <div style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;" v-else> + <div id="echart_2" v-show="listZB.length > 0"></div> + <div style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;" v-show="listZB.length === 0"> <img style="width: 200px;" src="@/assets/images/default_homeimg.png" alt=""> </div> </div> @@ -137,9 +137,9 @@ this.value = `${year}-${month}` this.date1 = `${year}-${month}` - this.getData() - this.getRataLists() - this.getReportLists() + this.getData() + this.getRataLists() + this.getReportLists() }, methods: { // 瀵煎嚭 @@ -192,18 +192,24 @@ getRataList({ dateStr: this.value, isGroupBy: this.isGroupBy, type: 0 }) .then(res => { this.listZB = res - this.$nextTick(() => { + // this.$nextTick(() => { + // this.initDept() + // }) + setTimeout(() => { this.initDept() - }) + },1000) }) }, // 鍩虹鏁版嵁 getData() { getInParkUserData({ isGroupBy: this.isGroupBy, type: 0 }).then(res => { this.info = res - this.$nextTick(() => { + // this.$nextTick(() => { + // this.initType() + // }) + setTimeout(() => { this.initType() - }) + }, 1000) }) }, // 鍏ㄥ勾鍏ュ洯杞﹁締瓒嬪娍 @@ -224,6 +230,20 @@ orient: 'vertical', left: 'left' }, + graphic: { + elements: [ + { + type: 'text', + left: 'left', + top: 'top', + style: { + text: '杞﹁締鏁�', + textAlign: 'center', + fill: '#333' + } + } + ] + }, grid: { left: '0%', right: '5%', @@ -236,11 +256,15 @@ data: names }, yAxis: { - type: 'value' + type: 'value', + axisLine: { + show: true + } }, series: [ { data: datas, + name: '鍏ュ洯杞﹁締', type: 'line', areaStyle: { normal: { @@ -295,7 +319,9 @@ initDept() { if (this.listZB.length === 0) return - const myChart = echarts.init(document.querySelector('.echart_2')) + const dom = document.getElementById('echart_2') + console.log(dom) + const myChart = echarts.init(dom) let data = this.listZB.map(item => { return { @@ -586,7 +612,7 @@ display: flex; align-items: center; justify-content: space-between; - height: 400px; + height: 350px; .title { font-weight: 500; @@ -606,6 +632,7 @@ #echart1 { width: 100%; height: 100%; + margin-top: 18px; } } @@ -617,7 +644,7 @@ padding: 20px; box-sizing: border-box; margin-left: 10px; - .echart_2 { + #echart_2 { width: 100%; height: 100%; } -- Gitblit v1.9.3