Newer
Older
CloudBrainNew / src / views / mapViews / components / communityInfo.vue
dutingting 5 days ago 3 KB 各场所分布、物联网
<template>
  <!-- <div> -->
    <div class="bottom" >
      <!-- <i class="el-icon-close close-pop" @click="$emit('close')" /> -->
      <div class="block">
        <div class="title">各类型案件数</div>
        <div class="chart-wrapper">
          <colorful-bar-chart
            id="communityInfo1"
            :unit="options.unit"
            :height="options.height"
            :xAxisData="options.barXData"
            :seriesData="options.barYData"
          />
        </div>
      </div>
      <div class="block">
        <div class="title">各年份案件数</div>
        <div class="chart-wrapper">
          <gradient-line-chart
            id="communityInfo2"
            :unit="options.unit"
            :height="options.height"
            :legend="options.xAxisData"
            :xAxisData="options.lineXData"
            :seriesData="options.lineYData"
          />
        </div>
      </div>
    </div>
  <!-- </div> -->
</template>

<script>
// import { showPositin } from '@/utils/freedo/index'
import ColorfulBarChart from '@/components/barChart/colorfulBarChart'
import GradientLineChart from '@/components/lineChart/gradientLineChart'
import { fetchCommunityInfo } from '@/api/map'
export default {
  name: 'tcyPopup',
  components: {GradientLineChart, ColorfulBarChart},
  data () {
    return {
      options: {
        id: 'case_line1',
        height: '100%',
        width: '100%',
        unit: '个',
        barXData: [],
        barYData: [],
        lineXData: [],
        lineYData: [
          // {name: '案件总数', data: [120, 252, 101, 134, 290, 230, 110], color: '255,45,85'},
          // {name: '处理数', data: [110, 222, 91, 82, 278, 200, 91], color: '0,144,255'}
        ]
      },
      titleImg: require('@/assets/images/popup/title.png'), // 背景图片
      titleAll: require('@/assets/images/popup/title-all.png'), // 背景图片
      list: ['', '', '', ''],
      tcyInfo: {},
      windowPostion: { x: window.innerWidth - 165, y: window.innerHeight }, // 弹窗的位置
      statusColor: {
        1: '#a1a1a1',
        2: '#f8e31a',
        3: '#5ab1fc',
        4: '#f89835',
        5: '#3def83'
      },
      urgencyColor: {
        'C': '#2f8d00',
        'B': '#c4ad00',
        'A': '#8d0000'
      },
      heightDict: {
        normal: '135px',
        video: '300px'
      }
    }
  },
  methods: {
    initData () {
      console.log('请求社区信息数据')
      fetchCommunityInfo().then(res => {
        if (res.code === 200) {
          this.options.barXData = res.data.xBar
          this.options.barYData = res.data.yBar
          this.options.lineXData = res.data.xLine
          this.options.lineYData = res.data.yLine
          console.log('xBar', this.options.barXData)
          console.log('barYData', this.options.barYData)
          console.log('lineXData', this.options.lineXData)
          console.log('lineYData', this.options.lineYData)
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.bottom {
  z-index: 111111111111;
  width: 720px;
  height: 250px;
  position: absolute;
  bottom: 10px;
  left: 0px;
  display: flex;
  // overflow: hidden;
  // padding: 0px 0px;
  gap: 10px; /* 新增:两个盒子之间的间距 */
  padding: 0 5px;
  box-sizing: border-box; /* 新增:避免padding增加总宽度 */

  .block {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    // flex-wrap: wrap;
    background: linear-gradient(to top left, rgba(5, 30, 61, 0.62), #0D3F7E9D);
    border-radius: 5px;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    // margin: 0px 5px;
    margin: 0; /* 移除原margin,用gap控制间距 */
  }
  .chart-wrapper {
    flex: 1;
    // padding: 0.1rem;
    box-sizing: border-box; /* 关键:padding不增加实际高度 */
  }
  .title {
    text-shadow: 0 0 5px #d1ffff;
    color: white;
    font-weight: bold;
    padding-top: 4px;
    padding-left: 16px;
    font-family: 黑体;
    letter-spacing: 1px;
  }
}
</style>