IndexChart.vue 11.4 KB
Newer Older
1 2
<template>
  <div class="page-header-index-wide">
宋雄's avatar
宋雄 committed
3 4
    <a-row :gutter="12">
      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
5 6
        <div class="statistics">
          <div class="icon" style="color:#1890ff;"><a-icon type="home" color="#1890ff" /></div>
7
          <div>
8 9
            <p style="color:#666;margin-bottom:5px;">入驻物业公司数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.settledNum}}
10 11 12
              <span v-if="statistical.monthSettledNum > 0"><a-icon type="arrow-up"
                  color="#1890ff" />{{ statistical.monthSettledNum }}</span>
            </p>
何忠建's avatar
何忠建 committed
13
          </div>
14
        </div>
15
      </a-col>
宋雄's avatar
宋雄 committed
16
      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
17
        <div class="statistics">
宋雄's avatar
宋雄 committed
18
          <div class="icon" style="color:#7262fd;"><a-icon type="bank" /></div>
19
          <div>
20 21
            <p style="color:#666;margin-bottom:5px;">累计物业社区数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.communityNum}}</p>
22
          </div>
23
        </div>
24
      </a-col>
宋雄's avatar
宋雄 committed
25
      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
26 27
        <div class="statistics">
          <div class="icon" style="color:#ffaa00;"><a-icon type="bar-chart" /></div>
28
          <div>
29 30
            <p style="color:#666;margin-bottom:5px;">累计小区数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.communityNum}}</p>
31
          </div>
32
        </div>
33
      </a-col>
宋雄's avatar
宋雄 committed
34
      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
35 36
        <div class="statistics">
          <div class="icon" style="color:#52c41a;"><a-icon type="line-chart" /></div>
37
          <div>
何忠建's avatar
何忠建 committed
38
            <p style="color:#666;margin-bottom:5px;">累计业主数量</p>
39
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.ownerNum}}
40 41 42
              <span v-if="statistical.monthOwnerNum > 0"><a-icon type="arrow-up"
                  color="#1890ff" />{{ statistical.monthOwnerNum }}</span>
            </p>
43
          </div>
44
        </div>
45
      </a-col>
宋雄's avatar
宋雄 committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
        <div class="statistics">
          <div class="icon" style="color:#de3840;"><a-icon type="team" /></div>
          <div>
            <p style="color:#666;margin-bottom:5px;">合作伙伴数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.partnersNum}}
              <span v-if="statistical.monthPartnersNum > 0"><a-icon type="arrow-up"
                  color="#1890ff" />{{ statistical.monthPartnersNum }}</span>
            </p>
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="8" :xl="4" :style="{ marginBottom: '12px' }">
        <div class="statistics">
          <div class="icon" style="color:#9C27B0;"><a-icon type="shop" /></div>
          <div>
            <p style="color:#666;margin-bottom:5px;">推广商铺数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{statistical.shopNum}}
              <span v-if="statistical.monthShopNum > 0"><a-icon type="arrow-up"
                  color="#1890ff" />{{ statistical.monthShopNum }}</span>
            </p>
          </div>
        </div>
      </a-col>
71
    </a-row>
宋雄's avatar
宋雄 committed
72
    <div class="wait-box" style="margin-bottom: 12px;">
何忠建's avatar
何忠建 committed
73
      <h3 class="box-title">待处理事务(入驻待审核)</h3>
何忠建's avatar
何忠建 committed
74
      <div class="content" v-if="waitAuditList.length > 0">
何忠建's avatar
何忠建 committed
75
        <div class="item" v-for="(item, index) in waitAuditList" :key="index">
宋雄's avatar
宋雄 committed
76 77 78 79 80 81
          <template v-if="item.creditCode">
            <p>入驻物业集团名称:{{ item.propertyName }}</p>
            <p>申请入驻小区数量:{{ item.empowerCommunityNum }}</p>
            <p>申请入驻物业时间:{{ item.createTime }}</p>
            <p>添加人:{{ item.createBy }}</p>
            <a-button type="primary" size="small" @click="toOperation(item, 1)">审核</a-button>
宋雄's avatar
宋雄 committed
82 83
          </template>
          <template v-else>
宋雄's avatar
宋雄 committed
84 85 86 87 88
            <p>入驻社区名称:{{ item.councilsName }}</p>
            <p>申请入驻小区数量:{{ item.empowerCommunityNum }}</p>
            <p>申请入驻社区时间:{{ item.createTime }}</p>
            <p>添加人:{{ item.createBy }}</p>
            <a-button type="primary" size="small" @click="toOperation(item, 2)">审核</a-button>
宋雄's avatar
宋雄 committed
89
          </template>
宋雄's avatar
宋雄 committed
90 91
        </div>
      </div>
何忠建's avatar
何忠建 committed
92 93 94
      <div class="content" v-else>
        <a-empty />
      </div>
何忠建's avatar
何忠建 committed
95
    </div>
宋雄's avatar
宋雄 committed
96 97

    <div class="map-box">
何忠建's avatar
何忠建 committed
98
      <h3 class="box-title">社区分布数量图</h3>
宋雄's avatar
宋雄 committed
99 100
      <div ref="mapEcharts" class="map-echart" style="height: 500px"></div>
    </div>
101 102 103 104
  </div>
</template>

<script>
何忠建's avatar
何忠建 committed
105 106 107 108 109 110 111 112 113 114 115 116
import * as echarts from 'echarts'
import chinaData from '@/assets/china.json' //地图包
import ChartCard from '@/components/ChartCard'
import ACol from 'ant-design-vue/es/grid/Col'
import ATooltip from 'ant-design-vue/es/tooltip/Tooltip'
import MiniArea from '@/components/chart/MiniArea'
import MiniBar from '@/components/chart/MiniBar'
import MiniProgress from '@/components/chart/MiniProgress'
import RankList from '@/components/chart/RankList'
import Bar from '@/components/chart/Bar'
import LineChartMultid from '@/components/chart/LineChartMultid'
import HeadInfo from '@/components/tools/HeadInfo.vue'
117

何忠建's avatar
何忠建 committed
118 119
import Trend from '@/components/Trend'
import { getDataStatisticsApi, getLoginfo, getVisitInfo, auditPropertyApi } from '@/api/api'
120

何忠建's avatar
何忠建 committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
const rankList = []
for (let i = 0; i < 7; i++) {
  rankList.push({
    name: '白鹭岛 ' + (i + 1) + ' 号店',
    total: 1234.56 - i * 100,
  })
}
const barData = []
for (let i = 0; i < 12; i += 1) {
  barData.push({
    x: `${i + 1}月`,
    y: Math.floor(Math.random() * 1000) + 200,
  })
}
export default {
  name: 'IndexChart',
  components: {
    ATooltip,
    ACol,
    ChartCard,
    MiniArea,
    MiniBar,
    MiniProgress,
    RankList,
    Bar,
    Trend,
    LineChartMultid,
    HeadInfo,
  },
  data() {
    return {
      statistical: {},
      mapData: [],
      waitAuditList: [],
      loading: true,
      center: null,
      rankList,
      barData,
      loginfo: {},
      visitFields: ['ip', 'visit'],
      visitInfo: [],
宋雄's avatar
宋雄 committed
162
      indicator: <a-icon type="loading" style="font-size: 12px" spin />,
何忠建's avatar
何忠建 committed
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
    }
  },
  created() {
    setTimeout(() => {
      this.loading = !this.loading
    }, 1000)
    this.initLogInfo()
    this.getDataStatistics()
  },
  methods: {
    initLogInfo() {
      getLoginfo(null).then((res) => {
        if (res.success) {
          Object.keys(res.result).forEach((key) => {
            res.result[key] = res.result[key] + ''
          })
          this.loginfo = res.result
        }
      })
      getVisitInfo().then((res) => {
        if (res.success) {
          this.visitInfo = res.result
        }
      })
187
    },
何忠建's avatar
何忠建 committed
188 189
    async getDataStatistics() {
      let { result } = await getDataStatisticsApi()
宋雄's avatar
宋雄 committed
190 191 192 193 194 195 196 197
      // this.statistical = {
      //   settledNum: result.settledNum,
      //   communityNum: result.communityNum,
      //   ownerNum: result.ownerNum,
      //   monthOwnerNum: result.monthOwnerNum,
      //   monthSettledNum: result.monthSettledNum,
      // }
      this.statistical = {...result}
宋雄's avatar
宋雄 committed
198 199 200
      let propertyList = result.waitAuditList[0] || []
      let communityList = result.waitAuditList[1] || []
      this.waitAuditList = propertyList.concat(communityList)
何忠建's avatar
何忠建 committed
201 202
      this.mapData =
        result.propertySettledList.map((item) => {
宋雄's avatar
宋雄 committed
203 204 205
          return {
            name: item.propertyName,
            value: [item.longitude, item.latitude],
何忠建's avatar
何忠建 committed
206
            text: { ...item },
宋雄's avatar
宋雄 committed
207 208
          }
        }) || []
何忠建's avatar
何忠建 committed
209 210
      this.mapEcharts()
    },
宋雄's avatar
宋雄 committed
211 212 213 214 215 216 217 218 219 220
    toOperation(record, type) {
      if(type === 1) {
        this.$router.push({
          path: '/settled/propertyDetails?type=audit&id=' + record.id,
        })
      } else {
        this.$router.push({
          path: '/settled/communityDetails?type=audit&id=' + record.id,
        })
      }
何忠建's avatar
何忠建 committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
    },
    //地图
    mapEcharts() {
      // 获取地图数据
      // 使用数据注册地图
      echarts.registerMap('china', chinaData)
      this.$nextTick(() => {
        // 初始化地图
        this.map = echarts.init(this.$refs['mapEcharts'])
        // 设置基础配置项
        const option = {
          areaColor: '#97bff7',
          // 悬浮窗
          tooltip: {
            trigger: 'item',
            formatter: function (params) {
              return `物业名称:${params.data.name}</br>统一社会信用代码:${
                params.data.text.creditCode
              }</br>注册地址:${params.data.text.cityName}${params.data.text.countyName}</br>详细地址:${
                params.data.text.addressInfo
              }</br>联系人:${params.data.text.contactName}</br>联系电话:${
                params.data.text.contactPhone
              }</br>授权物业数量:${params.data.text.ontrialCommunityNum || 0}`
宋雄's avatar
宋雄 committed
244
            },
何忠建's avatar
何忠建 committed
245 246 247 248
            borderColor: '#fff',
            textStyle: {
              //color: "#fff",
              fontSize: '13',
宋雄's avatar
宋雄 committed
249
            },
何忠建's avatar
何忠建 committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
          },
          geo: {
            type: 'map',
            map: 'china',
            //height: "100%",
            top: 0,
            width: '50%',
            roam: true,
            zoom: 1,
            scaleLimit: {
              //滚轮缩放的极限控制
              min: 0.6, //最小的缩放值
              max: 20,
            },
            // 地图区域的样式设置
            itemStyle: {
              borderColor: '#fff',
              borderWidth: 1,
              areaColor: '#c1dbff',
            },
          },
          // 要显示的散点数据
          series: [
            {
              name: '社区分布数量图',
              type: 'scatter',
              coordinateSystem: 'geo', //设置坐标系为 geo
              data: this.mapData,
              itemStyle: {
                color: function (params) {
                  //根据不同数据显示不同颜色的标记
                  if (params.data.text.customerAccount >= 100) {
                    return '#67c23a'
                  } else {
                    return '#409eff'
宋雄's avatar
宋雄 committed
285
                  }
何忠建's avatar
何忠建 committed
286 287 288 289 290 291 292 293 294 295 296
                },
              },
            },
          ],
        }
        // 将配置应用到地图上
        this.map.setOption(option)
      })
    },
  },
}
297 298 299
</script>

<style lang="less" scoped>
300
.page-header-index-wide {
宋雄's avatar
宋雄 committed
301
  // padding: 16px;
302 303 304 305 306 307 308 309 310
  .statistics {
    // flex: none;
    background: #fff;
    width: 100%;
    height: 90px;
    box-sizing: border-box;
    border: 1px solid #e0dfdf;
    display: flex;
    align-items: center;
宋雄's avatar
宋雄 committed
311
    justify-content: center;
312 313 314
    .icon {
      margin-right: 12px;
      .anticon {
宋雄's avatar
宋雄 committed
315
        font-size: 36px;
316 317 318 319 320 321 322 323
      }
    }
    span {
      font-size: 14px;
      color: #1890ff;
    }
  }
}
何忠建's avatar
何忠建 committed
324 325 326
.map-box {
  background-color: #fff;
  padding: 20px;
327

何忠建's avatar
何忠建 committed
328 329 330 331 332
  .dealt-with {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: flex;
333

何忠建's avatar
何忠建 committed
334 335
    .box {
      border: 1px solid #f5f5f5;
336 337
    }
  }
何忠建's avatar
何忠建 committed
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
}
.box-title {
  font-weight: bold;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f1f1f1;
}
.wait-box {
  background-color: #fff;
  padding: 20px;
  .content {
    width: 100%;
    //height: 400px;
    max-height: 400px;
    overflow-y: auto;
    .item {
      padding: 10px 15px;
      box-sizing: border-box;
      border-radius: 5px;
      border: 1px solid #f1f1f1;
      width: 31.33%;
      margin: 1%;
      float: left;
      p {
        margin-bottom: 0.4em;
宋雄's avatar
宋雄 committed
363 364 365
      }
    }
  }
何忠建's avatar
何忠建 committed
366
}
367
</style>