<template>
  <div class="page-box" v-loading="Loading.appMainLoading">
    <tablePagination
      :currenButtonData="currenButtonData"
      :tableData="tableData"
      :tableLoading="Loading.tableLoading"
      :tableColumns="tableColumns"
      @rowDrop="rowDrop"
      :totalCount="totalCount"
      :multipleSelection="multipleSelection"
      :MaxResultCount="PageListParams.MaxResultCount"
      @topbutton="topbutton"
      @inlineDialog="inlineDialog"
      @sortChange="sortChange"
      @alertoldSkipCount="alertoldSkipCount"
      @alterResultCount="alterResultCount"
      @handleSelectionChange="handleSelectionChange"
      :currentPageProps="oldSkipCount"
      :quicklySearchOption="quicklySearchOption"
      @quicklySearchClick="quicklySearchClick"
      @quicklySearchClear="quicklySearchClear"
      :primarySearchOption="primarySearchOption"
      @overallSearchFormClick="overallSearchFormClick"
      :httpOverallSearchData="httpOverallSearchData"
    >
    </tablePagination>
    <!-- 执行 -->
    <!-- <handelFrom
      :formTitle="formTitle"
      :displayDialog.sync="displayDialog.handleFromDialog"
      :CreateFormData="handleFormData"
      :CreateForm="handleForm"
      :Rules="editRules.handleRule"
      :Options="editOptions"
      :detailsTableColumns="handleDetailsTableColumns"
      @FormSubmit="handleFormSubmit"
    ></handelFrom> -->
    <curren-Drawer
      :title="tableColumns"
      :DrawerLoading="Loading.DrawerLoading"
      :drawer="displayDialog.detailsDialog"
      :propsData="propsData"
      :tabsDesTions="tabsDesTions"
      :Butttondata="DrawerButtonData"
      @drawerShut="(val) => (displayDialog.detailsDialog = val)"
      @drawerbutton="drawerbutton"
      @close-value="closeValue"
      :currenButtonData="currenButtonData"
      :tableColumns="detailsTableColumns"
      :totalCount="totalCountDetails"
      :MaxResultCount="MaxResultCountDetails"
      @alterResultCountDetails="alterResultCountDetails"
      @alertoldSkipCountDetails="alertoldSkipCountDetails"
    ></curren-Drawer>
  </div>
</template>
<script>
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 detailsRules from '@/utils/rules';
export default {
  name: "CountJob",
  mixins: [
    tableMixins,
    LoadingMixins,
    drawerMixins,
    TableHeaderMixins,
    mixins,
  ],
  computed: {
    editDialog: {
      get: function () {
        return this.displayDialog.newDialog || this.displayDialog.editDialog;
      },
    },
    hideButton: function () {
      return function (val) {
        let data = true
        val.forEach(key => {
          if (this.propsData.jobStatus == key) {
            data = false
          }
        })
        return data
      }
    },
  },
  data () {
    return {
      URL: 'wms/store/count-job',
      //常用按钮数据
      currenButtonData: [
        this.defaultExportBtn(),//导出
        this.defaultFieldSettingBtn(),//字段设置
        this.defaultFreshBtn(),//刷新
        this.defaultFilterBtn(),//筛选
      ],
      DrawerButtonData: [
        // {
        //   type: 'primary',
        //   icon: 'el-icon-circle-check',
        //   label: '承接',
        //   name: "accept",
        //   hide: () => { return this.hideButton([1]) },
        //   size: 'mini'
        // },
        // {
        //   type: 'warning',
        //   icon: 'el-icon-circle-check',
        //   label: '执行',
        //   name: "handle",
        //   hide: () => { return this.hideButton([2]) },
        //   size: 'mini'
        // },
        // {
        //   type: 'danger',
        //   icon: 'el-icon-delete-solid',
        //   label: '作废',
        //   name: "invalid",
        //   hide: () => { return this.hideButton([1,2]) },
        //   size: 'mini'
        // }
      ],
      handleDetailsTableColumns: [
        { label: "箱标签", prop: "packingCode", },
        { label: "物品代码", prop: "itemCode", },
        { type: "objectInput", valueType: Number, label: "实际数量", rules: detailsRules.numberInput, prop: "countQty", showProp: "qty", },
        { type: "objectInput", label: "实际单位", prop: "countQty", showProp: "uom", },
        { type: "object", label: "库存数量", prop: "inventoryQty", showProp: "qty", },
        { type: "object", label: "库存单位", prop: "inventoryQty", showProp: "uom", },
        { type: "input", rules: detailsRules.detailsRules, label: "库位代码", prop: "locationCode", },
        { type: "input", rules: detailsRules.detailsRules, label: "包装数量", prop: "stdPackQty", },
        { type: "input", rules: detailsRules.detailsRules, label: "包装单位", prop: "stdPackUom", },
        { label: "物品代码", prop: "itemCode", },
        { label: "物品名称",  prop: "itemName" },
        { label: "供应商批次", prop: "supplierBatch", },
        { label: "备注", prop: 'remark', },
      ],
      editOptions: {},
      // handleFormData: {
      //   "id": "",
      //   "creationTime": "2022-02-17T10:08:36.620Z",
      //   "lastModificationTime": "2022-02-17T10:08:36.620Z",
      //   "remark": "",
      //   "concurrencyStamp": "",
      //   "company": "",
      //   "number": "",
      //   "upStreamJobNumber": "",
      //   "countPlanNumber": "",
      //   "countStage": 1,
      //   "jobType": 1,
      //   "jobStatus": 1,
      //   "priority": 0,
      //   "priorityIncrement": 0,
      //   "wlgCode": "123",
      //   "isAutoComplete": true,
      //   "details": [],
      //   "acceptTime": "2022-02-17T10:08:36.620Z",
      //   "completeTime": "2022-02-17T10:08:36.620Z"
      // },
      // childTableData: [
      //   {
      //     "id": "",
      //     "creationTime": "",
      //     "lastModificationTime": "",
      //     "remark": "",
      //     "concurrencyStamp": "",
      //     "masterID": "",
      //     "packingCode": "",
      //     "containerCode": "",
      //     "item": {
      //       "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      //       "name": "",
      //       "desc1": "",
      //       "desc2": ""
      //     },
      //     "itemCode": "",
      //     "batch": {
      //       "supplierBatch": "",
      //       "produceDate": "2022-02-17T10:08:36.620Z"
      //     },
      //     "lot": "",
      //     "stdPack": {
      //       "packUom": "",
      //       "packQty": 0
      //     },
      //     "locationCode": "",
      //     "inventoryQty": {
      //       "uom": "",
      //       "qty": 0
      //     },
      //     "countQty": {
      //       "uom": "",
      //       "qty": 0
      //     }
      //   }
      // ],
      // handleForm: [
      //   { type: "input", label: "任务编号", prop: "number", colSpan: 12, disabled: "true" },
      //   { type: "select", label: "任务类型", prop: "jobType", options: "taskType", colSpan: 12, disabled: "true" },
      //   { type: "select", label: "任务状态", prop: "jobStatus", options: "jobStatus", colSpan: 12, disabled: "true" },
      //   { type: "input", label: "优先级", prop: "priority", colSpan: 12, disabled: "true" },
      //   { type: "input", label: "工作组", prop: "wlgCode", colSpan: 12, disabled: "true" },
      //   { type: "dateTime", label: "接收时间", prop: "acceptTime", colSpan: 12, },
      //   { type: "input", label: "备注", prop: "remark", colSpan: 12, },
      // ],
    };
  },
  mounted () {
    this.paging();
  },
  methods: {
    //抽屉常用按钮
    // drawerbutton (val) {
    //   if (val == 'accept') {
    //     let data = {
    //       id: this.propsData.id
    //     }
    //     this.Loading.appMainLoading = true
    //     accept(this.URL, data).then(res => {
    //       this.$successMsg('已承接任务！')
    //       this.Loading.appMainLoading = false
    //       getDetailed(this.propsData.id, this.URL).then(res => {
    //         this.propsData = res
    //       })
    //       this.paging();
    //     }).catch(err => {
    //       this.Loading.appMainLoading = false
    //     })
    //   } else if (val == 'handle') {
    //     this.Loading.appMainLoading = true
    //     let propsData = JSON.parse(JSON.stringify(this.propsData));
    //     this.$listAssign(this.handleFormData, propsData)
    //     this.handleFormData.details = []
    //     propsData.details.forEach(item => {
    //       let data = JSON.parse(JSON.stringify(...this.childTableData))
    //       this.$listAssign(data, item)
    //       this.handleFormData.details.push(data)
    //     })
    //     this.Loading.appMainLoading = false
    //     this.formTitle = "执行" + this.$route.meta.title;
    //     this.displayDialog.handleFromDialog = true
    //   }else if(val == 'invalid'){
    //     let data = {
    //       id: this.propsData.id
    //     }
    //     this.Loading.appMainLoading = true
    //     Invalid(this.URL, data).then(res=>{
    //        this.displayDialog.detailsDialog = false
    //        this.$successMsg('已作废任务！')
    //        this.paging()
    //        this.Loading.appMainLoading = false
    //     }).catch(err=>{
    //        this.Loading.appMainLoading = false
    //     })
    //   }
    // },
    // handleFormSubmit (val) {
    //   return new Promise((resolve, reject) => {
    //     let data = {
    //       id: this.propsData.id
    //     }
    //     handle(this.handleFormData, data, this.URL).then(res => {
    //       this.displayDialog.handleFromDialog = false;
    //       this.$successMsg('已生成上架记录！')
    //       getDetailed(this.propsData.id, this.URL).then(res => {
    //         this.propsData = res
    //         // this.displayDialog.detailsDialog = true;
    //       })
    //       this.paging()
    //       this.FormRemove(val)
    //       resolve()
    //     }).catch(err => {
    //       reject();
    //     })
    //   })
    // },
  }
};
</script>
<style lang="scss" scoped>
@import "../../../styles/mainbasicData.scss";
</style>