<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      @submit.native.prevent
    >
      <el-form-item label="企业名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入企业名称"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所属站点" prop="tenant_id" v-if="is_super">
        <SiteOptions v-model="queryParams" />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="数据编号" prop="id" align="center" />
      <el-table-column label="想合作企业名称" prop="title" align="center" />
      <el-table-column label="企业名称" prop="title" align="center" />
      <el-table-column label="所属产品" prop="local" align="center" />
      <el-table-column label="联系方式" prop="is_multiple" align="center" />
      <el-table-column label="所属站点" prop="area" align="center" />
      <el-table-column label="创建时间" prop="created_at" align="center">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.created_at) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleExamine(scope.row.id)"
            >查看归属需求</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page_num"
      :limit.sync="queryParams.page_size"
      @pagination="getList"
    />
  </div>
</template>
<script>
import {} from "@/api/website/siteSet";
export default {
  data() {
    return {
      is_super: this.$store.getters.is_super,
      loading: true,
      queryParams: {
        title: undefined,
        mode: undefined,
        tenant_id: undefined,
        page_num: 1,
        page_size: 10,
      },
      total: 0,
      dataList: [],
    };
  },
  methods: {
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleQuery() {
      this.queryParams.page_num = 1;
      this.getList();
    },
    getList() {
      this.loading = true;
      this.dataList = [1];
      this.total = 15;
      this.loading = false;
      // bannerList(this.queryParams).then((res) => {
      //   this.dataList = res.data.data;
      //   this.total = res.data.count;
      //   this.loading = false;
      // });
    },
    handleExamine(id) {
      this.$router.push({
        path: "/innovateDemand/enterpriseThinkDetail",
        query: { id },
      });
    },
  },
  created() {
    this.getList();
  },
};
</script>