<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" :tableKey="this.$options.name" />
      <!--表单组件-->
      <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="物料序号">
            <el-input v-model="form.itemId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="物料属性序号">
            <el-input v-model="form.itemKeyId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="任务序号">
            <el-input v-model="form.taskId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="源容器">
            <el-input v-model="form.srcStockId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="目标容器">
            <el-input v-model="form.dstStockId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="源点位">
            <el-input v-model="form.srcLocId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="目标点位">
            <el-input v-model="form.dstLocId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="源容器编码">
            <el-input v-model="form.srcStockCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="目标容器编码">
            <el-input v-model="form.dstStockCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="源点位编码">
            <el-input v-model="form.srcLocCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="目标点位编码">
            <el-input v-model="form.dstLocCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="属性6">
            <el-input v-model="form.invStatus" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="退回">
            <el-input v-model="form.beBack" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="拣货数量">
            <el-input v-model="form.moveQty" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发运数量">
            <el-input v-model="form.shipQty" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="上架号">
            <el-input v-model="form.putCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="库存ID">
            <el-input v-model="form.invId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="仓库ID">
            <el-input v-model="form.deptId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="创建人">
            <el-input v-model="form.createBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="修改人">
            <el-input v-model="form.updateBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发运人">
            <el-input v-model="form.shipBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发运时间">
            <el-input v-model="form.shipTime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="创建时间">
            <el-input v-model="form.createTime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="修改时间">
            <el-input v-model="form.updateTime" 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="itemId" label="物料序号" />
        <el-table-column prop="itemKeyId" label="物料属性序号" />
        <el-table-column prop="taskId" label="任务序号" />
        <el-table-column prop="srcStockId" label="源容器" />
        <el-table-column prop="dstStockId" label="目标容器" />
        <el-table-column prop="srcLocId" label="源点位" />
        <el-table-column prop="dstLocId" label="目标点位" />
        <el-table-column prop="srcStockCode" label="源容器编码" />
        <el-table-column prop="dstStockCode" label="目标容器编码" />
        <el-table-column prop="srcLocCode" label="源点位编码" />
        <el-table-column prop="dstLocCode" label="目标点位编码" />
        <el-table-column prop="invStatus" label="属性6" />
        <el-table-column prop="beBack" label="退回" />
        <el-table-column prop="moveQty" label="拣货数量" />
        <el-table-column prop="shipQty" label="发运数量" />
        <el-table-column prop="putCode" label="上架号" />
        <el-table-column prop="invId" label="库存ID" />
        <el-table-column prop="deptId" label="仓库ID" />
        <el-table-column prop="createBy" label="创建人" />
        <el-table-column prop="updateBy" label="修改人" />
        <el-table-column prop="shipBy" label="发运人" />
        <el-table-column prop="shipTime" label="发运时间" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column prop="updateTime" label="修改时间" />
        <el-table-column v-if="checkPer(['admin','taskLog:edit','taskLog: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 crudTaskLog from '@/api/taskLog'
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, itemId: null, itemKeyId: null, taskId: null, srcStockId: null, dstStockId: null, srcLocId: null, dstLocId: null, srcStockCode: null, dstStockCode: null, srcLocCode: null, dstLocCode: null, invStatus: null, beBack: null, moveQty: null, shipQty: null, putCode: null, invId: null, deptId: null, createBy: null, updateBy: null, shipBy: null, shipTime: null, createTime: null, updateTime: null }
export default {
  name: 'TaskLog',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'taskLog', url: 'api/taskLog', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTaskLog }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'taskLog:add'],
        edit: ['admin', 'taskLog:edit'],
        del: ['admin', 'taskLog:del']
      },
      rules: {
      }    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
