<template>
  <div class="batchApproveOutbound">
    <div class="top">
      <el-form :inline='true'>
        <!-- 查询按钮 -->
        <el-button icon="el-icon-search" type="primary" size="mini" @click="searchData">查询</el-button>
        <el-button icon="el-icon-circle-plus-outline" type="goon" size="mini" @click="confirmData">审批</el-button>
      </el-form>
    </div>
    <div class="main common-table-div" style="margin-bottom:0;margin-top:0">
      <el-table v-loading="dataLoading4" ref="dataTable4" border :height="height_bot" highlight-current-row
        @selection-change="handleSelectionChange4" :data="table.list" :icore-filter-flag="icoreFilterFlag"
        :header-cell-style="tableHeaderCellStyle" :cell-class-name="tableRowClassName4" @row-click="getRowCheck3"
        :exchangeFilterMap="{ 'validFlag': { '0': '已停用', '1': '已启用' }, }">
        <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
        <el-table-column type="selection" width="55" fixed="left" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" label="数据状态" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.validFlag == 0">无效</span>
            <span v-else-if="scope.row.state == 1">已审批</span>
            <span v-else-if="scope.row.state == 0">待审批</span>
            <span v-else-if="scope.row.state == 2">已发放</span>
          </template>
        </el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="outId" label="出库记录号"
          align="center"></el-table-column>
        <!-- <el-table-column sortable width="100px" prop="hetongName" label="出库单号" align="center"></el-table-column> -->
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="stuffNo" label="物品编码"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="strNo" label="库房名称"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffName" label="物品名称"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffUnit" label="计量单位"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="outstkType" label="出库类型"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="qtyOutstk" label="出库数量"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="merchName" label="供应商"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="outstkApp" label="出库申请人"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="outstkHnd" label="出库审批人"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="outstkTime" label="出库时间"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="memo1" label="出库发放人"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="memo2" label="出库发放时间"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="stkId" label="库存记录号"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" label="是否有效" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.validFlag == 1">已启用</span>
            <span v-else-if="scope.row.validFlag == 0">已停用</span>
          </template>
        </el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="createMan" label="创建人"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="createTime" label="创建时间"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="updateMan" label="更新人"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="updateTime" label="更新时间"
          align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="memo" label="备注"
          align="center"></el-table-column>
      </el-table>
    </div>

  </div>
</template>
<script>
export default {
  data() {
    return {
      table: {
        list: [],
      },
      page4: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      dataLoading4: false
    }
  },
  created() {
  },
  mounted() {
    this.getDataList();
  },
  methods: {
    getDataList(stuffNo) {
      this.dataLoading4 = true;
      let startTime = ''
      let endTime = ''
      if (!this.search1.time) {
        startTime = null
        endTime = null
      } else {
        startTime = this.search.time[0] + ' 00:00:00'
        endTime = this.search.time[1] + ' 23:59:59'
      }
      if (stuffNo === null || stuffNo === '') {
        this.table.list = [];
        this.dataLoading4 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstuffos/' + '?pageNum=' + this.page4.pageNum + '&pageSize=' + this.page4.pageSize + '&stuffNo=' + stuffNo + '&startTime=' + startTime + '&endTime=' + endTime)
          .then(res => {
            this.dataLoading4 = false;
            this.table.list = res.data.list;
            this.page4.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading4 = false;
          });
      }
    },
    pageSizeChange4(size) {
      this.page4.pageSize = size;
      this.getDataList4();
    },
    pageCurrentChange4(index) {
      this.page4.pageNum = index;
      this.getDataList4();
    },
    handleSelectionChange4(val) {
      this.multipleSelection6 = val;
    },
  }
}
</script>
<style lang="scss" scoped>
.batchApproveOutbound {}
</style>
