<template>
  <!-- 供应商采购订单 已出库 -->
  <div class="common-box">
    <el-form :model="listQuery" ref="queryForm" :inline="true">
      <el-form-item label="生产企业" prop="prodEntp">
        <el-input
          v-model="listQuery.prodEntp"
          placeholder="请输入生产企业"
        ></el-input>
      </el-form-item>
      <!-- <el-form-item label="采购时间" prop="docmkDate">
        <el-date-picker
          v-model="listQuery.docmkDate"
          type="daterange"
          range-separator="至"
          :editable="false"
          value-format="yyyy-MM-dd"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
          style="width: 230px"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" @click="getData('search')">查询 </el-button>
        <el-button @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      v-loading="listLoading"
      element-loading-text="加载中"
      :data="list"
      fit
      stripe
      border
    >
      <template slot="empty">
        <img src="@/assets/nopage.png" alt />
        <p>暂无数据</p>
      </template>
      <el-table-column fixed type="index" label="序号" width="60" />
      <el-table-column label="生产企业" prop="prodEntp" />
      <el-table-column label="操作" width="100">
        <template slot-scope="scope">
          <el-button type="text" @click="handleDetail(scope.row)"
            >详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!--分页-->
    <yl-pagination
      v-show="total > 0"
      :total="total"
      :page.sync="listQuery.current"
      :limit.sync="listQuery.size"
      @pagination="getData"
    />
  </div>
</template>

<script>
import ylPagination from "@/components/yl-pagination";
import { selectFacQua } from "@/api/qualityManagement-sup/information-filling";
export default {
  components: {
    ylPagination
  },
  data() {
    return {
      listQuery: {
        current: 1,
        size: 10,
        prodEntp: ""
      },
      stasOptions: [
        { value: "C", lable: "已出库" },
        { value: "D", lable: "部分出库" },
        { value: "Y", lable: "已入库" },
        { value: "P", lable: "部分入库" }
      ],
      dd1: [{ value: 0, name: "订单类型1" }, { value: 1, name: "订单类型2" }],
      listLoading: false,
      list: [],
      total: 0
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData(type) {
      if (type == "search") {
        this.listQuery.current = 1;
      }
      this.listLoading = true;
      selectFacQua(this.listQuery)
        .then(res => {
          this.list = res.data.records;
          this.total = res.data.total;
          this.listLoading = false;
        })
        .catch(err => {
          this.listLoading = false;
        });
    },
    reset() {
      this.$refs.queryForm.resetFields();
      this.getData();
    },
    // 详情
    handleDetail(row) {
      this.$router.push({
        name: "manufacturerDetail",
        query: {
          prodEntp: row.prodEntp
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped></style>
