<template>
  <basic-container>
    <el-tabs v-model="tabPosition" class="demo-tabs" @tab-change="tabPositionChange">
      <el-tab-pane label="调拨领料" name="materialRequisition"></el-tab-pane>
      <el-tab-pane label="库房调整" name="warehouseAdjustment"></el-tab-pane>
      <el-tab-pane label="库转移" name="vaultTransfer"></el-tab-pane>
      <el-tab-pane label="调拨入库" name="transferEntry"></el-tab-pane>
    </el-tabs>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model="form"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu-left>
        <el-button type="primary" v-if="tabPosition == 'materialRequisition'"
          >批量打印领料清单</el-button
        >
        <el-button type="primary" v-if="tabPosition == 'warehouseAdjustment'">导出</el-button>
        <el-button type="primary" v-if="tabPosition == 'warehouseAdjustment'" @click="handleImport">导入</el-button>
      </template>
      <template #boCode="{ row }">
        {{ row.pvPurchaseTracking.buyOrder.boCode }}
      </template>
      <template #goodsCode="{ row }">
        {{ row.pvPurchaseTracking.goods.goodsCode }}
      </template>
      <template #goodsName="{ row }">
        {{ row.pvPurchaseTracking.goods.goodsName }}
      </template>
      <template #trademark="{ row }">
        {{ row.pvPurchaseTracking.goods.trademark }}
      </template>
      <template #specifications="{ row }">
        {{ row.pvPurchaseTracking.goods.specifications }}
      </template>
      <template #unitName="{ row }">
        {{ row.pvPurchaseTracking.goods.unitName }}
      </template>
      <template #userName="{ row }">
        {{ row.pvPurchaseTracking.createUser.userName }}
      </template>
      <template #buyQuantity="{ row }">
        {{ row.pvPurchaseTracking.buyQuantity }}
      </template>
      <template #deliveryDate="{ row }">
        {{ row.pvPurchaseTracking.deliveryDate }}
      </template>
    </avue-crud>
     <!-- 导入 -->
    <basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
      templateUrl="/blade-desk/QA/CycleTestItem/download-excel-template"
      templateName="试验项目模板.xls"
      importUrl="/blade-desk/QA/CycleTestItem/import-excel"
     @closeDialog="closeDialog"></basic-import>
  </basic-container>
</template>

<script>
import allocationManage from './js/allocationManage';
import basicImport from '@/components/basic-import/main.vue';
export default {
  components: {
    basicImport,
  },
  data() {
    return {
        isShowImport: false,
      tabPosition: 'materialRequisition',
      data: [],
      option: {
        columnSort: true,
        tip: false,
        height: 'auto',
        align: 'center',
        calcHeight: 32,
        simplePage: false,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: false,
        selection: true,
        viewBtn: false,
        delBtn: false,
        editBtn: false,
        addBtn: false,
        labelWidth: 120,
        searchLabelWidth: 120,
        menu: true,
        menuWidth: 200,
        dialogWidth: 600,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: true,
        gridBtn: false,
        searchShowBtn: false,
        showOverflowTooltip: true,
        searchLabelPosition: 'left',
        searchLabelPosition: 'left',
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: 'left',
        gridBtn: false,
        searchMenuPosition: 'right',
        addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        column: [],
      },
      loading: false,
      form: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
    };
  },
  mounted() {
    this.option.column = allocationManage[this.tabPosition];
  },
  methods: {
    // 点击导入按钮
    handleImport() {
      this.isShowImport = true
    },
    tabPositionChange(val) {
      if (val == 'warehouseAdjustment') {
        this.option.menu = false;
      }
      this.option.column = allocationManage[this.tabPosition];
    },
    onLoad() {},
  },
};
</script>

<style></style>
