<template>
  <div class="routerWapper">
		<div v-if="$route.name =='shebeiKanyan'" class="portalDetailWapper">
		  <div class="portalDetailContentWapper">
        <div class="portalDetailTitle">
          <span class="title">设施设备(勘验)详情</span>
			    <div class="detailOperations">
				  <a-button @click="handleReturn"> 返回 </a-button>
			  </div>
		   </div>
        <div class="portalDetailContentBody" >
          <template >
                   <!-- 基础信息 -->
            <div class="layoutMargin detailsPartSection">
              <p id="basic" class="detailsPartTitle">基础信息</p>
              <div style="margin:0 16px;">
                <a-row type="flex" justify="start">
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"小区名称"' :text='$route.query.communityName'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"供水消防总泵数量"' :text='baseInfo.firePumpsNum'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"供水消防总泵维保单位"' :text='baseInfo.firePumpsServiceUnit'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"供水生活总泵数量"' :text='baseInfo.lifeWaterPumpsNum'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"供水生活总泵维保单位"' :text='baseInfo.lifeWaterPumpsServiceUnit'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"生活垃圾库房数量"' :text='baseInfo.lifeRubbishNum'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"建筑垃圾库房数量"' :text='baseInfo.buildingRubbishNum'></DetailsItem>
                  </a-col>
                  <a-col span="8">
                    <DetailsItem :labelSpan='12' :textSpan="12" :label='"监控主控室位置"' :text='baseInfo.monitorControlRoomAddr'></DetailsItem>
                  </a-col>
                </a-row>
              </div>
            </div>
            <div class="layoutMargin detailsPartSection">
              <p id="basic" class="detailsPartTitle">大门列表</p>
              <div style="margin:0 16px;">
                <a-table
                  class="portalTable"
                  size="small"
                  row-key="id"
                  :pagination="pagination"
                  :columns="damen"
                  :dataSource="damenList"
                  />
              </div>
            </div>
            <div class="layoutMargin detailsPartSection">
              <p id="basic" class="detailsPartTitle">电梯列表</p>
              <div style="margin:0 16px;">
                <a-table
                  class="portalTable"
                  size="small"
                  row-key="id"
                  :pagination="pagination_ele"
                  :columns="dianti"
                  :dataSource="diantiList"
                  />
              </div>
            </div>

          </template>
        </div>
      
		  </div>
		</div>
    <RouterWapper v-else />
  </div>
</template>

<script>
export default {
  name: 'shebei',
  data() {
    return {
      baseInfo: {},
      febInfo: {},
      tabList: [
        {
          name: '大门信息',
          key: '大门'
        },
        {
          name: '防盗门信息',
          key: '防盗门'
        },
        {
          name: '电梯信息',
          key: '电梯'
        },
        {
          name: '监控设备信息',
          key: '监控设备'
        },
        {
          name: '消防泵、生活泵信息',
          key: '消防泵、生活泵'
        },
      ],
      // 大门
      damen: [
        {
          title: '位置',
          // width: 240,
          dataIndex: 'position',
          key: 'position',
          width: '20%',
          align: 'center',

        },
        {
          title: '类型',
          dataIndex: 'type',
          align: 'center',
          key: 'type',
          width: '20%'
        },
        {
          title: '是否是主出入口',
          dataIndex: 'isMain',
          align: 'center',
          key: 'isMain',
          width: '10%'

        },
        {
          title: '是否有门卫室',
          align: 'center',
          dataIndex: 'haveGuardRoom',
          key: 'haveGuardRoom',
          width: '10%'

        },
      ],
      damenList: [],
      // dianti
      dianti: [
        {
          align: 'center',
          title: '设备注册码',
          dataIndex: 'elevatorId',
          key: 'elevatorId',
          width: '10%'
        },
        {
          align: 'center',
          title: '安装位置',
          dataIndex: 'elevatorInstallAddr',
          key: 'elevatorInstallAddr',
          width: '10%'
        },
        {
          align: 'center',
          title: '设备类型',
          dataIndex: 'elevatorType',
          key: 'elevatorType',
          width: '7%'
        },

        {
          align: 'center',
          title: '启用日期',
          dataIndex: 'startUsedDate',
          key: 'startUsedDate',
          width: '8%'
        },
        {
          align: 'center',
          title: '单位内编号',
          dataIndex: 'elevatorUnitInnerNo',
          key: 'elevatorUnitInnerNo',
          width: '8%'
        },

        {
          align: 'center',
          title: '品牌',
          dataIndex: 'elevatorBrand',
          key: 'elevatorBrand',
          width: '6%'

        },
        {
          align: 'center',
          title: '型号',
          dataIndex: 'elevatorModel',
          key: 'elevatorModel',
          width: '6%'

        },

        {
          align: 'center',
          title: '位置码',
          dataIndex: 'elevatorAddrNo',
          key: 'elevatorAddrNo',
          width: '5%'
        },

        {
          align: 'center',
          title: '维保单位',
          dataIndex: 'elevatorServiceUnit',
          key: 'elevatorServiceUnit',
          width: '12%'

        },
        {
          align: 'center',
          title: '救援电话',
          dataIndex: 'elevatorHelpTel',
          key: 'elevatorHelpTel',
          width: '8%'

        },
      ],
      diantiList: [],
     
      pagination_ele: {
        pageNo: 1,
        pageSize: 10,
        total: 0,
        current: 1,
        defaultCurrent: 10,
        showQuickJumper: true,
        showTotal: total => `总条数: ${total}`,
        onChange: this.ELEpageChange
      },
      pagination: {
        pageNo: 1,
        pageSize: 10,
        total: 0,
        current: 1,
        defaultCurrent: 10,
        showQuickJumper: true,
        showTotal: total => `总条数: ${total}`,
        onChange: this.pageChange
      },
      tableData: [ ]
    }
  },
  created () {
    this.get_ELE_list()
    this.get_gate_list()
    this.get_info()
  },
  computed: {
  
  },
  mounted() {
    if(this.$route.name == 'shebei'){
      this.$nextTick(function () {
        this.getSearchParams()
      })
    }
  },
  methods: {
    pageChange(page){ //分页切换
      this.pagination.pageNo = page
      this.pagination.current = page
      this.get_ELE_list()
    },
    ELEpageChange(page){ //分页切换
      this.pagination_ele.pageNo = page
      this.pagination_ele.current = page
      this.get_ELE_list()
    },
    handleReturn() {
      this.$router.back()
    },
    // 获取基础信息
    get_info(){
      this.$ajax.get({
        url: this.$api.GET_base_KANYAN_INFO,
        params: {
          pageNo: 1,
          pageSize: 1,
          sectId: this.$route.query.id
        }
      }).then(res => {
        let data = this.$com.confirm(res, 'data.content', []) 
        this.baseInfo = data[0]
      })
    },
    // 获取电梯信息
    get_ELE_list(){
      this.$ajax.get({
        url: this.$api.GET_ELE_KANYAN_LIST,
        params: {
          pageNo: this.pagination_ele.pageNo,
          pageSize: this.pagination_ele.pageSize,
          sectId: this.$route.query.id
        }
      }).then(res => {
        let data = this.$com.confirm(res, 'data.content', []) 
        this.diantiList = data
        this.pagination_ele.total = this.$com.confirm(res, 'data.totalRows', 0) 
      })
    },
    // 获取大门信息
    get_gate_list(){
      this.$ajax.get({
        url: this.$api.GET_GATE_KANYAN_LIST,
        params: {
          pageNo: this.pagination.pageNo,
          sectId: this.$route.query.id,
          pageSize: this.pagination.pageSize,
        }
      }).then(res => {
        let data = this.$com.confirm(res, 'data.content', []) 
        this.damenList = data
        this.pagination.total = this.$com.confirm(res, 'data.totalRows', 0) 
      })
    },
   
  },
}
</script>

<style scoped>

</style>
