<template>
  <template-page
    ref="pageRef"
    :get-list="getList"
    :table-attributes="tableAttributes"
    :table-events="tableEvents"
    :options-evens-group="optionsEvensGroup"
    :moreParameters="moreParameters"
    :column-parsing="columnParsing"
    :exportList="exportList"
  >
  </template-page>
</template>

<script>
import TemplatePage from '@/components/template/template-page-1.vue'
import import_mixin from '@/components/template/import_mixin.js'
import ImageUpload from '@/components/file-upload'
import operation_mixin from '@/components/template/operation_mixin.js'
import { dailySummaryBuckleList, dailySummaryBuckleExport } from '@/api/deductionForMaster'
export default {
  components: { TemplatePage, ImageUpload },
  mixins: [import_mixin, operation_mixin],
  data() {
    return {
      // 表格属性
      tableAttributes: {
        // 启用勾选列
        selectColumn: false
      },
      // 表格事件
      tableEvents: {
        'selection-change': this.selectionChange
      },
      // 勾选选中行
      recordSelected: []
    }
  },
  computed: {
    // 更多参数
    moreParameters() {
      return [
        {
          name: '工单类型',
          key: 'isBuckle',
          value: '',
          conditions: [
            {
              label: '全部',
              value: ''
            },
            {
              label: '未扣除',
              value: 'false'
            },
            {
              label: '已扣除',
              value: 'true'
            }
          ]
        }
      ]
    },
    optionsEvensGroup() {
      return []
    }
  },
  methods: {
    // 列表请求函数
    getList(p, cb) {
      var pam = JSON.parse(JSON.stringify(p))
      try {
        if (pam.isBuckle) {
          pam.params.push({ param: 'a.is_buckle', compare: '=', value: pam.isBuckle })
        }
        cb && cb(pam)
        return dailySummaryBuckleList(pam)
      } catch (err) {}
    },
    // 列表导出函数
    exportList: dailySummaryBuckleExport,
    // 表格列解析渲染数据更改
    columnParsing(item, defaultData) {
      return defaultData
    },
    // 监听勾选变化
    selectionChange(data) {
      this.recordSelected = data
    }
  }
}
</script>

<style lang="scss" scoped></style>
