From 301532b5c1cad2c1d45080bfef86579b20486bf5 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 25 十二月 2024 10:33:23 +0800
Subject: [PATCH] 首页调整、考核结果页面调整

---
 src/api/platform/check-score.js                |    8 ++
 src/views/home/examine/index.vue               |    4 
 src/views/home/data-chart/index.vue            |    8 +-
 src/components/RightToolbar/index.vue          |   14 +++-
 src/views/system/check/result/index.vue        |   95 ++++++++++++++++++++++---------
 src/views/system/check/result/detail/index.vue |   13 ++-
 src/views/home/work-order/index.vue            |   16 ++++-
 7 files changed, 110 insertions(+), 48 deletions(-)

diff --git a/src/api/platform/check-score.js b/src/api/platform/check-score.js
index 8b4d400..77deeb0 100644
--- a/src/api/platform/check-score.js
+++ b/src/api/platform/check-score.js
@@ -8,6 +8,14 @@
     data: data
   })
 }
+// 鏌ヨ鑰冩牳绉垎鍗$墖鍒楄〃
+export function barScore(data) {
+  return request({
+    url: '/check/score/bar',
+    method: 'post',
+    data: data
+  })
+}
 // 鏌ヨ鑰冩牳绉垎鎶樼嚎鍥�
 export function chartScore(query) {
   return request({
diff --git a/src/components/RightToolbar/index.vue b/src/components/RightToolbar/index.vue
index a56bab7..02213b4 100644
--- a/src/components/RightToolbar/index.vue
+++ b/src/components/RightToolbar/index.vue
@@ -156,11 +156,15 @@
       })
     },
     delColumn(id, index) {
-      deleteDynamicColumnById(id).then(res => {
-        this.$message.success("鍒犻櫎鎴愬姛")
-        this.getDyColumn();
-        this.$emit('refreshHeader');
-      })
+      if(id) {
+        deleteDynamicColumnById(id).then(res => {
+          this.$message.success("鍒犻櫎鎴愬姛")
+          this.getDyColumn();
+          this.$emit('refreshHeader');
+        })
+      }else {
+        this.dynamicColumnList.splice(index,1)
+      }
     },
     dynamicColumnClose() {
       this.showDynamicColumn = false
diff --git a/src/views/home/data-chart/index.vue b/src/views/home/data-chart/index.vue
index 7dc8aec..48f1994 100644
--- a/src/views/home/data-chart/index.vue
+++ b/src/views/home/data-chart/index.vue
@@ -43,6 +43,8 @@
   },
   methods: {
     initChart() {
+      const sortedKeys  = Object.keys(this.acitveData.state)
+        .sort(); // 鎸夌収瀛楃涓茬殑瀛楀吀搴忓閿繘琛屾帓搴�
       const option = {
         legend: {
           right: 'right',
@@ -74,13 +76,13 @@
         tooltip: {},
         xAxis: {
           type: 'category',
-          data: Object.keys(this.acitveData.state),
+          data: sortedKeys,
         },
         yAxis: {},
         series: [
           {
             name: '姝e父鏁�',
-            data: Object.entries(this.acitveData.state).map(([key, value]) => value),
+            data: sortedKeys.map(key => this.acitveData.state[key]),
             type: 'line',
             itemStyle: {
               color: 'rgba(62, 144, 247, 1)'
@@ -88,7 +90,7 @@
           },
           {
             name: '寮傚父鏁�',
-            data: Object.entries(this.acitveData.state2).map(([key, value]) => value),
+            data: sortedKeys.map(key => this.acitveData.state2[key]),
             type: 'line',
             itemStyle: {
               color: 'rgba(85, 192, 191, 1)'
diff --git a/src/views/home/examine/index.vue b/src/views/home/examine/index.vue
index 14fed79..cf73564 100644
--- a/src/views/home/examine/index.vue
+++ b/src/views/home/examine/index.vue
@@ -5,13 +5,13 @@
       <div class="card-content">
         <div class="title-container">
           <h1>鑰冩牳棰勮</h1>
-          <div class="more-button" @click="$router.push({ path: '/contract/score' })">
+          <div class="more-button" @click="$router.push({ path: '/check/result' })">
             <span>鏇村</span>
             <i class="el-icon-arrow-right"></i>
           </div>
         </div>
 
-        <el-table :data="tableData" height="400">
+        <el-table :data="tableData" height="400" empty-text="鏈�杩戜竴鍛ㄦ殏鏃犳暟鎹�">
           <el-table-column prop="createTime" label="璀︽姤鏃堕棿" align="center">
           </el-table-column>
           <el-table-column prop="area" label="鍖哄煙" align="center">
diff --git a/src/views/home/work-order/index.vue b/src/views/home/work-order/index.vue
index dd29ecf..6fb264f 100644
--- a/src/views/home/work-order/index.vue
+++ b/src/views/home/work-order/index.vue
@@ -49,6 +49,9 @@
   },
   methods: {
     initChart() {
+      // 瀵� complete 瀵硅薄鐨勯敭杩涜鎺掑簭
+      const sortedKeys  = Object.keys(this.acitveData.complete)
+          .sort(); // 鎸夌収瀛楃涓茬殑瀛楀吀搴忓閿繘琛屾帓搴�
       const option = {
         legend: {
           right: 'right',
@@ -86,13 +89,17 @@
         tooltip: {},
         xAxis: {
           type: 'category',
-          data: Object.keys(this.acitveData.complete),
+          data: sortedKeys,
+          axisLabel: {
+            interval: 0  // 寮哄埗鏄剧ず鎵�鏈夋爣绛�
+          },
+          sortSeriesData: false
         },
         yAxis: {},
         series: [
           {
             name: '瀹屾垚宸ュ崟鏁�',
-            data: Object.entries(this.acitveData.complete).map(([key, value]) => value),
+            data: sortedKeys.map(key => this.acitveData.complete[key]),
             type: 'line',
             itemStyle: {
               color: 'rgba(62, 144, 247, 1)'
@@ -100,7 +107,7 @@
           },
           {
             name: '寰呭畬鎴愬伐鍗曟暟',
-            data: Object.entries(this.acitveData.waiting).map(([key, value]) => value),
+            data: sortedKeys.map(key => this.acitveData.waiting[key]),
             type: 'line',
             itemStyle: {
               color: 'rgba(85, 192, 191, 1)'
@@ -108,7 +115,7 @@
           },
           {
             name: '寰呭鎵瑰伐鍗曟暟',
-            data: Object.entries(this.acitveData.pending).map(([key, value]) => value),
+            data: sortedKeys.map(key => this.acitveData.pending[key]),
             type: 'line',
             itemStyle: {
               color: 'rgba(255, 165, 0, 1)'
@@ -131,6 +138,7 @@
             pending: {}
           }
         }
+
         lineChart = echarts.init(this.$refs.chartContent);
         this.initChart();
         this.observe();
diff --git a/src/views/system/check/result/detail/index.vue b/src/views/system/check/result/detail/index.vue
index 0c1dd20..1001197 100644
--- a/src/views/system/check/result/detail/index.vue
+++ b/src/views/system/check/result/detail/index.vue
@@ -344,11 +344,14 @@
     },
 
     getAllDay() {
-      // const date = new Date();
-      // const year = date.getFullYear();
-      // const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
-      // this.date = year + '-' + month;
-      const currentDate = this.date.split('-');
+      let date = this.date
+      if(!this.date) {
+        date = new Date();
+        const year = date.getFullYear();
+        const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
+        date = year + '-' + month;
+      }
+      const currentDate = date.split('-');
       const currentYear = currentDate[0];
       const currentMonth = currentDate[1];
       const daysInMonth = new Date(currentYear, currentMonth, 0).getDate();
diff --git a/src/views/system/check/result/index.vue b/src/views/system/check/result/index.vue
index 4551ab5..4124b07 100644
--- a/src/views/system/check/result/index.vue
+++ b/src/views/system/check/result/index.vue
@@ -4,12 +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="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-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>
       <!-- 瀵煎嚭鎸夐挳 -->
@@ -72,6 +69,19 @@
         <div class="card-content">
           <div class="title-container">
             <h1>鑰冩牳鎴愮哗</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>
@@ -121,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;
@@ -137,25 +148,25 @@
         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")])
             }
           }]
       },
@@ -172,7 +183,7 @@
       checkScoreList: [],
       areaList: [],
       activeIndex: '0',
-      date: '',
+      date: [],
       company: '',
       // 瀵煎嚭
       exportForm: {
@@ -187,13 +198,24 @@
         examineTag: null,
         createTime: null
       },
+      // 鏌ヨ鍙傛暟
+      barParams: {
+        examineTag: null,
+        createTime: null
+      },
     }
   },
   created() {
   },
   mounted() {
     this.queryParams.examineTag = this.activeIndex
+    this.barParams.examineTag = this.activeIndex
     chart = echarts.init(this.$refs.barChart);
+    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);
   },
@@ -208,6 +230,7 @@
       })
     },
     initEchart() {
+
       const option = {
         grid: {
           left: 0,
@@ -358,6 +381,7 @@
       areaSelect().then(res => {
         this.areaList = res.data;
         this.getList();
+        this.getChart();
       })
     },
     translateDeptId(deptId) {
@@ -397,30 +421,43 @@
     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;
-
-        this.setChartOption(this.checkScoreList);
+        // this.setChartOption(this.checkScoreList);
         this.loading = false;
       });
     },

--
Gitblit v1.8.0