From d99177b77bf91cddb7a800242d50ad02b46092c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E7=B4=A0?= <66666@66.com>
Date: Fri, 12 Apr 2024 17:35:24 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=BC=98=E5=8C=96=E7=BB=9F?=
 =?UTF-8?q?=E8=AE=A1=E6=95=B0=E5=AD=97=E6=A0=BC=E5=BC=8F=EF=BC=8C=E6=AF=8F?=
 =?UTF-8?q?=E4=B8=89=E4=BD=8D=E7=94=A8=E8=8B=B1=E6=96=87=E9=80=97=E5=8F=B7?=
 =?UTF-8?q?=E9=9A=94=E5=BC=80=E4=B8=80=E4=B8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 src/views/modules/home/index.vue | 118 ++++++++++++++++++++-----------
 1 file changed, 78 insertions(+), 40 deletions(-)
diff --git a/src/views/modules/home/index.vue b/src/views/modules/home/index.vue
index 67332e6f3..3f36e66b6 100644
--- a/src/views/modules/home/index.vue
+++ b/src/views/modules/home/index.vue
@@ -30,7 +30,10 @@
           
             
               
-                {{ pandectData.totalResidents }}
+                
+                  {{ pandectData.totalResidents }}
+                
+
                 
                 居民总数
               
@@ -129,9 +132,9 @@
                 
 
                 
-                  

{{
-                  item.content }}
+                  

{{
+                item.content }}
                 
 
                
               
@@ -153,35 +156,40 @@
               style="margin-top: 10px;" v-show="showAll" @click="jumpToJuMin()">

更新设置
           
 
-          
-            
+          
+            
               
-                  {{scope.row.residentCategoryName}}
+                {{ scope.row.residentCategoryName }}
               
             
-            
+            
               
-                  {{scope.row.total}}
+                {{ scope.row.total }}
               
             
-            
-              
+            
+              
+                {{
+                scope.row.nonIntegratedNum }}
+              
             
-            
+            
               
-                  {{scope.row.userName}}
+                {{ scope.row.userName }}
               
             
-            
+            
               
-                  {{scope.row.updatePeriod?scope.row.updatePeriod =='month'?'每自然月':scope.row.updatePeriod =='halfMonth'?'每半自然月':scope.row.updatePeriod =='week'?'每周':'':''}}
+                {{ scope.row.updatePeriod ? scope.row.updatePeriod
+                == 'month' ? '每自然月' : scope.row.updatePeriod == 'halfMonth' ? '每半自然月' : scope.row.updatePeriod
+                  == 'week' ? '每周' : '' : '' }}
               
             
             
               
-                  {{scope.row.updateResiNum}}({{scope.row.updatePeriodName?scope.row.updatePeriodName:'--'}})
+                {{ scope.row.updateResiNum }}({{
+                scope.row.updatePeriodName ? scope.row.updatePeriodName : '--' }})
               
             
           
@@ -257,7 +265,7 @@ export default {
       noticeData: [],
       activeName: "resi",
       myChart: {},
-      myBarchart:{},
+      myBarchart: {},
       agencyLevel: '',
       yData: [
         // {
@@ -291,8 +299,8 @@ export default {
   },
   computed: {
     maxTableHeight() {
-      const _h = this.clientHeight - 610 ;
-      return  _h;
+      const _h = this.clientHeight - 610;
+      return _h;
     },
     ...mapGetters(["clientHeight"]),
   },
@@ -332,6 +340,13 @@ export default {
     );
   },
   methods: {
+    formatNumber(number) {
+      if (typeof number === 'string') {
+        // 如果是字符串,去除非数字字符并转为数字类型
+        number = parseInt(number.replace(/\D/g, ''), 10);
+      }
+      return number.toLocaleString();
+    },
     initChart() {
       this.$http.get("/governance/satisfactionOverview/notSatisfactionTrend").then(({ data: { data } }) => {
         this.myChart = echarts.init(document.getElementById("my_chart"));
@@ -395,14 +410,24 @@ export default {
     },
 
     columnbackgroundStyle({ row, column, rowIndex, columnIndex }) {
-        if (columnIndex == 3||columnIndex == 4||columnIndex == 5) {
-            return 'background:#fffcf3;'
-        }
+      if (columnIndex == 3 || columnIndex == 4 || columnIndex == 5) {
+        return 'background:#fffcf3;'
+      }
     },
 
     borderH() {
       this.$http.post("/actual/base/residentCategoryUpdateInfo/getUpdateAndintegrityList").then(({ data: { data } }) => {
         this.tableList = data
+        this.tableList.forEach(item => {
+          // 如果需要格式化的字段是数字类型,则进行格式化
+          if (typeof item.total === 'number') {
+            item.total = this.formatNumberWithCommas(item.total);
+          }
+          if (typeof item.nonIntegratedNum === 'number') {
+            item.nonIntegratedNum = this.formatNumberWithCommas(item.nonIntegratedNum);
+          }
+
+        });
         console.log("请求成功:", data);
       });
     },
@@ -437,7 +462,7 @@ export default {
     handleClickNotice(item) {
       if (item.msgType == "community_house") {
         let { agencyId, gridId, gridName, houseId, houseName, targetId } = item
-        this.$store.dispatch('saveDataH', { agencyId, gridId, gridName, houseId: targetId, houseName:'房屋详情' });
+        this.$store.dispatch('saveDataH', { agencyId, gridId, gridName, houseId: targetId, houseName: '房屋详情' });
         this.$router.push({ name: 'house-huaxiang' });
         this.$store.state.contentTabs = this.$store.state.contentTabs.map(item => {
           if (item.name === "house-huaxiang") {
@@ -464,7 +489,7 @@ export default {
           gender,
           homeId,
           homeName,
-          name:'居民详情',
+          name: '居民详情',
           resiId: targetId,
         });
         this.$router.push({ name: "jumin-huaxiang" });
@@ -545,6 +570,11 @@ export default {
       }
     },
 
+    formatNumberWithCommas(number) {
+      return new Intl.NumberFormat().format(number);
+    },
+
+
     //加载组织数据
     async getPandectData() {
       const url = "/actual/base/residentHouseMerge/communityOverview";
@@ -558,7 +588,14 @@ export default {
       if (code === 0) {
         if (data) {
           this.pandectData = data;
+          for (let key in this.pandectData) {
+            if (!isNaN(this.pandectData[key])) {
+              // 如果值可以转换为数字,则进行格式化
+              this.pandectData[key] = this.formatNumberWithCommas(parseFloat(this.pandectData[key]));
+            }
+          }
         }
+
       } else {
         this.$message.error(msg);
       }
@@ -580,15 +617,15 @@ export default {
         this.$message.error(msg);
       }
     },
-    handelCLickJump(e){
+    handelCLickJump(e) {
       this.$router.push({
-            path: "/main/base-nonIntResi",
-            query: {
-              resiCategory: e.residentCategory,
-            }
-          });
+        path: "/main/base-nonIntResi",
+        query: {
+          resiCategory: e.residentCategory,
+        }
+      });
     },
- 
+
     //加载组织数据
     async getWarningList() {
       const url = "/actual/base/resiCategory/categoryCountList";
@@ -659,13 +696,14 @@ export default {
         // let nonIntegratedNum = data.categoryStatsDatas.map(item => item.nonIntegratedNum)
         let option = {
           backgroundColor: '#fff',
-          color: ['#448cf6', '#f7ca60', ],
+          color: ['#448cf6', '#f7ca60',],
           tooltip: {
             trigger: 'axis',
             axisPointer: {
               type: 'shadow'
             }
           },
+
           legend: {
             x: 'center',
             bottom: '8%',
@@ -697,18 +735,18 @@ export default {
             stack: '总量',
             barWidth: '30px',
             data: data.categoryStatsDatas.map((item, index) => ({
-            value: item.integratedNum,
-            extraProperty: item.resiCategory
-          })),
+              value: item.integratedNum,
+              extraProperty: item.resiCategory
+            })),
           },
           {
             name: '分类信息不完整数',
             type: 'bar',
             stack: '总量',
             data: data.categoryStatsDatas.map((item, index) => ({
-            value: item.nonIntegratedNum,
-            extraProperty: item.resiCategory
-          })),
+              value: item.nonIntegratedNum,
+              extraProperty: item.resiCategory
+            })),
           }
           ]
         };