From 9251f709dc2a0d278ef2c0cdd76a244bfefc5784 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 12 Sep 2024 13:15:53 +0800
Subject: [PATCH] fix: 责任单位修改

---
 src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue |   20 ++--
 src/views/toCarryOutLegislativeReforms/components/queryForm.vue                                  |   18 ++++
 src/views/toCarryOutLegislativeReforms/reform/index.vue                                          |   28 ++++++
 src/views/car/index.vue                                                                          |   69 ++++++++++-------
 src/views/toCarryOutLegislativeReforms/summaryPage/index.vue                                     |   53 ++++++++++++-
 5 files changed, 144 insertions(+), 44 deletions(-)

diff --git a/src/views/car/index.vue b/src/views/car/index.vue
index 5740830..c642ee2 100644
--- a/src/views/car/index.vue
+++ b/src/views/car/index.vue
@@ -202,34 +202,6 @@
           >
             <i class="el-icon-s-fold" />
           </div>
-          <div v-if="rankListShow">
-            <!--                -->
-            <div
-              style="position: relative"
-              class="rankCar"
-            >
-              <div
-                class="success-checkmark"
-                @click="showRankList"
-              />
-              <div>
-                <p>������������</p>
-                <ul>
-                  <li
-                    v-for="(item, index) in rankList"
-                    :key="index"
-                  >
-                    <div class="rankCarItem">
-                      <div> {{ index+1 }}. {{ item.road }}</div>
-                      <div style="margin-left: 10px">
-                        {{ item.avg }}
-                      </div>
-                    </div>
-                  </li>
-                </ul>
-              </div>
-            </div>
-          </div>
         </div>
         <div
           v-if="noneData"
@@ -244,6 +216,40 @@
         <!-- ������������ -->
       </el-container>
     </el-container>
+    <div
+      v-if="rankListShow"
+      style="position: absolute;
+      right: 0;
+      top: 45px;
+      }"
+    >
+      <!--                -->
+      <div
+        style="position: relative"
+        class="rankCar"
+      >
+        <div
+          class="success-checkmark"
+          @click="showRankList"
+        />
+        <div>
+          <p>������������</p>
+          <ul>
+            <li
+              v-for="(item, index) in rankList"
+              :key="index"
+            >
+              <div class="rankCarItem">
+                <div> {{ index+1 }}. {{ item.road }}</div>
+                <div style="margin-left: 10px">
+                  {{ item.avg }}
+                </div>
+              </div>
+            </li>
+          </ul>
+        </div>
+      </div>
+    </div>
     <el-dialog
       title="6���������"
       :visible.sync="dialogFormVisible"
@@ -822,6 +828,7 @@
     deep: true,
     immediate: true
   },
+
   mounted () {
     // this.$watch('carMac', () => {
     if (this.dataType === 'history') {
@@ -1186,8 +1193,12 @@
       }).then(res => {
         if (res.data.length > 0) {
           this.noneDustldData = true
-          this.rankList = res.data
+          this.rankList = [...res.data]
           console.log('������', res)
+        } else {
+          this.rankListShow = false
+          this.noneDustldData = false
+          this.rankList = []
         }
       })
     },
diff --git a/src/views/toCarryOutLegislativeReforms/components/queryForm.vue b/src/views/toCarryOutLegislativeReforms/components/queryForm.vue
index 60c83b3..3b2e88e 100644
--- a/src/views/toCarryOutLegislativeReforms/components/queryForm.vue
+++ b/src/views/toCarryOutLegislativeReforms/components/queryForm.vue
@@ -150,7 +150,8 @@
 <script>
 export default {
   props: {
-    searchType: { type: String, default: '' }
+    searchType: { type: String, default: '' },
+    initializationData: { type: Object, default: () => {} }
   },
   data () {
     return {
@@ -170,6 +171,21 @@
     this.getUnitList()
     this.formData.isInvalid = 0
     this.getContaminateList()
+    if (Object.entries(this.initializationData).length !== 0) {
+      this.formData.startTime = this.initializationData.startTime
+      this.formData.endTime = this.initializationData.endTime
+      // total ������������ unComplete ��������� complete ��������� overdue ������
+      if (this.initializationData.type === 'total') {
+        this.formData.state = []
+      } else if (this.initializationData.type === 'unComplete') {
+        this.formData.state = [9, 20, 30]
+      } else if (this.initializationData.type === 'complete') {
+        this.formData.state = [40]
+      } else if (this.initializationData.type === 'overdue') {
+        this.formData.state = []
+        this.formData.changeType = 2
+      }
+    }
   },
   methods: {
     changeUid (val) {
diff --git a/src/views/toCarryOutLegislativeReforms/reform/index.vue b/src/views/toCarryOutLegislativeReforms/reform/index.vue
index ce8dba5..2c2257c 100644
--- a/src/views/toCarryOutLegislativeReforms/reform/index.vue
+++ b/src/views/toCarryOutLegislativeReforms/reform/index.vue
@@ -7,6 +7,7 @@
       <searchBar
         v-if="searchType"
         :search-type="'reform'"
+        :initialization-data="initializationData"
         @handleSearch="handleSearchBut"
         @handleAdd="handleOpenDialog(null, 'add')"
       />
@@ -566,6 +567,9 @@
           parseInt(item.dataKey) === this.editEscalationUnitData.polluteType
       )
       return data ? data.dataValue : ''
+    },
+    initializationData () {
+      return this.$route.query
     }
   },
   watch: {
@@ -574,10 +578,32 @@
     }
   },
   created () {
-    this.handleSearch({ isInvalid: 0, state: [9, 20, 30] })
+    if (Object.entries(this.$route.query).length === 0) {
+      this.handleSearch({ isInvalid: 0, state: [9, 20, 30] })
+    } else {
+      let state = []
+      let changeType = null
+      let startTime = this.initializationData.startTime
+      let endTime = this.initializationData.endTime
+      if (this.initializationData.type === 'total') {
+        state = []
+      } else if (this.initializationData.type === 'unComplete') {
+        state = [9, 20, 30]
+      } else if (this.initializationData.type === 'complete') {
+        state = [40]
+      } else if (this.initializationData.type === 'overdue') {
+        state = []
+        changeType = 2
+      }
+      this.handleSearch({ isInvalid: 0, state: state, changeType: changeType, startTime: startTime, endTime: endTime })
+    }
     this.getUnitList()
     this.getContaminateList()
   },
+  // mounted () {
+  //   console.log('this.$route.query', this.$route.query)
+  //   this.initializationData = this.$route.query
+  // },
   methods: {
     getaddressAndLnt (position, address) {
       if (this.mapType === 'edit') {
diff --git a/src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue b/src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue
index f8a130b..adb2650 100644
--- a/src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue
+++ b/src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue
@@ -1,5 +1,8 @@
 <template>
-  <div :class="className" :style="{ height: height, width: width }" />
+  <div
+    :class="className"
+    :style="{ height: height, width: width }"
+  />
 </template>
 
 <script>
@@ -28,7 +31,7 @@
       default: () => []
     }
   },
-  data() {
+  data () {
     return {
       chart: null,
       seriesData: []
@@ -36,7 +39,7 @@
   },
   watch: {
     'chartData': {
-      handler(newVal) {
+      handler (newVal) {
         console.log('newVal', newVal)
         this.seriesData = []
         this.seriesData = newVal
@@ -48,12 +51,12 @@
       immediate: true
     }
   },
-  mounted() {
+  mounted () {
     this.$nextTick(() => {
       this.initChart()
     })
   },
-  beforeDestroy() {
+  beforeDestroy () {
     if (!this.chart) {
       return
     }
@@ -61,12 +64,12 @@
     this.chart = null
   },
   methods: {
-    initChart() {
+    initChart () {
       this.chart = echarts.init(this.$el, 'macarons')
       this.chart.clear()
       this.setOptions()
     },
-    setOptions() {
+    setOptions () {
       // function fontSize(res) {
       //     let clientWidth =
       //         window.innerWidth ||
@@ -97,7 +100,7 @@
                   fontSize: 16
                 },
                 value: {
-                  width: 20,
+                  width: 100,
                   align: 'right',
                   fontFamily: 'Medium',
                   fontSize: 16
@@ -148,4 +151,3 @@
   }
 }
 </script>
-
diff --git a/src/views/toCarryOutLegislativeReforms/summaryPage/index.vue b/src/views/toCarryOutLegislativeReforms/summaryPage/index.vue
index 8cbb583..b5f8c3d 100644
--- a/src/views/toCarryOutLegislativeReforms/summaryPage/index.vue
+++ b/src/views/toCarryOutLegislativeReforms/summaryPage/index.vue
@@ -42,19 +42,31 @@
       />
     </div>
     <div class="agentSummary">
-      <div class="circle">
+      <div
+        class="circle"
+        @click="toOtherPage('total')"
+      >
         <div>������������</div>
         <div>{{ responeForm.total }}</div>
       </div>
-      <div class="circle">
+      <div
+        class="circle"
+        @click="toOtherPage('unComplete')"
+      >
         <div>���������</div>
         <div>{{ responeForm.unComplete }}</div>
       </div>
-      <div class="circle">
+      <div
+        class="circle"
+        @click="toOtherPage('complete')"
+      >
         <div>���������</div>
         <div>{{ responeForm.complete }}</div>
       </div>
-      <div class="circle">
+      <div
+        class="circle"
+        @click="toOtherPage('overdue')"
+      >
         <div>������</div>
         <div>{{ responeForm.overdue }}</div>
       </div>
@@ -364,6 +376,38 @@
     this.handleSearch()
   },
   methods: {
+    toOtherPage (val) {
+      console.log('val', val)
+      let startTime = ''
+      let endTime = ''
+
+      if (this.searchForm.number) {
+        startTime = this.getPeriods(Number(this.searchForm.number))[0]
+        endTime = this.getPeriods(Number(this.searchForm.number))[1]
+      } else {
+        startTime = this.timeInterval[0]
+        endTime = this.timeInterval[1]
+      }
+      this.$router.push({ path: '/toCarryOutLegislativeReforms/toCarryOutLegislativeReforms/reform',
+        query: {
+          type: val,
+          startTime: startTime,
+          endTime: endTime
+        }
+      })
+    },
+    getPeriods (month) {
+      const now = new Date()
+      const end = new Date(new Date())
+      const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
+      // ������������������������������
+      const oneMonthAgo = new Date(today)
+      oneMonthAgo.setMonth(oneMonthAgo.getMonth() - month)
+      const startTime = oneMonthAgo.toISOString().split('T')[0]
+      const endTime = end.toISOString().substring(0, 10)
+      console.log('startTime', startTime, 'endTime', endTime)
+      return [startTime, endTime]
+    },
     changeUid (val) {
       this.unitIdlist = this.uniqueArrayReduce(val)
       this.handleSearch()
@@ -596,6 +640,7 @@
       justify-content: center;
       flex-wrap: wrap;
       flex-direction: column;
+      cursor: pointer;
     }
   }
 

--
Gitblit v1.8.0