<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <el-form
          size="mini"
          :inline="true"
          class="demo-form-inline"
          label-position="right"
          label-width="80px"
          label-suffix=":"
        >

          <el-form-item label="日期">
            <label slot="label">日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期:</label>
            <date-range-picker v-model="query.createTime" class="date-item" />
          </el-form-item>

          <rrOperation />
        </el-form>

      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" >
        <el-button
          slot="right"
          class="filter-item"
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="crud.doExport"
        >
          导出
        </el-button>
      </crudOperation>
      <!--表单组件-->
      <el-table
        ref="table"
        v-loading="crud.loading"
        :data="crud.data"
        size="mini"
        style="width: 100%;"
        @selection-change="crud.selectionChangeHandler"
      >
        <el-table-column prop="veidoo" label="维度" show-overflow-tooltip />
        <el-table-column prop="kpi" label="指标" show-overflow-tooltip/>
        <el-table-column prop="yesterday" label="昨日" show-overflow-tooltip :formatter="crud.formatNum2"/>
        <el-table-column prop="the_same_month" label="当月" show-overflow-tooltip :formatter="crud.formatNum2"/>
        <el-table-column prop="the_same_year" label="当年" show-overflow-tooltip :formatter="crud.formatNum2"/>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import crudOperation from '@crud/CRUD.operation'
import crudBlendkpiquery from '@/api/wms/statistics/blendkpiquery'
import DateRangePicker from '@/components/DateRangePicker'

export default {
  name: 'BlendKpiQuery',
  components: { pagination, rrOperation, crudOperation, DateRangePicker },
  mixins: [presenter(), header(), crud()],
  cruds() {
    return CRUD({
      title: '混合料场业绩指标',
      url: 'api/blendKpiQuery',
      idField: 'business_date',
      sort: 'business_date,desc',
      optShow: {
        add: false,
        edit: false,
        del: false,
        download: false,
        reset: true
      },
      crudMethod: { ...crudBlendkpiquery }
    })
  },

  data() {
    return {
    }
  },
  created() {
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    hand(value) {
      this.crud.toQuery()
    }
  }
}
</script>

<style scoped>

</style>
