<template>
   <a-card :bordered="false" >
    <!-- 查询 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :md="6" :sm="12">
            <a-form-item label="证件名称">
              <!--<a-input placeholder="请输入账号查询" v-model="queryParam.username"></a-input>-->
              <a-input placeholder="输入证件名称查询" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
           <a-col :md="6" :sm="12">
            <a-form-item label="起始日期">
              <a-date-picker
               style="width: 100%"
               placeholder="请选择购买日期"
               v-model="queryParam.beginDate"
              />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="12">
            <a-form-item label="到期时间">
              <a-date-picker
               style="width: 100%"
               placeholder="请选择购买日期"
               v-model="queryParam.endDate"
              />
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
               <a-col :md="6" :sm="12">
            <a-form-item label="证件编号">
              <a-input placeholder="输入证件编号查询" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          </template>

          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator" style="border-top: 5px">
      <a-button @click="handleAdd" type="primary" icon="plus">添加</a-button>
      <a-button @click="handleDelete" type="primary" icon="plus">删除</a-button>
    </div>

     <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="operation" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
        </span>


      </a-table>
    </div>
    <!-- 新增框 -->
    <add-certificate-management ref='AddCertificateManagement'></add-certificate-management>
   </a-card>
   
</template>

<script>
  
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import AddCertificateManagement from './modules/AddCertificateManagement'

  export default {
    name: "CertificateManagement",
    mixins: [JeecgListMixin],
    components: {
    AddCertificateManagement
    },
    data() {
      return {
          queryParam:{   //查询条件

          },
        //   表头
        columns:[
            {
            title: '证件名称',
            align: "center",
            dataIndex: 'name',
            width: 120
          },
          {
            title: '证件所有人',
            align: "center",
            dataIndex: 'userId',
            width: 120
          },
          {
            title: '证件编号',
            align: "center",
            dataIndex: 'code',
            width: 120
          },
          {
            title: '起始日期',
            align: "center",
            dataIndex: 'beginDate',
            width: 120
          },
          {
            title: '到期时间',
            align: "center",
            dataIndex: 'endDate',
            width: 120
          },
          {
            title: '管理人',
            align: "center",
            dataIndex: 'manageId',
            width: 120
          },
          {
            title: '提前通知时间/月',
            align: "center",
            dataIndex: 'noticeMonth',
            width: 120
          },
          {
            title: '备注',
            align: "center",
            dataIndex: 'remarks',
            width: 120
          },
          {
            title: '操作',
            align: "center",
            dataIndex: 'operation',
            scopedSlots: { customRender: 'operation' },
            width: 120
          },
        ]
      }
    },
    computed: {
    
    },
    created(){
        this.getData()
    },
    methods: {
        // 查询
        searchQuery(){

        },
        //重置
        searchReset(){
          this.queryParam={}
        },
        // 获取数据
        getData(){
        },
        // 删除
        handleDelete(){

        },
        // 添加
        handleAdd(){
          this.$refs.AddCertificateManagement.visible = true
        },
        //编辑
        handleEdit(record){
           this.$refs.AddCertificateManagement.visible = true
            this.$refs.AddCertificateManagement.defult = 'edit'
            this.$refs.AddCertificateManagement.formState = record
        }
    }
     

  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>