<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <el-form
          :inline="true"
          class="demo-form-inline"
          label-position="right"
          label-width="80px"
          label-suffix=":"
        >
          <el-form-item label="链路ID">
            <el-input
              v-model="query.buss_move_id"
              clearable
              style="width: 180px"
              placeholder="输入链路ID"
              @keyup.enter.native="crud.toQuery"
            />
          </el-form-item>
          <el-form-item label="日期">
            <el-date-picker
              v-model="query.createTime"
              type="datetimerange"
              value-format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              @change="crud.toQuery">
            </el-date-picker>
          </el-form-item>
          <rrOperation />
        </el-form>
      </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="mini" label-width="80px">
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="buss_move_id" label="链路ID" :min-width="flexWidth('buss_move_id',crud.data,'链路id')"/>
        <el-table-column prop="process_action" label="动作" :min-width="flexWidth('process_action',crud.data,'动作')"/>
        <el-table-column prop="process_location" label="地点" :min-width="flexWidth('process_location',crud.data,'地点')"/>
        <el-table-column prop="point_name" label="名称" :min-width="flexWidth('point_name',crud.data,'地点')"/>
        <el-table-column prop="vehicle_code" label="载具编码" :min-width="flexWidth('vehicle_code',crud.data,'载具编码')"/>
        <el-table-column prop="record_time" label="记录时间" :min-width="flexWidth('record_time',crud.data,'记录时间')"/>
        <el-table-column prop="device_code" label="压机号" :min-width="flexWidth('device_code',crud.data,'记录时间')"/>
        <el-table-column prop="material_code" label="产品编码" :min-width="flexWidth('material_code',crud.data,'记录时间')"/>
        <el-table-column prop="material_qty" label="砖块数量" :min-width="flexWidth('material_qty',crud.data,'记录时间')"/>
        <el-table-column prop="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')"/>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudPdmBdProductionProcessTracking from './pdmBdProductionProcessTracking'
import CRUD, { crud, form, header, presenter } 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 = {
  process_id: null,
  record_time: null,
  process_action: null,
  process_location: null,
  buss_move_id: null
}
export default {
  name: 'ProcessTracking',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({
      title: '生产过程跟踪表',
      url: 'api/pdmBdProductionProcessTracking',
      idField: 'process_id',
      sort: 'process_id,desc',
      crudMethod: { ...crudPdmBdProductionProcessTracking },
      optShow: {
        add: false,
        edit: false,
        del: false,
        download: false,
        reset: true
      }
    })
  },
  data() {
    return {
      permission: {
      },
      rules: {
      }    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
