<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" icon="el-icon-delete" @click="handleDelete">删除</el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
export default {
  data() {
    return {
      loading: false,
      data: [],
      form: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList:[],
      option: {
        columnSort: true,
        tip: false,
        rowKey:'jttpId',
        height: 'auto',
        align: 'center',
        calcHeight: 32,
        simplePage: false,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: false,
        selection: true,
        viewBtn: false,
        delBtn: false,
        editBtn: true,
        editBtnText:'修改',
        editBtnIcon:' ',
        delBtnIcon: ' ',
        addBtn: true,
        labelWidth: 120,
        searchLabelWidth: 120,
        menu: true,
        menuWidth: 200,
        dialogWidth: 600,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: true,
        gridBtn: false,
        searchShowBtn: false,
        showOverflowTooltip: true,
        searchLabelPosition:'left',
searchLabelPosition:'left',
 searchGutter:24,
  searchSpan:6,
menuAlign: 'left',
gridBtn:false,
searchMenuPosition:'right',

        column: [
          {
            label: '培训计划名称',
            prop: 'name',
            span: 24,
            labelWidth: 140,
            overflow: true,
            search: true,
            rules: [
              {
                required: true,
                message: '请输入培训计划名称',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '培训周期(天)',
            prop: 'cycle',
            span: 24,
            labelWidth: 140,
            overflow: true,
            search: false,
            // rules: [
            //   {
            //     required: true,
            //     message: '请输入培训周期(天)',
            //     trigger: 'blur',
            //   },
            // ],
          },
          {
            label: '预警周期(天)',
            prop: 'earlyWarningDay',
            span: 24,
            labelWidth: 140,
            overflow: true,
            search: false,
            // rules: [
            //   {
            //     required: true,
            //     message: '请输入预警周期(天)',
            //     trigger: 'blur',
            //   },
            // ],
          },
          {
            label: '备注',
            prop: 'memo',
            span: 24,
            labelWidth: 140,
            overflow: true,
            search: false,
            // rules: [
            //   {
            //     required: true,
            //     message: '请输入备注',
            //     trigger: 'blur',
            //   },
            // ],
          },
          {
            label: '培训计划资料',
            prop: 'fileUrl',
            span: 24,
            labelWidth: 140,
            overflow: true,
            search: false,
            hide:true,
            type: 'upload',
            tip: '不能上传 附件，且不超过 10M',
            // rules: [
            //   {
            //     required: true,
            //     message: '请输入备注',
            //     trigger: 'blur',
            //   },
            // ],
          },
        ]
      }
    }
  },
  mounted() {

  },
  methods: {
    selectionChange(val){
      this.selectionList = val
    },
    handleDelete(){
      if(this.selectionList.length == 0){
        this.$message.error('请至少选择一条数据')
      }else{
        this.$confirm('确定将选择数据删除?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() =>{

        })
      }
    },
    onLoad() {
      this.data = [
        {
          "cycle": 5,
          "earlyWarningDay": null,
          "jttpId": 41,
          "keyValue": 41,
          "memo": "111",
          "name": "测试",
          "teacherId": "[521,453,89,445,561,541]",
          "teacherName": "[\"0001\",\"00075\",\"hak\",\"00083\",\"张欣\",\"崔殿龙\"]",
          "updateMan": {
            "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"
          },
          "updateTime": "2023-08-12 12:01:56"
        },
        {
          "cycle": 3,
          "earlyWarningDay": null,
          "jttpId": 42,
          "keyValue": 42,
          "memo": null,
          "name": "测试1",
          "teacherId": "[521,453,445,287]",
          "teacherName": "[\"0001\",\"00075\",\"00083\",\"03193\"]",
          "updateMan": {
            "accountId": 541,
            "card": null,
            "createTime": "2023-05-04",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 102,
            "head": 0,
            "jobName": "MES开发",
            "keyValue": 541,
            "ldapName": "cdl",
            "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": "CUIDIANLONG,CDL",
            "ucUserId": null,
            "updateTime": "2023-05-04 09:16:54",
            "userCode": "cdl",
            "userId": 541,
            "userName": "崔殿龙",
            "userSex": 1,
            "userSources": "崔殿龙",
            "userString": "541:A:崔殿龙",
            "userType": "A"
          },
          "updateTime": "2023-07-25 14:51:08"
        }
      ]
      this.page.total = this.data.length
    }
  }
}
</script>

<style></style>