<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-audit"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="common-page-shadow">
      <div class="common-search-container" ref="contentPanel">
        <el-form
          ref="form"
          :model="searchForm"
          label-position="right "
          :inline="true"
          type="flex"
          justify="left"
        >
          <el-form-item label="项目名称">
            <el-input
              size="small"
              v-model="searchForm.code"
              clearable
              placeholder="请输入项目名称"
            ></el-input>
          </el-form-item>
        </el-form>
        <div>
          <el-button
            size="small"
            icon="el-icon-search"
            type="danger"
            class="btn btn-plus"
            @click="handleSearch"
          >
            搜索
          </el-button>
          <el-button
            size="small"
            icon="el-icon-refresh-right"
            class="btn btn-plus"
            @click="clearSearchForm"
          >
            重置
          </el-button>
        </div>
      </div>
      <el-row class="common-table-container flex searchPanel">
        <el-col :span="24" class="common-table-wrapper">
          <!-- LJ：表格高度自适应需配合样式  btn-pagenation 有按钮有分页  btngroup只有按钮  pagenation只有分页 -->
          <div class="common-table-content btn-pagenation">
            <el-table
              :border="true"
              stripe
              fit
              size="mini"
              v-loading="tableLoading"
              ref="multipleSelection"
              :data="tableData"
            >
              <el-table-column
                type="index"
                width="55"
                align="center"
                label="序号"
              >
              </el-table-column>
              <el-table-column
                prop="date"
                min-width="20%"
                label="项目名称"
                align="center"
                resizable
              >
              </el-table-column>
              <el-table-column
                prop="name"
                show-overflow-tooltip
                min-width="20%"
                align="center"
                label="销售企业"
                resizable
              >
              </el-table-column>
              <el-table-column
                prop="auctionStartDate"
                show-overflow-tooltip
                min-width="15%"
                align="center"
                label="开始时间"
                resizable
              >
              </el-table-column>
              <el-table-column
                prop="companyName"
                show-overflow-tooltip
                min-width="15%"
                align="center"
                label="结束时间"
                resizable
              >
              </el-table-column>
              <el-table-column min-width="10%" align="center" label="操作">
                <template v-slot="{row}">
                  <template>
                    <el-button
                      type="primary"
                      plain
                      size="small"
                      @click="quoteConfirm(row)"
                      >评标确认</el-button
                    >
                  </template>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="common-pagenation">
            <el-pagination
              ref="paginationPanel"
              background
              :current-page="queryParam.pageBean.page"
              :page-sizes="[20, 30, 40, 50]"
              :page-size="queryParam.pageBean.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="queryParam.pageBean.total"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb/index.vue'
export default {
  name: 'domesticDialog',
  components: {Breadcrumb},
  props: {
    editData: Object
  },
  data() {
    return {
      breadcrumbOpt: [
        {breadcrumbName: '项目采购'},
        {breadcrumbName: '明细列表'}
      ],
      tableData: [
        {
          id: 1,
          quote: 0,
          upset: 1000,
          date: '2016-05-02',
          auctionStatus: 1,
          endStatus: 1,
          auctionStartDate: '2030-01-01 16:00.00',
          endCountdown: '2024-01-01 16:00.00',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          id: 2,
          quote: 0,
          upset: 10000,
          date: '2016-05-04',
          auctionStatus: 1,
          endStatus: 2,
          auctionStartDate: '2030-01-01 16:00.00',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        },
        {
          id: 3,
          quote: 0,
          upset: 100000,
          date: '2016-05-01',
          auctionStatus: 2,
          endStatus: 2,
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        },
        {
          id: 4,
          quote: 0,
          upset: 1000000,
          date: '2016-05-03',
          auctionStatus: 3,
          endStatus: 3,
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ],
      tableLoading: false,
      searchForm: {
        num: 1,
        num1: 1
      }, // 顶部搜索对象
      params: {
        pageBean: {
          page: 1,
          pageSize: 20,
          total: 0
        }
      },
      queryParam: {
        pageBean: {
          page: 1,
          pageSize: 20,
          total: 0
        }
      },
      pageResult: {
        page: 1,
        pageSize: 20,
        total: 0
      }
    }
  },
  created() {
    this.addModifyBtn()
  },
  mounted() {
    this.tableData.forEach(ele => {
      ele.dateTime = {
        dd: '**',
        hh: '**',
        mm: '**',
        ss: '**'
      }
    })
    this.quoteForm = this.tableData[1]
  },
  methods: {
    //评标确认
    quoteConfirm(rows) {
      this.$router.push({
        name: 'procurementProjectConfirm',
        query: {editRows: rows, pageBean: this.params}
      })
    },
    //
    load() {
      // this.loadData()
    },
    //获取列表
    addModifyBtn() {
      console.log(this.$route.query.recordData)
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'calibration',
        params: {
          tabsActiveName: 'procurementProject',
          pageBean: this.$route.query.pageBean
        }
      })
    },
    //重置
    clearSearchForm() {},
    // 顶部搜索
    handleSearch(searchForm) {
      debugger
      let obj = searchForm
      console.log(obj)
      let querys = []
      for (let i in obj) {
        if (obj[i]) {
          querys.push({
            group: 'main',
            operation:
              i == 'name' || i == 'code' || i == 'companyName'
                ? 'LIKE'
                : 'EQUAL',
            parentGroup: '',
            property: i,
            relation: 'AND',
            value: obj[i]
          })
        }
      }
      console.log(querys, 'querys')
      this.params.querys = querys
      console.log(this.params, 'params')
      this.loadData(this.params)
    }
  }
}
</script>

<style lang="scss" scoped>
.common-page-shadow {
  width: 100%;
  height: calc(100% - 40px);
  box-sizing: border-box;
  margin-top: 10px;
  .common-search-container {
    height: 80px;
    div {
      display: flex;
      align-items: center;
    }
  }
  .common-table-container {
    height: calc(100% - 80px);
    .common-table-content {
      height: calc(100% - 60px);
    }
  }
}

.rows {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 16px;
  padding: 10px 0;
  .rows-left {
    margin-right: 10px;
    .rows-hr {
      width: 3px;
      height: 18px;
      background-color: #0e6eff;
      border-radius: 2px;
    }
  }
  .rows-title {
    .text-overflow {
      width: 100%;
      font-size: 16px;
    }
  }
}
</style>
