huangmp 4 anni fa
parent
commit
b956a7d0af

+ 46 - 24
src/views/dashboard/smartoperationcenter/comps/agency_info.vue

@@ -1,20 +1,20 @@
 <template>
   <div class="page animate__animated animate__faster animate__fadeInLeft">
-    <more title="园区信息"></more>
+    <more :title="title"></more>
     <div class="container">
       <div class="layout_left">
         <div class="top">
           <div class="center">
             <el-image class="img" :src="info.img">
-                <img class="img" slot="error" src="/img/icon/agency.jpg">
+              <img class="img" slot="error" src="/img/icon/agency.jpg">
             </el-image>
           </div>
           <div class="data">
             <div class="title">
-             {{info.name}}
+              {{info.name}}
             </div>
             <div class="desc">
-              {{info.description || '暂无园区简介'}}
+              {{info.description || '暂无简介'}}
             </div>
           </div>
         </div>
@@ -40,16 +40,30 @@
   import * as echarts from 'echarts';
   import countTo from 'vue-count-to'
   import more from "@/components/more.vue"
-  import {getAgencyInfo} from "@/api/community/agency.js"
-  import {getCount,getBizType} from "@/api/enterprise/enterprise.js"
+  import {
+    getAgencyInfo
+  } from "@/api/community/agency.js"
+  import {
+    getBizType
+  } from "@/api/enterprise/enterprise.js"
+  import {
+    getuserType
+  } from "@/api/person/basicinfo.js"
+  import {
+    mapGetters
+  } from "vuex";
   export default {
     components: {
       more,
       countTo
     },
+    computed: {
+      ...mapGetters(['tenantType'])
+    },
     data() {
       return {
-        info:{},
+        title: '园区信息',
+        info: {},
         list: [{
             label: '楼栋数量',
             value: 0
@@ -69,28 +83,36 @@
       this.init()
     },
     methods: {
-      init(){
-        this.initData()
-
+      async init() {
+       await  this.initData()
         let _this = this
         setTimeout(() => {
           _this.initMyCharts()
-        }, 300)
+        }, 20)
       },
-      initData(){
-        getAgencyInfo().then(res=>{
-          this.info=res.data.data
-          this.list[0].value=this.info.buildingCount || 0
-          this.list[1].value=this.info.companyCount || 0
-          this.list[2].value=this.info.officeCount || 0
-        })
+      async initData() {
+        this.info = (await getAgencyInfo()).data.data
+        this.setList(0, this.info.buildingCount)
+        if (this.tenantType == 1) {
+          this.title = '园区信息',
+          this.setList(1, this.info.companyCount)
+          this.setList(2, this.info.officeCount)
+          //获取饼图数据
+          this.chartData = (await getBizType()).data.data
+        } else {
+          this.title = '社区信息',
+          this.setList(1, this.info.residentialCount, '入驻小区')
+          this.setList(2, this.info.houseUserCount, "居民数量")
+          //获取饼图数据
+          this.chartData = (await getuserType()).data.data
+        }
+      },
+      setList(index, value, label) {
+        this.list[index].label = label ? label : this.list[index].label
+        this.list[index].value = value ? value : this.list[index].value
       },
       // echarts图表 begin
       async initMyCharts() {
-        let res=(await getBizType()).data.data
-        let legendData=res.legendData
-        let chartData=res.data
-
         var myCharts = echarts.init(document.getElementById('myCharts'));
         window.addEventListener('resize', function() { //执行
           myCharts.resize();
@@ -115,7 +137,7 @@
             },
             right: 40,
             top: 40,
-            data: legendData,
+            data: this.chartData.legendData,
             selected: '商务服务',
           },
           series: [{
@@ -124,7 +146,7 @@
             radius: ['30%', '60%'],
             center: ['40%', '50%'],
             avoidLabelOverlap: false,
-            data: chartData,
+            data: this.chartData.data,
           }]
         }
         option && myCharts.setOption(option);

+ 1 - 2
src/views/dashboard/smartoperationcenter/option/basicinfo-option.js

@@ -4,7 +4,7 @@ import {
 import {
   DIC
 } from "@/api/util/nation"
-export default (_this) => {
+export default () => {
   return {
     dialogWidth: '45%',
     height: 'auto',
@@ -328,7 +328,6 @@ export default (_this) => {
       label: '其他信息',
       collapse: true,
       prop: 'group2',
-      collapse: false,
       column: [{
           label: "生日",
           prop: "birthday",