<template>
  <div class="app-container">
    <div class="rightCont">
      <el-form label-width="50px">
        <el-col :span="5">
          <el-form-item label="名称：" label-width="110px">
            <el-input v-model="form.FIRERESOURCES_NAME" style="width:206px" placeholder="请输入内容"/>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="10px">
            <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
              搜索
            </el-button>
            <el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
              重置
            </el-button>
          </el-form-item>
        </el-col>
      </el-form>
      <div>
        <el-table
          v-loading="listLoading"
          ref="multipleTable"
          :data="varList"
          :row-key="getRowKey"
          border
          tooltip-effect="dark"
          style="width: 100%">
          <el-table-column type="selection" width="55" align="center"/>
          <el-table-column type="index" label="序号" width="55" align="center"/>
          <el-table-column prop="FIRERESOURCES_NAME" label="名称"/>
          <el-table-column prop="FIRERESOURCES_TYPENAME" label="消防资源类型"/>
          <el-table-column prop="LONGTITUDE" label="消防资源经纬度">
            <template slot-scope="{row}">
              {{ row.LONGTITUDE }} -- {{ row.LATITUDE }}
            </template>
          </el-table-column>
          <el-table-column prop="CREATIME" label="创建时间"/>
        </el-table>
        <div class="page-btn-group">
          <div>
            <el-button @click="getBack">返回</el-button>
          </div>
          <pagination
            :total="total"
            :page.sync="listQuery.page"
            :limit.sync="listQuery.limit"
            @pagination="getList()"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Pagination from '@/components/Pagination'
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
import SelectTree from '@/components/SelectTree'
import TiandiMap from '../../../../components/TianMap/TiandiMap'

export default {
  components: { Pagination, SelectTree, TiandiMap },
  directives: { waves },
  inject: ['setActiveName', 'getInfo', 'setInfo'],
  data() {
    return {
      config: config,
      firekzsImgs: [],
      waitForDeleteImgs: [],
      dialogImageUrl: '',
      dialogVisible: false,
      dialogFormMap: false,
      map: null,
      corpList: [],
      marker: null,
      describeList: [
        {
          code: '',
          palce: '',
          name: '',
          type: '',
          corp: '',
          ramake: ''
        }
      ],
      addBtnType: true,
      FIRE_RESOURCES_TYPE: '',
      listLoading: true,
      form: {
        FIRERESOURCES_NAME: '',
        FIRERESOURCES_TYPE: 'xfsy01',
        CORPINFO_ID: ''
      },
      diaLoading: false,
      LONGTITUDE: '', // 经度
      LATITUDE: '', // 纬度
      treeData: [],
      typeData: [],
      listQuery: {
        page: 1,
        limit: 20
      },
      ls: [],
      dates: [],
      total: 0,
      KEYWORDS: '',
      // 树形菜单
      varList: []
    }
  },
  created() {
    this.form.CORPINFO_ID = this.getInfo().CORPINFO_ID
    this.getList()
  },
  methods: {
    getRowKey(row) {
      return row.FIRE_DEVICE_ID
    },
    getQuery() {
      this.getList()
    },
    // 获取列表
    getList() {
      this.listLoading = true
      this.varList = []
      requestFN(
        '/fireResources/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page, this.form
      ).then((data) => {
        this.listLoading = false
        this.varList = data.varList
        this.total = data.page.totalResult
        this.hasButton()
      }).catch((e) => {
        this.listLoading = false
      })
    },
    goKeyReset() {
      this.form.FIRERESOURCES_NAME = ''

      this.getList()
    },
    getBack() {
      this.setActiveName('List')
    }
  }
}
</script>

<style scoped>
.returnBtn {
  float: right;
}

.app-container {
  display: flex; /**/
  align-items: baseline;
}

.rightCont {
  width: 100%
}

#map {
  width: 1000px;
  height: 500px;
}
</style>
