<template>
  <div class="page-box" v-loading="Loading.appMainLoading">
    <tablePagination
      :currenButtonData="currenButtonData"
      :tableData="tableData"
      :tableLoading="Loading.tableLoading"
      :tableColumns="tableColumns"
      :totalCount="totalCount"
      :multipleSelection="multipleSelection"
      :MaxResultCount="PageListParams.MaxResultCount"
      @topbutton="topbutton"
      @inlineDialog="inlineDialog"
      @sortChange="sortChange"
      @alertoldSkipCount="alertoldSkipCount"
      @alterResultCount="alterResultCount"
      @handleSelectionChange="handleSelectionChange"
    >
    </tablePagination>
    <!-- 筛选 -->
    <conditionFilters
      :modalAppendToBody="modalAppendToBody"
      :displayDialog="displayDialog"
      :screenData="screenData"
      :tableColumns="tableColumns"
      @screenFormClick="screenFormClick"
      @screenDelete="screenDelete"
      @screenPush="screenPush"
    ></conditionFilters>
    <!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用-->
    <!-- methodValue 导入方式默认选项  是否局部导入 默认选项  -->
    <importFile
      :loading="Loading.importLoading"
      :show="displayDialog.importDialog"
      :URL="URL"
      :disabledMethod = {method1:false,method2:false,method3:false}
      :disabledIsAllowPartImport = {isAllowPartImport1:false,isAllowPartImport2:false}
      methodValue="0"
      isAllowPartImportValue="1"
      @importClick="postImportMergeClick(arguments)"
      @postImportDown="importDown"
    ></importFile>
    <curren-Drawer
      :title="tableColumns"
      :dropdownTabsData="[]"
      :DrawerLoading="Loading.DrawerLoading"
      :drawer="displayDialog.detailsDialog"
      :propsData="propsData"
      :Butttondata="DrawerButtonData"
      :tabsDesTions="tabsDesTions"
      @drawerShut="(val) => (displayDialog.detailsDialog = val)"
      @drawerbutton="drawerbutton"
      @handleCommand="drawerHandle"
      @close-value="closeValue"
      :tableColumns="detailsTableColumns"
      :totalCount="totalCountDetails"
      :MaxResultCount="MaxResultCountDetails"
      @alterResultCountDetails="alterResultCountDetails"
      @alertoldSkipCountDetails="alertoldSkipCountDetails"
    ></curren-Drawer>
  </div>
</template>
<script>
import { materialRequestByType } from '@/api/wms-api'
import { tableMixins } from "@/mixins/TableMixins"
import { LoadingMixins } from "@/mixins/LoadingMixins"
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
import { mixins } from "@/mixins/mixins"
import { requestData } from "@/utils/processButtonData"
export default {
  name: "ProductReceiptScrapRequest",
  mixins: [
    tableMixins,
    LoadingMixins,
    drawerMixins,
    TableHeaderMixins,
    mixins,
  ],
  data () {
    return {
      URL: 'wms/store/scrap-request',
      //常用按钮数据
      currenButtonData: [
        {
          type: "primary",
          icon: "el-icon-refresh",
          label: "刷新",
          name: "refresh",
          size: "mini",
          float: 'right'
        },
        {
          type: "info",
          icon: "el-icon-finished",
          label: "筛选",
          name: "filter",
          size: "mini",
          float: 'right'
        },
        {
          type: "success",
          icon: "el-icon-download",
          label: "导入",
          name: "import",
          size: "mini",
        },
      ],
      DrawerButtonData:[
        ...requestData(this)
      ],
    };
  },
  mounted () {
    this.paging();
  },
  methods: {
    //渲染数据
    paging() {
      this.Loading.tableLoading = true;
      this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
      // 报废请求类型: 人工报废:Scrap_Manual;  线边报废:Scrap_WIP; 完工报废:Scrap_Product
      let params = {
        type: 'Scrap_Product'
      }
      materialRequestByType(this.PageListParams, this.URL + '/by-type', params).then(res => {
        this.tableData = res.items
        this.totalCount = res.totalCount
        this.pagingCallback()
      }).catch(err => {
        this.Loading.tableLoading = false
      })
    }
  },
};
</script>
<style lang="scss" scoped>
@import "../../../styles/basicData.scss";
</style>