From 8759438ca3812168f1157d3434931624d14531fd Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 27 九月 2024 17:07:29 +0800
Subject: [PATCH] 图表初始化bug
---
src/views/system/check/result/index.vue | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/src/views/system/check/result/index.vue b/src/views/system/check/result/index.vue
index b43277f..4551ab5 100644
--- a/src/views/system/check/result/index.vue
+++ b/src/views/system/check/result/index.vue
@@ -5,9 +5,11 @@
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect"
style="margin-bottom: 10px">
<el-menu-item index="0">鐪佸巺鏈堝害</el-menu-item>
- <el-menu-item index="2">鐪佸巺瀛e害</el-menu-item>
- <el-menu-item index="1">鍖哄幙鏈堝害</el-menu-item>
+ <el-menu-item index="1">鐪佸巺瀛e害</el-menu-item>
+ <el-menu-item index="2">鍖哄幙鏈堝害</el-menu-item>
<el-menu-item index="3">鍖哄幙瀛e害</el-menu-item>
+ <el-menu-item index="4">鍏畨閮ㄦ湀搴�</el-menu-item>
+ <el-menu-item index="5">鍏畨閮ㄥ搴�</el-menu-item>
</el-menu>
</div>
<!-- 瀵煎嚭鎸夐挳 -->
@@ -62,7 +64,9 @@
<el-button slot="reference" type="primary" size="mini" plain>瀵煎嚭</el-button>
</el-popover>
</div>
+
</div>
+
<div class="data-chart-container">
<el-card class="data-card" :body-style="{ height: '100%' }">
<div class="card-content">
@@ -115,7 +119,7 @@
<script>
import {areaSelect} from '@/api/system/dept';
-import {listScore, getScore, delScore, addScore, updateScore, publishScore} from "@/api/platform/check-score";
+import {listScore, publishScore} from "@/api/platform/check-score";
import * as echarts from 'echarts';
let observer = null;
@@ -126,7 +130,8 @@
return {
tagOptions: [
{value: 0, label: '鐪佸巺'},
- {value: 1, label: '鍖哄幙'}
+ {value: 1, label: '鍖哄幙'},
+ {value: 2, label: '鍏畨閮�'}
],
pickerOptions: {
shortcuts: [{
@@ -188,10 +193,9 @@
},
mounted() {
this.queryParams.examineTag = this.activeIndex
- this.getList();
- this.areaSelect();
chart = echarts.init(this.$refs.barChart);
- this.setChartOption(this.checkScoreList);
+ this.areaSelect()
+ // this.setChartOption(this.checkScoreList);
},
methods: {
jumpDetail(index) {
@@ -353,10 +357,12 @@
areaSelect() {
areaSelect().then(res => {
this.areaList = res.data;
+ this.getList();
})
},
translateDeptId(deptId) {
const department = this.areaList.find(dept => dept.id === deptId);
+ console.log(deptId,this.areaList)
return department ? department.value : '鏈煡';
},
@@ -399,17 +405,21 @@
// 鑾峰彇褰撳墠鏃ユ湡
const today = new Date();
- // 璁$畻鏄ㄥぉ鐨勬棩鏈�
- const yesterday = new Date(today);
- yesterday.setDate(today.getDate() - 1);
+ // 灏嗘棩鏈熷噺鍘讳竴澶�
+ const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
- // 灏嗘槰澶╃殑鏃ユ湡鏍煎紡鍖栦负瀛楃涓诧紝杩欓噷鍋囪鍚庣鏈熸湜鐨勬槸ISO 8601鏍煎紡
- this.queryParams.createTime = yesterday.toISOString().split('T')[0];
+ // 鑾峰彇骞淬�佹湀銆佹棩
+ const year = yesterday.getFullYear();
+ let month = (yesterday.getMonth() + 1).toString().padStart(2, '0'); // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ュ姞1
+ let day = yesterday.getDate().toString().padStart(2, '0');
+
+ // 鎷兼帴鎴� yyyy-MM-dd 鏍煎紡
+ this.queryParams.createTime = `${year}-${month}-${day}`
console.log(this.queryParams);
listScore(this.queryParams).then(response => {
this.checkScoreList = response.data;
- console.log(this.checkScoreList);
+
this.setChartOption(this.checkScoreList);
this.loading = false;
});
--
Gitblit v1.8.0