<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div class="searchInput" style="width: 250px; margin-bottom: 10px">
          <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
            style="display: inline-block; width: 225px; height: 30px" placeholder="项目名称" v-model="msg.CarrierName"
            size="small" clearable>
          </el-input>
          <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
              color: #979dad;
              font-size: 14px;
              position: relative;
              top: 1px;
            "></span>
        </div>
        <div class="searchInput" style="width: 250px; margin-bottom: 10px">
          <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
            style="display: inline-block; width: 225px; height: 30px" placeholder="开发商" v-model="msg.Developers"
            size="small" clearable>
          </el-input>
          <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
              color: #979dad;
              font-size: 14px;
              position: relative;
              top: 1px;
            "></span>
        </div>
      </el-col>
    </el-row>
    <el-table :data="dataList" ref="multipleTable" @selection-change="handleSelectionChange" tooltip-effect="dark" height="450" style="width: 100%">
      <el-table-column type="selection" width="50px">
      </el-table-column>
      <el-table-column label="项目名称" prop="CarrierName"></el-table-column>
      <el-table-column prop="CarrierMetroList" label="地铁信息" width="200">
        <template slot-scope="scope">
          <div v-for="(item, index) in scope.row.CarrierMetroList" :key="index" class="CarrierList">
            <span>{{ item.MetroNum }}号线</span><span>{{ item.MetroName }}</span><span>{{ item.Distance }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="Logo" width="100" label="logo">
        <template slot-scope="scope">
          <el-image :src="scope.row.Logo" style="width: 50px" :preview-src-list="scope.row.LogoList">
          </el-image>
        </template>
      </el-table-column>
      <el-table-column prop="Address" width="200" label="项目地址">
      </el-table-column>
      <el-table-column prop="Developers" width="200" label="开发商">
      </el-table-column>
      <el-table-column prop="OpenTime" width="180" label="开业时间">
      </el-table-column>
    </el-table>
    <el-pagination style="text-align:center" background @current-change="handleCurrentChange" :page-size="msg.pageSize"
      layout="prev, pager, next" :total="total">
    </el-pagination>
  </div>
</template>
<script>
  export default {
    props: ['ckGoods', "IsGetSpec"],
    data() {
      return {
        dataList: [],
        msg: {
          MetroName: "", //地铁站名称
          pageIndex: 1,
          pageSize: 15,
          CarrierName: "", //载体名称
          MetroNum: "", //地铁线路
          Developers: "", //开发商
          StartOpenTime: "", //开业开始时间
          EndOpenTime: "", //	开业截止时间
          ExcelEnumIds: [],
          UserId: 0,
        },
        total: 0,
        selectRow:[]
      };
    },
    created() {},
    methods: {
      //获取所有菜单
      getList() {
        this.loading = true;
        this.apipost("/api/Trade/GetCarrierPageList", this.msg, (res) => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.total = res.data.data.count;
            let pageData = res.data.data.pageData;
            this.dataList = pageData;
            this.dataList.forEach((x) => {
              x.LogoList = [];
              x.LogoList.push(x.Logo);
            });
          }
        });
      },
      handleCurrentChange(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
      //父组件调用方法
      getChoicedGoods() {
        return this.selectRow;
      },
      handleSelectionChange(val) {
        this.selectRow = JSON.parse(JSON.stringify(val));
      },
      //清空多选方法
      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      }
    },
    mounted() {
      this.getList();
    }
  };

</script>
