Newer
Older
smartwell_front / src / views / intelligenceRoom / components / wellLooseness.vue
<template>
  <el-row :gutter="10">
    <el-col :span="12">
      <el-table
        v-loading="listLoading"
        :max-height="maxHeight"
        :data="list"
        class="table"
        border
      >
        <el-table-column
          :index="indexMethod"
          label="序号"
          align="center"
          type="index"
          width="55"
        />
        <el-table-column
          v-for="column in columns"
          :key="column.value"
          :label="column.text"
          :width="column.width"
          :align="column.align"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <span>{{ scope.row[column.value] }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="60"
        >
          <template slot-scope="scope">
            <el-button type="text" @click="detail(scope.row)">
              详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        v-show="total > 10 ? true : false"
        :current-page="query.offset"
        :page-sizes="pageSizes"
        :page-size="query.limit"
        :total="total"
        align="center"
        layout="total, sizes, prev, pager, next"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-col>
    <el-col :span="12">
      <!--地图-->
      <a-map-container
        ref="map"
        :center="center"
        :zoom="zoom"
        :base-layer="baseLayer"
        :style="{height:(bodyHeight-130)+'px'}"
        vid="overview"
        class="map-demo"
        @ready="mapReady"
      />
    </el-col>
  </el-row>
</template>

<script>
import { mapGetters } from 'vuex'
import AMapContainer from '@/components/Amap/AMapContainer'

export default {
  name: 'WellLooseness',
  components: { AMapContainer },
  data() {
    return {
      map: null, // 地图对象
      baseLayer: 'gaode_vec', // 底图图层
      center: [this.$store.getters.lng, this.$store.getters.lat], // 地图中心
      zoom: 12, // 地图缩放比例
      columns: [
        {
          text: '井编号',
          value: 'wellCode',
          align: 'center'
        },
        {
          text: '井名称',
          value: 'wellName',
          align: 'center'
        },
        {
          text: '设备编号',
          value: 'deviceCode',
          align: 'center'
        },
        {
          text: '详细地址',
          value: 'postion',
          align: 'center'
        }
      ], // 显示列
      listLoading: false,
      list: [],
      query: {
        offset: 1,
        limit: 10
      },
      pageSizes: [10, 20, 30],
      total: 0,
      maxHeight: null
    }
  },
  computed: {
    ...mapGetters([
      'bodyHeight'
    ])
  },
  mounted() {
    this.getTableData()
    this.maxHeight = this.bodyHeight - 200
  },
  methods: {
    // 初始化放这里
    mapReady(map) {
      this.map = map
    },
    getTableData() {
      this.list = [
        {
          wellCode: '11222',
          wellName: '321321',
          deviceCode: '34243243',
          postion: 'fdsafdsa'
        },
        {
          wellCode: '11222',
          wellName: '321321',
          deviceCode: '34243243',
          postion: 'fdsafdsa'
        },
        {
          wellCode: '11222',
          wellName: '321321',
          deviceCode: '34243243',
          postion: 'fdsafdsa'
        }
      ]
      this.total = this.list.length
    },
    // 序号计算
    indexMethod(index) {
      return this.query.limit * (this.query.offset - 1) + index + 1
    },
    // 改变页容量
    handleSizeChange(val) {
      this.query.limit = val
    },
    // 改变当前页
    handleCurrentChange(val) {
      this.query.offset = val
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.table{
  margin-bottom: 20px;
}
// 地图
.map-demo{
  width: 100%;
  .svg-icon{
    width: 20px;
    height: 20px;
  }
  .alarm-icon{
    width: 29px;
    height: 30px;
  }
  .nomal-info-window{
    background-color: pink;
  }

}
</style>