Browse Source

地图轮转

yangjie 2 months ago
parent
commit
06208e0e21

+ 71 - 23
src/store/client12345/index.js

@@ -1,31 +1,79 @@
 const client12345 = {
   state: {
-    curAreaAccept: {
-        data1: 200,
-        data2: 100,
-    }
+    curArea: {
+      area: {
+        acceptCount: 0,
+        districtName: "南江县",
+        id: 1,
+        processCount: 0,
+        statDate: "2024",
+      }
+    },
+    areaDataList: [
+      {
+        acceptCount: 0,
+        districtName: "南江县",
+        id: 1,
+        processCount: 0,
+        statDate: "2024",
+      },
+      {
+        acceptCount: 0,
+        districtName: "通江县",
+        id: 2,
+        processCount: 0,
+        statDate: "2024",
+      },
+      {
+        acceptCount: 0,
+        districtName: "平昌县",
+        id: 3,
+        processCount: 0,
+        statDate: "2024",
+      },
+      {
+        acceptCount: 0,
+        districtName: "巴州区",
+        id: 4,
+        processCount: 0,
+        statDate: "2024",
+      },
+      {
+        acceptCount: 0,
+        districtName: "恩阳区",
+        id: 5,
+        processCount: 0,
+        statDate: "2024",
+      },
+    ],
   },
   mutations: {
-    SET_NEW_DATA: (state) => {
-      state.curAreaAccept.data1 ++;
-      state.curAreaAccept.data2 ++;
-    }
+    SET_AREA_DATA: (state, data) => {
+      const index = state.areaDataList.findIndex(
+        (item) => item.districtName === data.districtName
+      );
+      console.log(data,'setAreaData')
+      if (index !== -1) {
+        state.areaDataList.splice(index, 1, data);
+      } else {
+        state.areaDataList.push(data);
+      }
+    },
+    SET_CUR_AREA: (state, data) => {
+      const areaData = state.areaDataList.find(item => item.districtName === data)
+      state.curArea.area = areaData;
+      console.log(state.areaDataList, "areaDataList")
+      console.log(state.curArea, "cuArea")
+    },
   },
   actions: {
-    SetNewData({commit}) {
-      commit('SET_NEW_DATA');
-      // return new Promise(resolve => {
-      //   let accessedRouters;
-      //   if (roles.indexOf('admin') >= 0) {
-      //     accessedRouters = Jurisdiction
-      //   } else {
-      //     accessedRouters = filterAsyncRouter(Jurisdiction, roles)
-      //   }
-      //   commit('SET_ROUTERS', accessedRouters);
-      //   resolve()
-      // })
-    }
-  }
+    SetCurArea({ commit }, data) {
+      commit("SET_CUR_AREA", data);
+    },
+    SetAreaDataList({ commit }, data) {
+      commit("SET_AREA_DATA", data);
+    },
+  },
 };
 
-export default client12345
+export default client12345;

+ 2 - 1
src/store/getters.js

@@ -4,5 +4,6 @@ export const getters = {
   token: state => state.user.token,
   accountPwd: state => state.user.accountPwd,
   addRouters: state => state.permission.addRouters,
-  curAreaAccept: state => state.client12345.curAreaAccept
+  curArea: state => state.client12345.curArea,
+  areaDataList: state => state.client12345.areaDataList
 };

+ 3 - 3
src/view/client/12345/CenterMap/api.js

@@ -1,7 +1,7 @@
 import {server} from "@/tools/servers"
 
-export class getRiskTrendData{
-  static getList(){
-    return server.connection('POST','/api/12345/getRecentlyAcceptCountTrend')
+export class getAreaData{
+  static getList(data){
+    return server.connection('POST','/api/12345/getCurrentAreaHotlineAcceptance',data)
   }
 }

+ 25 - 11
src/view/client/12345/CenterMap/index.vue

@@ -5,22 +5,26 @@
 </template>
 
 <script>
-import { getRiskTrendData } from "./api";
+import { getAreaData } from "./api";
 import bazhong from "./baZhongMap.json";
 import { store } from "@/store";
 export default {
   data() {
     return {
+      year: 2024,
       xData: [],
       yData: [],
       mapList: ["南江县", "通江县", "平昌县", "巴州区", "恩阳区"],
       curIndex: 0,
+      curArea: {},
       intervalId: null,
       time: 3000,
     };
   },
   mounted() {
-    // this.getChartData();
+    const { curArea } = store.getters;
+    this.curArea = curArea;
+    this.getChartData();
     this.initChart();
   },
   unmounted() {
@@ -28,14 +32,21 @@ export default {
   },
   methods: {
     getChartData() {
-      getRiskTrendData.getList().then((res) => {
-        const { code, result } = res.data;
-        if (code === 200) {
-          this.xData = result.xaxisData;
-          this.yData = result.yaxisData;
-          this.initChart();
-        }
-        console.log(res, "data");
+      const now = new Date();
+      this.year = now.getFullYear();
+      this.mapList.forEach((item) => {
+        getAreaData
+          .getList({
+            districtName: item,
+            year: this.year,
+          })
+          .then((res) => {
+            const { code, result } = res.data;
+            if (code === 200) {
+              console.log(result, "data");
+              store.dispatch("SetAreaDataList", result);
+            }
+          });
       });
     },
     initChart() {
@@ -47,7 +58,8 @@ export default {
           trigger: "item",
           formatter(param) {
             console.log("param.data.name", param);
-            return `${param.data.name}<br>受理量:${param.data.value}<br>交办量:${param.data.value}`;
+            // return `${param.data.name}<br>受理量:${param.data.name}<br>交办量:${param.data.name}`;
+            return `${param.data.name}`;
           },
         },
         series: [
@@ -184,6 +196,8 @@ export default {
         this.curIndex++;
         this.curIndex = this.curIndex % this.mapList.length;
 
+        store.dispatch("SetCurArea", this.mapList[this.curIndex]);
+
         if (this.curIndex == 0) {
           this.cancelHighlightRegion(this.mapList.lengt - 1);
         } else {

+ 7 - 0
src/view/client/12345/CenterTop/api.js

@@ -0,0 +1,7 @@
+import {server} from "@/tools/servers"
+
+export class getAreaData{
+  static getList(data){
+    return server.connection('POST','/api/12345/getCurrentAreaHotlineAcceptance',data)
+  }
+}

+ 13 - 8
src/view/client/12345/CenterTop/index.vue

@@ -2,16 +2,20 @@
   <div class="box">
     <div class="box-item">
       <div class="item-top">
-        {{curAreaAccept.data1}}
-        <span style="font-size: 0.75rem; font-family: 'Microsoft YaHei'">个</span>
+        {{ curArea.area.acceptCount }}
+        <span style="font-size: 0.75rem; font-family: 'Microsoft YaHei'"
+          >个</span
+        >
       </div>
       <img src="@/assets/images/baseImg.png" class="item-img" />
       <div class="item-bottom">受理量</div>
     </div>
     <div class="box-item">
       <div class="item-top">
-        {{curAreaAccept.data2}}
-        <span style="font-size: 0.75rem; font-family: 'Microsoft YaHei'">个</span>
+        {{ curArea.area.processCount }}
+        <span style="font-size: 0.75rem; font-family: 'Microsoft YaHei'"
+          >个</span
+        >
       </div>
       <img src="@/assets/images/baseImg.png" class="item-img" />
       <div class="item-bottom">交办量</div>
@@ -20,18 +24,19 @@
 </template>
 
 <script>
-// import { getAcceptTickets } from "./api";
+import { getAreaData } from "./api";
 import { store } from "@/store";
 export default {
   data() {
     return {
       tableData: [],
-      curAreaAccept: {},
+      curArea: "",
+      areaDataList: [],
     };
   },
   mounted() {
-    const { curAreaAccept } = store.getters;
-    this.curAreaAccept = curAreaAccept;
+    const { curArea } = store.getters;
+    this.curArea = curArea;
   },
   methods: {},
 };

+ 5 - 5
src/view/client/12345/LeftTitle/index.vue

@@ -1,15 +1,15 @@
 <template>
   <div class="box">
     <div class="top-left-box">
-      <div class="top-left-num" style="color: #80f2ad">{{todayData}}</div>
+      <div class="top-left-num" style="color: #80f2ad">{{monthData}}</div>
       <div class="top-left-text">本月接件量</div>
     </div>
     <div class="top-left-box">
-      <div class="top-left-num" style="color: #00fdff">{{monthData}}</div>
+      <div class="top-left-num" style="color: #00fdff">{{yearData}}</div>
       <div class="top-left-text">本年接件量</div>
     </div>
     <div class="top-left-box">
-      <div class="top-left-num" style="color: #34a4ee">{{yearData}}</div>
+      <div class="top-left-num" style="color: #34a4ee">{{historyData}}</div>
       <div class="top-left-text">累计接件量</div>
     </div>
   </div>
@@ -20,7 +20,7 @@ import { getHistoryAcceptCount } from "./api";
 export default {
   data() {
     return {
-      todayData: 0,
+      historyData: 0,
       monthData: 0,
       yearData: 0,
     };
@@ -33,7 +33,7 @@ export default {
       getHistoryAcceptCount.getList().then((res) => {
         const { code, result } = res.data;
         if (code === 200) {
-          this.todayData = result.historyCount;
+          this.historyData = result.historyCount;
           this.monthData = result.currentMonthCount;
           this.yearData = result.currentYearCount;
         }

+ 1 - 1
src/view/client/12345/TodayAcceptance/index.vue

@@ -96,7 +96,7 @@ export default {
     };
   },
   mounted() {
-    this.getData();
+    // this.getData();
   },
   methods: {
     getData() {