<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">上架任务号</label>
        <el-input v-model="query.putAwayNo" clearable placeholder="上架任务号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">上架类型</label>
        <el-input v-model="query.putAwayType" clearable placeholder="上架类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">上架请求日期</label>
        <el-input v-model="query.requestDate" clearable placeholder="上架请求日期" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="主键id">
            <el-input v-model="form.id" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架任务号" prop="putAwayNo">
            <el-input v-model="form.putAwayNo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架类型">
            <el-input v-model="form.putAwayType" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架任务行号">
            <el-input v-model="form.putAwayLine" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架请求日期">
            <el-date-picker v-model="form.requestDate" type="datetime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="仓库编号">
            <el-input v-model="form.warehouse" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="库区编号">
            <el-input v-model="form.zone" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收货任务号">
            <el-input v-model="form.receiveOrderNo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收货任务行号">
            <el-input v-model="form.receiveOrderLine" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="订单公司">
            <el-input v-model="form.purchaseOrderCo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="订单类型">
            <el-input v-model="form.purchaseOrderType" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="采购订单号">
            <el-input v-model="form.purchaseOrderNo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="采购订单行号">
            <el-input v-model="form.purchaseOrderLine" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="配送任务号">
            <el-input v-model="form.deliveryNo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="采购订单日期">
            <el-input v-model="form.purchaseOrderDate" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收货日期">
            <el-input v-model="form.receiveDate" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="供应商编号">
            <el-input v-model="form.supplier" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="供应商名称">
            <el-input v-model="form.supplierName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="商品编码">
            <el-input v-model="form.sku" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="商品名称">
            <el-input v-model="form.skuDesc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="商品单位">
            <el-input v-model="form.jdeUom" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="状态">
            <el-input v-model="form.status" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架数量">
            <el-input v-model="form.quantity" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="已上架数量">
            <el-input v-model="form.qtyComplete" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="from库位">
            <el-input v-model="form.locationFrom" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="from批次">
            <el-input v-model="form.lotFrom" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="to库位">
            <el-input v-model="form.locationTo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="to批次">
            <el-input v-model="form.lotTo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上一状态">
            <el-input v-model="form.lastStatus" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="下一状态">
            <el-input v-model="form.nextStatus" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架日期">
            <el-input v-model="form.putAwayDate" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架员">
            <el-input v-model="form.staffPutAway" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架员名称">
            <el-input v-model="form.staffPutAwayName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收货员">
            <el-input v-model="form.staffReceive" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收货员名称">
            <el-input v-model="form.staffReceiveName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="是否预收">
            <el-input v-model="form.isPre" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="扩展字段1">
            <el-input v-model="form.reservedField01" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="扩展字段2">
            <el-input v-model="form.reservedField02" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="扩展字段3">
            <el-input v-model="form.reservedField03" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="扩展字段4">
            <el-input v-model="form.reservedField04" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="扩展字段5">
            <el-input v-model="form.reservedField05" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="创建人">
            <el-input v-model="form.createdBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="创建时间">
            <el-input v-model="form.createdTime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="更新人">
            <el-input v-model="form.updatedBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="更新时间">
            <el-input v-model="form.updatedTime" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="id" label="主键id" />
        <el-table-column prop="putAwayNo" label="上架任务号" />
        <el-table-column prop="putAwayType" label="上架类型" />
        <el-table-column prop="putAwayLine" label="上架任务行号" />
        <el-table-column prop="requestDate" label="上架请求日期" />
        <el-table-column prop="warehouse" label="仓库编号" />
        <el-table-column prop="zone" label="库区编号" />
        <el-table-column prop="receiveOrderNo" label="收货任务号" />
        <el-table-column prop="receiveOrderLine" label="收货任务行号" />
        <el-table-column prop="purchaseOrderCo" label="订单公司" />
        <el-table-column prop="purchaseOrderType" label="订单类型" />
        <el-table-column prop="purchaseOrderNo" label="采购订单号" />
        <el-table-column prop="purchaseOrderLine" label="采购订单行号" />
        <el-table-column prop="deliveryNo" label="配送任务号" />
        <el-table-column prop="purchaseOrderDate" label="采购订单日期" />
        <el-table-column prop="receiveDate" label="收货日期" />
        <el-table-column prop="supplier" label="供应商编号" />
        <el-table-column prop="supplierName" label="供应商名称" />
        <el-table-column prop="sku" label="商品编码" />
        <el-table-column prop="skuDesc" label="商品名称" />
        <el-table-column prop="jdeUom" label="商品单位" />
        <el-table-column prop="status" label="状态" />
        <el-table-column prop="quantity" label="上架数量" />
        <el-table-column prop="qtyComplete" label="已上架数量" />
        <el-table-column prop="locationFrom" label="from库位" />
        <el-table-column prop="lotFrom" label="from批次" />
        <el-table-column prop="locationTo" label="to库位" />
        <el-table-column prop="lotTo" label="to批次" />
        <el-table-column prop="lastStatus" label="上一状态" />
        <el-table-column prop="nextStatus" label="下一状态" />
        <el-table-column prop="putAwayDate" label="上架日期" />
        <el-table-column prop="staffPutAway" label="上架员" />
        <el-table-column prop="staffPutAwayName" label="上架员名称" />
        <el-table-column prop="staffReceive" label="收货员" />
        <el-table-column prop="staffReceiveName" label="收货员名称" />
        <el-table-column prop="isPre" label="是否预收" />
        <el-table-column prop="reservedField01" label="扩展字段1" />
        <el-table-column prop="reservedField02" label="扩展字段2" />
        <el-table-column prop="reservedField03" label="扩展字段3" />
        <el-table-column prop="reservedField04" label="扩展字段4" />
        <el-table-column prop="reservedField05" label="扩展字段5" />
        <el-table-column prop="createdBy" label="创建人" />
        <el-table-column prop="createdTime" label="创建时间" />
        <el-table-column prop="updatedBy" label="更新人" />
        <el-table-column prop="updatedTime" label="更新时间" />
        <el-table-column v-if="checkPer(['admin','putAwayRequest:edit','putAwayRequest:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudPutAwayRequest from '@/api/wms/putaway/putAwayRequest'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, putAwayNo: null, putAwayType: null, putAwayLine: null, requestDate: null, warehouse: null, zone: null, receiveOrderNo: null, receiveOrderLine: null, purchaseOrderCo: null, purchaseOrderType: null, purchaseOrderNo: null, purchaseOrderLine: null, deliveryNo: null, purchaseOrderDate: null, receiveDate: null, supplier: null, supplierName: null, sku: null, skuDesc: null, jdeUom: null, status: null, quantity: null, qtyComplete: null, locationFrom: null, lotFrom: null, locationTo: null, lotTo: null, lastStatus: null, nextStatus: null, putAwayDate: null, staffPutAway: null, staffPutAwayName: null, staffReceive: null, staffReceiveName: null, isPre: null, reservedField01: null, reservedField02: null, reservedField03: null, reservedField04: null, reservedField05: null, createdBy: null, createdTime: null, updatedBy: null, updatedTime: null }
export default {
  name: 'PutAwayRequest',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '条码系统：上架接口', url: 'api/putAwayRequest', idField: 'id', sort: 'id,desc', crudMethod: { ...crudPutAwayRequest }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'putAwayRequest:add'],
        edit: ['admin', 'putAwayRequest:edit'],
        del: ['admin', 'putAwayRequest:del']
      },
      rules: {
        putAwayNo: [
          { required: true, message: '上架任务号不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'putAwayNo', display_name: '上架任务号' },
        { key: 'putAwayType', display_name: '上架类型' },
        { key: 'requestDate', display_name: '上架请求日期' }
      ]
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
