<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>
        <!-- <el-button type="primary" icon="el-icon-plus" @click="handleDelete">申报
            </el-button> -->
      </template>
      <template #menu-right> </template>
      <template #menu="scope">
        <el-button type="primary" @click="handleImport">处理 </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import { getList } from '@/api/processManagement/inPlantProcess.js';
export default {
  data() {
    return {
      selectionList: [],
      loading: false,
      option: {
        height: 'auto',
        calcHeight: 32,
        tip: false,
        size: 'medium',
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: false,
        viewBtn: false,
        delBtn: true,
        addBtn: false,
        editBtnText: '修改',
        addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        viewBtnText: '详情',
        labelWidth: 120,
        menuWidth: 180,
        dialogWidth: 1040,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: false,
        filterBtn: true,
        searchShowBtn: false,
        columnSort: true,
        excelBtn: true,
        columnSort: true,
        showOverflowTooltip: true,
        menuAlign: 'left',
        gridBtn: false,
        searchLabelPosition: 'left',
        searchGutter: 24,
        searchSpan: 6,
        searchMenuPosition: 'right',
        align: 'center',
        menu:false,
        column: [
          {
            label: '作业中心',
            prop: 'wcId',
            sortable: true,
            filter: true,
            span: 12,
            search: true,
            display: false,
            headerAlign: 'center',
            align: 'left',
            type: 'select',
            hide: true,
           dicUrl: '/blade-desk/bsWorkCenter/getList',
            props: {
              label: 'wcName',
              value: 'id',
            },
          },
          {
            label: '任务号',
            prop: 'tbCode',
            sortable: true,
            filter: true,
            span: 12,
            search: false,
            display: false,
            headerAlign: 'center',
            align: 'left',
            searchLabelWidth: 60,
          },
          {
            label: '产线',
            prop: 'wcName',
            search: true,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'left',
            searchLabelWidth: 45,
          },
          {
            label: '确认编号',
            prop: 'condition',
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'left',
          },
          {
            label: '确认到期日期',
            prop: 'lastTime',
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'center',
          },
          {
            label: '提醒天数',
            prop: 'remDays',
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'center',
          },
          {
            label: '工艺员',
            prop: 'proMan',
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'center',
            searchLabelWidth: 60,
            dicUrl: '/blade-system/user/page?current=1&&size=99999',
            props: {
              label: 'name',
              value: 'id',
              res: 'data.records',
            },
          },
          {
            label: '备注',
            prop: 'remarks',
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'left',
          },
          {
            label: '状态',
            prop: 'tbStatus',
            search: true,
            sortable: true,
            filter: true,
            span: 12,
            headerAlign: 'center',
            align: 'center',
          },
        ],
      },
      form: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
    };
  },
  methods: {
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {});
    },
    // 多选
    selectionChange(list) {
      this.selectionList = list;
    },
    onLoad(page, params = {}) {
      this.loading = true;
      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();
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
