Przeglądaj źródła

用户统计数据处理优化

彭宇 2 miesięcy temu
rodzic
commit
70e27c65bc
3 zmienionych plików z 13 dodań i 12 usunięć
  1. 2 2
      src/api/data.js
  2. 4 4
      src/views/SentryCockpit.vue
  3. 7 6
      src/views/useCenter.vue

+ 2 - 2
src/api/data.js

@@ -5,9 +5,9 @@ import request from '@/utils/request'
  * 查询用户数量
  * @returns {*}
  */
-export function userStats() {
+export function userStats(deptId) {
   return request({
-    url: '/sooka-digital-construction/community/userStats',
+    url: '/sooka-digital-construction/community/userStats?deptId='+deptId,
     method: 'get',
   })
 }

+ 4 - 4
src/views/SentryCockpit.vue

@@ -320,10 +320,10 @@
         return y + '-' + m + '-' + d
       },
       userStats(){
-        userStats().then(req => {
-          this.businessUsers = req.data.find(item => item.name === "business").value;
-          this.civilUsers = req.data.find(item => item.name === "civil").value;
-          this.industryUsers = req.data.find(item => item.name === "industry").value;
+        userStats('').then(req => {
+          this.businessUsers = req.data.find(item => item.NAME === "business").VALUE;
+          this.civilUsers = req.data.find(item => item.NAME === "civil").VALUE;
+          this.industryUsers = req.data.find(item => item.NAME === "industry").VALUE;
           this.yhfxChart();
         })
       },

+ 7 - 6
src/views/useCenter.vue

@@ -96,7 +96,7 @@ export default {
     setTimeout(() => {
       this.title = '四平市智慧哨兵监管平台'
     }, 1000);
-    this.userStats();
+    this.userStats(314459);
     this.getCommunityByDeptId(314459);
   },
   data() {
@@ -173,6 +173,7 @@ export default {
             that.$parent.$refs.supermap.clearM()
         }
       })
+      this.userStats(id);
     },
     getCustomerByCommunityId(id){
       let that = this;
@@ -319,11 +320,11 @@ export default {
       });
 
     },
-    userStats(){
-      userStats().then(req => {
-        this.businessUsers = req.data.find(item => item.name === "business").value;
-        this.civilUsers = req.data.find(item => item.name === "civil").value;
-        this.industryUsers = req.data.find(item => item.name === "industry").value;
+    userStats(deptId){
+      userStats(deptId).then(req => {
+        this.businessUsers = req.data.find(item => item.NAME === "business").VALUE;
+        this.civilUsers = req.data.find(item => item.NAME === "civil").VALUE;
+        this.industryUsers = req.data.find(item => item.NAME === "industry").VALUE;
         this.chart();
       })
     },