linwe
2024-06-24 3831b2bd6ea9bf1c7eab86fe6465e4b910e02af6
pages/statistics/index.vue
@@ -1,5 +1,14 @@
<template>
   <view class="container">
      <u-navbar height="48" :autoBack="false" safeAreaInsetTop placeholder @leftClick="navToSelectSite()"
         :bgColor="background.top">
         <view slot="left" class="top flex">
            <view class="top-text f-30 fw c-ff">
               {{ '选择社区' }}
            </view>
            <u-icon name="arrow-right" color="#fff"></u-icon>
         </view>
      </u-navbar>
      <view class="section">
         <caption-row title="社区概况" bgColor="#003399"></caption-row>
         <view class="cell flex j-c-s-b flex-wrap ">
@@ -221,9 +230,14 @@
      },
      data() {
         return {
            siteInfo: uni.getStorageSync("siteInfo"),
            reportData: {},
            houseData: {},
            chartData: {},
            background: {
               top: "#017BFC",
               banner: "linear-gradient(180deg, #017BFC 0%, rgba(1, 123, 252, 0) 100%)"
            },
            opts: {
               fontSize: 10,
               color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
@@ -281,9 +295,6 @@
               // ],
               padding: [5, 5, 5, 5],
               enableScroll: false,
               // rotate: false,
               // rotateLock: false,
               // dataLabel: true,
               extra: {
                  pie: {
                     centerColor: "#fff",
@@ -296,37 +307,25 @@
                     borderWidth: 3,
                     borderColor: "#FFFFFF"
                  }
                  // ring: {
                  //    ringWidth: 60,
                  //    activeOpacity: 0.5,
                  //    activeRadius: 10,
                  //    offsetAngle: 0,
                  //    labelWidth: 15,
                  //    border: false,
                  //    borderWidth: 3,
                  //    borderColor: "#FFFFFF"
                  // }
               }
            },
            gridData: {},
            houseLabelData: [],
            sexData: [],
            tabList: [],
            tabbarIndex: 1
            tabbarIndex: 1,
            chilrenList: []
         }
      },
      // onTabItemTap(e) {
      //    // tab 点击时执行,此处直接接收单击事件
      //    console.log(e)
      //    this.refreshData();
      // },
      onShow() {
         this.chilrenList = uni.getStorageSync("chilrenList") ? uni.getStorageSync("chilrenList") : []
         if (this.chilrenList && this.chilrenList.length == 0) {
            this.chilrenList.push(this.siteInfo.id)
            uni.setStorageSync("chilrenList", this.chilrenList)
         }
         let {
            roleName
         } = uni.getStorageSync("activeRole");
         if (roleName == "网格员") {
            this.tabList = getTabbarList(3);
@@ -338,13 +337,11 @@
            // this.tabbarIndex = 1;
            this.tabbarIndex = 2;
         }
         if (roleName == "系统管理员") {
            this.tabList = getTabbarList(4);
            // this.tabbarIndex = 1;
            this.tabbarIndex = 2;
         }
         this.refreshData();
      },
@@ -356,9 +353,12 @@
         }, 300)
      },
      methods: {
         navToSelectSite() {
            uni.navigateTo({
               url: '/pages/home/selectSiteTwo'
            })
         },
         changeTabbar(e) {
            console.log("==>", e)
            // this.refreshData();
@@ -370,6 +370,7 @@
            this.getHouseLabelData();
            this.getReportData();
            this.getGridData();
            // this.getGridListData();
         },
         getRoleType() {
            let roleName = uni.getStorageSync("activeRole").roleName;
@@ -389,13 +390,10 @@
            } else {
               return num
            }
         },
         getHouseHoldData() {
            statisticsModal.getHouseholdStatistics({
               code: this.siteInfo.id,
               code: this.chilrenList.join(","),
               roleType: this.getRoleType()
            }).then(res => {
               // this.houseHoldData = res.data;
@@ -407,7 +405,10 @@
         },
         getHouseLabelData() {
            statisticsModal.getHouseLabelStatistic().then(res => {
            statisticsModal.getHouseLabelStatistic({
               code: this.chilrenList.join(","),
               roleType: this.getRoleType()
            }).then(res => {
               let data = res.data;
               this.houseLabelData = data;
               this.setHouseLabelData(data)
@@ -461,7 +462,7 @@
         //获取社区概况数据
         getHouseData() {
            statisticsModal.getHouseStatistics({
               code: this.siteInfo.id,
               code: this.chilrenList.join(","),
               roleType: this.getRoleType()
            }).then(res => {
               this.houseData = res.data;
@@ -471,7 +472,7 @@
         //获取社区事件数据
         getReportData() {
            statisticsModal.getReportStatistics({
               code: this.siteInfo.id,
               code: this.chilrenList.join(","),
               roleType: this.getRoleType()
            }).then(res => {
               console.log(res);
@@ -482,13 +483,13 @@
         //获取网格物业人员
         getGridData() {
            statisticsModal.getGridStatistics({
               code: this.siteInfo.id,
               code: this.chilrenList.join(","),
               roleType: this.getRoleType()
            }).then(res => {
               console.log(res);
               this.gridData = res.data;
            })
         }
         },
      }
   }
</script>