From ea91e87eae0cc1c07f3ecf7eec66806ce77fc50d Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 17 十月 2025 13:39:05 +0800
Subject: [PATCH] 首页问题
---
src/views/system/check/result/index.vue | 110 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 77 insertions(+), 33 deletions(-)
diff --git a/src/views/system/check/result/index.vue b/src/views/system/check/result/index.vue
index 3428663..47c2c39 100644
--- a/src/views/system/check/result/index.vue
+++ b/src/views/system/check/result/index.vue
@@ -4,10 +4,9 @@
<div style="width: 100%">
<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="3">鍖哄幙瀛e害</el-menu-item>
+ <el-menu-item index="0">鐪佸巺鑰冩牳</el-menu-item>
+ <el-menu-item index="1">鍖哄幙鑰冩牳</el-menu-item>
+ <el-menu-item index="2">鍏畨閮ㄨ�冩牳</el-menu-item>
</el-menu>
</div>
<!-- 瀵煎嚭鎸夐挳 -->
@@ -62,12 +61,27 @@
<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">
<div class="title-container">
- <h1>鑰冩牳鎴愮哗</h1>
+ <h1>鑰冩牳鎴愮哗1</h1>
+ <div class="select-container">
+ <el-date-picker v-model="date"
+ format="yyyy-MM-dd"
+ value-format="yyyy-MM-dd"
+ type="daterange"
+ placeholder="閫夋嫨鏃ユ湡"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ @change="dateChange"
+ @clear="handleClear"
+ :picker-options="pickerOptions">
+ </el-date-picker>
+ </div>
</div>
<div class="echart-container">
<div id="barChart" ref="barChart"></div>
@@ -93,7 +107,7 @@
<div v-if="score.examineCategory == 2">杞﹁締锛�</div>
<div v-else-if="score.examineCategory == 3">浜鸿劯锛�</div>
<div v-else-if="score.examineCategory == 1">瑙嗛锛�</div>
- <div class="score">{{ score.score }}</div>
+ <div class="score">{{ (score.score * 100).toFixed(2) + '%' }}</div>
</div>
</div>
</div>
@@ -117,6 +131,7 @@
import {areaSelect} from '@/api/system/dept';
import {listScore, publishScore} from "@/api/platform/check-score";
import * as echarts from 'echarts';
+import {barScore} from "../../../../api/platform/check-score";
let observer = null;
let chart = null;
@@ -126,31 +141,32 @@
return {
tagOptions: [
{value: 0, label: '鐪佸巺'},
- {value: 1, label: '鍖哄幙'}
+ {value: 1, label: '鍖哄幙'},
+ {value: 2, label: '鍏畨閮�'}
],
pickerOptions: {
shortcuts: [{
text: '绗竴瀛e害',
onClick(picker) {
- picker.$emit('pick', [new Date(new Date().getFullYear() + "-01"), new Date(new Date().getFullYear() + "-03")]);
+ picker.$emit('pick', [new Date(new Date().getFullYear() + "-01"+ "-01"), new Date(new Date().getFullYear() + "-03"+"-31")]);
}
},
{
text: '绗簩瀛e害',
onClick(picker) {
- picker.$emit('pick', [new Date(new Date().getFullYear() + "-04"), new Date(new Date().getFullYear() + "-06")]);
+ picker.$emit('pick', [new Date(new Date().getFullYear() + "-04"+"-01"), new Date(new Date().getFullYear() + "-06"+"-30")]);
}
},
{
text: '绗笁瀛e害',
onClick(picker) {
- picker.$emit('pick', [new Date(new Date().getFullYear() + "-07"), new Date(new Date().getFullYear() + "-09")])
+ picker.$emit('pick', [new Date(new Date().getFullYear() + "-07"+"-01"), new Date(new Date().getFullYear() + "-09"+"-30")])
}
},
{
text: '绗洓瀛e害',
onClick(picker) {
- picker.$emit('pick', [new Date(new Date().getFullYear() + "-10"), new Date(new Date().getFullYear() + "-12")])
+ picker.$emit('pick', [new Date(new Date().getFullYear() + "-10"+"-01"), new Date(new Date().getFullYear() + "-12"+"-31")])
}
}]
},
@@ -167,7 +183,7 @@
checkScoreList: [],
areaList: [],
activeIndex: '0',
- date: '',
+ date: [],
company: '',
// 瀵煎嚭
exportForm: {
@@ -182,16 +198,26 @@
examineTag: null,
createTime: null
},
+ // 鏌ヨ鍙傛暟
+ barParams: {
+ examineTag: null,
+ createTime: null
+ },
}
},
created() {
},
mounted() {
this.queryParams.examineTag = this.activeIndex
- this.getList();
- this.areaSelect();
+ this.barParams.examineTag = this.activeIndex
chart = echarts.init(this.$refs.barChart);
- this.setChartOption(this.checkScoreList);
+ const currentDate = new Date();
+ const year = currentDate.getFullYear();
+ const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕佸姞1锛屽苟涓斾繚璇佷袱浣嶆暟
+ const day = String(currentDate.getDate()).padStart(2, '0'); // 淇濊瘉涓や綅鏁�
+ this.date = [`${year}-${month}-${day}`,`${year}-${month}-${day}`];
+ this.areaSelect()
+ // this.setChartOption(this.checkScoreList);
},
methods: {
jumpDetail(index) {
@@ -353,10 +379,13 @@
areaSelect() {
areaSelect().then(res => {
this.areaList = res.data;
+ this.getList();
+ this.getChart();
})
},
translateDeptId(deptId) {
const department = this.areaList.find(dept => dept.id === deptId);
+ console.log(deptId,this.areaList)
return department ? department.value : '鏈煡';
},
@@ -391,30 +420,45 @@
handleSelect(key) {
this.activeIndex = key; // 鏇存柊褰撳墠婵�娲荤殑鑿滃崟椤�
this.queryParams.examineTag = key;
+ this.barParams.examineTag = key;
this.getList();
+ this.getChart();
},
- /** 鏌ヨ鑰冩牳鎴愮哗鍒楄〃 */
+ dateChange() {
+ this.getChart();
+ },
+ handleClear() {
+ const currentDate = new Date();
+ const year = currentDate.getFullYear();
+ const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕佸姞1锛屽苟涓斾繚璇佷袱浣嶆暟
+ const day = String(currentDate.getDate()).padStart(2, '0'); // 淇濊瘉涓や綅鏁�
+ this.barParams.startDate = `${year}-${month}-${day}`;
+ this.barParams.endDate = `${year}-${month}-${day}`;
+ this.getChart();
+ },
+ /** 鑾峰彇鏌辩姸鍥炬暟鎹� */
+ getChart() {
+ this.loading = true;
+ if(this.date) {
+ this.barParams.startDate = this.date[0]
+ this.barParams.endDate = this.date[1]
+ }
+ barScore(this.barParams).then(response => {
+ this.setChartOption(response.data);
+ this.loading = false;
+ });
+ },
+ /**
+ * 鏌ヨ鑰冩牳鎴愮哗鍒楄〃
+ * 鍗$墖鍒楄〃榛樿鏄剧ず褰撳ぉ
+ * */
getList() {
this.loading = true;
- // 鑾峰彇褰撳墠鏃ユ湡
- const today = new Date();
-
- // 灏嗘棩鏈熷噺鍘讳竴澶�
- const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
-
- // 鑾峰彇骞淬�佹湀銆佹棩
- 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.setChartOption(this.checkScoreList);
this.loading = false;
});
},
--
Gitblit v1.8.0