<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="danger" @click="handleDelete">删除
        </el-button>
      </template>
      <template #menu-right> </template>
      <template #menu="scope"> </template>
    </avue-crud>
  </basic-container>
</template>
<script>
export default {
  data() {
    return {
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 32,
        tip: false,
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: true,
        viewBtn: false,
        delBtn: true,
        addBtn: true,
        editBtnText: "修改",
        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,
        index: false,
        showOverflowTooltip: true,
        searchLabelPosition: "left",
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: "left",
        gridBtn: false,
        searchMenuPosition: "right",
        addBtnIcon: " ",
        viewBtnIcon: " ",
        delBtnIcon: " ",
        editBtnIcon: " ",
        align: "center",

        column: [
          {
            label: "月份",
            prop: "pfvMonth",
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            width: 220,
            type: 'month',
            rules: [
              {
                required: true,
                message: "请输入月份",
                trigger: "blur",
              },
            ],
          },
          {
            label: "尖时一开始",
            prop: "jianTimeStartOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 140,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "尖时一结束",
            prop: "jianTimeEndOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 140,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "峰时一开始",
            prop: "fengTimeStartOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 140,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "峰时一结束",
            prop: "fengTimeEndOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "平时一开始",
            prop: "pingTimeStartOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "平时一结束",
            prop: "pingTimeEndOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "谷时一开始",
            prop: "guTimeStartOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "谷时一结束",
            prop: "guTimeEndOne",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "尖时二开始",
            prop: "jianTimeStartTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "尖时二结束",
            prop: "jianTimeEndTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "峰时二开始",
            prop: "fengTimeStartTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "峰时二结束",
            prop: "fengTimeEndTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,

            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "平时二开始",
            prop: "pingTimeStartTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          {
            label: "平时二结束",
            prop: "pingTimeEndTwo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            width: 130,
            type: "time",
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
          },
          
        ],
      },
      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() {
      this.loading = true;
      this.data = [
        {
          createMan: {
            accountId: null,
            card: null,
            createTime: "2023-05-23",
            curStatus: 1,
            deleted: false,
            deptName: null,
            dimissionTime: null,
            factoryId: 41,
            head: 0,
            jobName: "开发",
            keyValue: 561,
            ldapName: "zhx",
            mail: null,
            mobile: null,
            pfDepartment: {
              appLink: null,
              createTime: "2022-08-31",
              deleted: false,
              deptCode: "001",
              deptId: 1,
              deptName: "MES开发部",
              deptType: 1,
              deptTypeTitle: "厂",
              keyValue: 1,
              memo: null,
              orders: "00",
              parentDeptId: null,
              parentPath: null,
              ucDeptId: null,
              updateTime: "2022-08-31 16:32:46",
            },
            pinyinIndex: "ZHANGXIN,ZX",
            ucUserId: null,
            updateTime: "2023-05-23 10:58:43",
            userCode: "zhx",
            userId: 561,
            userName: "张欣",
            userSex: 1,
            userSources: "张欣",
            userString: "561:A:张欣",
            userType: "A",
          },
          fengTimeEndOne: "02:00:00",
          fengTimeEndTwo: "16:00:00",
          fengTimeStartOne: "01:00:00",
          fengTimeStartTwo: "13:00:00",
          guTimeEndOne: "09:00:00",
          guTimeEndTwo: "16:00:00",
          guTimeStartOne: "07:00:00",
          guTimeStartTwo: "15:00:00",
          keyValue: 1,
          pfvId: 1,
          pfvMonth: "2025-06-01 00:00:00",
          pingTimeEndOne: "03:04:00",
          pingTimeEndTwo: "15:00:00",
          pingTimeStartOne: "02:00:00",
          pingTimeStartTwo: "05:00:00",
          updateTime: "2025-10-23 11:38:01",
        },
      ];
      this.page.total = this.data.length;
      this.loading = false;
      setTimeout(() => {
        this.selectionClear();
      }, 500);
    },
  },
};
</script>
<style lang="scss" scoped></style>
