<template>
  <div class="app-container">
    <el-card>
      <span>项目名称:</span>
      <el-select v-model="projectValue" style="width:200px" placeholder="请选择" size="small" clearable filterable>
        <el-option
          v-for="item in project"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>
      <el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="searchProject()">查询</el-button>
    </el-card>

    <el-card style="margin-top: 15px">
      <el-table
        :data="tableData1"
        style="width: 100%"
        height="440"
        size="mini"
        show-summary
        stripe
        border>
        <el-table-column align="center" label="序号" type="index"/>
        <el-table-column align="center" label="项目名称">
          <template slot-scope="scope">
            {{ scope.row.项目名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料名称">
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料规格">
          <template slot-scope="scope">
            {{ scope.row.物料规格 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料型号">
          <template slot-scope="scope">
            {{ scope.row.物料型号 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="小计(元)" prop="小计">
          <template slot-scope="scope">
            {{ scope.row.小计 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="单价">
          <template slot-scope="scope">
            {{ scope.row.单价 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="领用数量">
          <template slot-scope="scope">
            {{ scope.row.出库数量 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="领用时间">
          <template slot-scope="scope">
            {{ scope.row.出库时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { initProject, searchReceiveCheck } from '@/api/PurchasingCenter/ReceiveCheck'
export default {
  data() {
    return {
      projectValue: '', // 项目名称
      project: [],
      tableData1: [],
      check1: '',
      pageCurrent: 1,
      pageSize: 10,
      total: 0,
      form: {
        项目名称: '',
        物料名称: '',
        物料规格: '',
        物料型号: '',
        数量: '',
        单价: '',
        小计: ''
      }

    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
    },
    searchProject() { // 查询
      if (!this.projectValue) {
        this.$message.error('请选择项目')
      } else {
        searchReceiveCheck(1, this.projectValue).then(response => {
          this.tableData1 = response.data
        })
      }
    }
  }
}
</script>

<style scoped>

</style>
