<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model="form"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu-left> </template>
      <template #menu-right> </template>
      <template #menu="{ row }"> </template>
    </avue-crud>
  </basic-container>
</template>

<script>


export default {
  components: {},
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      option: {
        columnSort: true,
        tip: false,
        height: 'auto',
        calcHeight: 32,
        simplePage: false,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: false,
        addBtn: false,
        editBtn: false,
        viewBtn: false,
        delBtn: false,
        editBtnText: '修改',
        labelWidth: 120,
        menuWidth: 80,
        dialogWidth: 900,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: false,
        filterBtn: true,
        searchShowBtn: false,
        excelBtn: true,
        showOverflowTooltip: true,
        addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        gridBtn: false,
        searchLabelPosition: 'left',
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: 'left',
        gridBtn: false,
        searchMenuPosition: 'right',
        align: 'center',
        menu: false,
        column: [
          {
            label: '班组',
            prop: '班组',
            search: true,
            sortable: true,
            span: 12,
            hide:true,
          },
           {
            label: '设备',
            prop: '设备',
            search: true,
            sortable: true,
            span: 12,
            hide:true,
          },
          {
            label: '生成订单项数',
            prop: 'partCode',
            search: false,
            sortable: true,
            span: 12,
          },
          {
            label: 'MES排产项数',
            prop: '自动排产率',
            search: false,
            sortable: true,
            span: 12,
          },
           {
            label: '自动排产率',
            prop: '自动排产率',
            search: false,
            sortable: true,
            span: 12,
          },
          {
            label: '排产时间',
            prop: 'cycledate',
            search: true,
            sortable: true,
            span: 12,
            hide:true,
            type: "date",
            searchRange: true,
            startPlaceholder: "开始时间",
            endPlaceholder: "结束时间",

          },
        ],
      },

      data: [],
    };
  },
  methods: {
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },

    onLoad(page, params = {}) {
      this.loading = true;
      this.data = [];
      this.page.total = this.data.length;
      //   getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
      //     this.data = res.data.data.records;
      this.loading = false;
      //     this.page.total = res.data.data.total
      //     this.selectionClear();
      //   });
    },
  },
  mounted() {},
};
</script>
