<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="90px"
          label-suffix=":"
        >
          <el-form-item label="单据编码">
            <el-input
              v-model="query.bill_code"
              clearable
              placeholder="单据编码"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            />
          </el-form-item>
          <el-form-item label="任务编码">
            <el-input
              v-model="query.task_code"
              clearable
              placeholder="任务编码"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            />
          </el-form-item>
          <el-form-item label="起点编码">
            <el-input
              v-model="query.start_point_code"
              clearable
              placeholder="起点编码"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            />
          </el-form-item>
          <el-form-item label="终点编码">
            <el-input
              v-model="query.next_point_code"
              clearable
              placeholder="终点编码"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            />
          </el-form-item>
          <el-form-item label="明细状态">
            <el-select
              v-model="query.dtl_status"
              clearable
              filterable
              size="mini"
              class="filter-item"
              style="width: 185px;"
              @change="hand"
            >
              <el-option
                v-for="item in statusDtlList"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="创建时间">
            <el-date-picker
              v-model="query.createTime"
              type="daterange"
              value-format="yyyy-MM-dd HH:mm:ss"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :default-time="['00:00:00', '23:59:59']"
              @change="crud.toQuery"
            />
          </el-form-item>
          <rrOperation :crud="crud" />
        </el-form>
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column prop="bill_code" label="单据编码" :min-width="flexWidth('bill_code',crud.data,'单据编码')" />
        <el-table-column prop="dtl_status" label="明细状态" :min-width="flexWidth('dtl_status',crud.data,'明细状态')" />
        <el-table-column prop="start_point_code" label="起始点位" :min-width="flexWidth('start_point_code',crud.data,'起始点位')" />
        <el-table-column prop="next_point_code" label="终点点位" :min-width="flexWidth('next_point_code',crud.data,'终点点位')" />
        <el-table-column prop="temperature" label="烤箱温度" :min-width="flexWidth('temperature',crud.data,'烤箱温度')" />
        <el-table-column prop="oven_time" label="烘烤时间" :min-width="flexWidth('oven_time',crud.data,'烘烤时间')" />
        <el-table-column prop="task_type" label="任务类型" :min-width="flexWidth('task_type',crud.data,'任务类型')" />
        <el-table-column prop="task_code" label="任务编码" :min-width="flexWidth('task_code',crud.data,'任务编码')" />
        <el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
        <el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
        <el-table-column prop="confirm_optname" label="确认人" :min-width="flexWidth('confirm_optname',crud.data,'确认人')" />
        <el-table-column prop="confirm_time" label="确认时间" :min-width="flexWidth('confirm_time',crud.data,'确认时间')" />
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudHotpointivt from './hotpointivt'
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 = { }
export default {
  name: 'HotPointIvtTask',
  components: { pagination, crudOperation, rrOperation, udOperation },
  dicts: [],
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({
      title: '烘烤区任务明细',
      url: 'api/hotpointivt/taskDtlQuery',
      idField: 'ivt_id',
      sort: 'ivt_id,desc',
      crudMethod: { ...crudHotpointivt },
      optShow: {
        add: false,
        edit: false,
        del: false,
        download: false,
        reset: true
      }
    })
  },
  data() {
    return {
      statusDtlList: [
        { 'label': '生成', 'value': '10' },
        { 'label': '执行中', 'value': '40' },
        { 'label': '确认', 'value': '50' }
      ],
      permission: {
      },
      rules: {
      }}
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    hand(value) {
      this.crud.toQuery()
    }
  }
}
</script>

<style scoped>

</style>
