<template>
    <div class="mod-axis__caLoudong}">
      <el-card>
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
          <el-form-item label="楼宇名称" prop="buildingName" >
            <el-input v-model="dataForm.buildingName" placeholder="楼宇名称" clearable></el-input>
          </el-form-item>
          <el-form-item label="小区（单位）名称" prop="communityName" >
            <el-input v-model="dataForm.communityName" placeholder="小区（单位）名称" clearable></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="getDataList()">{{ $t('query') }}</el-button>
          </el-form-item>
          <!-- <el-form-item>
            <el-button v-if="$hasPermission('axis:caResident:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
          </el-form-item>
          <el-form-item>
            <el-button v-if="$hasPermission('axis:caResident:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
          </el-form-item> -->
        </el-form>
      </el-card>
      <el-card shadow="never" class="aui-card--fill">
        <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%">
          <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
          <el-table-column prop="buildingName" label="楼宇名称" header-align="center" align="center"></el-table-column>
          <el-table-column prop="buildingUse" label="用途分类" header-align="center" align="center"></el-table-column>
          <el-table-column prop="buildingAddr" label="所处位置" header-align="center" align="center" :show-overflow-tooltip="true" ></el-table-column>
          <el-table-column prop="communityName" label="小区（单位）名称" header-align="center" align="center" :show-overflow-tooltip="true" ></el-table-column>
          <el-table-column prop="layerCount" label="楼层数" header-align="center" align="center"></el-table-column>
          <el-table-column prop="unitCount" label="单元数" header-align="center" align="center"></el-table-column>
          <el-table-column prop="roomCount" label="总房屋数" header-align="center" align="center"></el-table-column>
          <el-table-column prop="elevatorCount" label="电梯数量" header-align="center" align="center"></el-table-column>
          <el-table-column prop="buildingPmc" label="物业公司" header-align="center" align="center"></el-table-column>
          <el-table-column :label="$t('handle')" fixed="right" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" class="div-table-button--detail" size="small" @click="addOrUpdateHandle(scope.row.buildingId)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="limit"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle">
        </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
        <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
      </el-card>
    </div>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './caloudong-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/opendata/caLoudong/getPage',
        getDataListIsPage: true,
        deleteURL: '',
        deleteIsBatch: true
      },
      dataForm: {
        buildingName: '',
        communityName: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
