<template>
  <a-row :gutter="10">
    <a-col   :sm="24" style="margin-bottom: 20px">
      <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="12" :sm="8">
                <a-form-item label="岗位名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
                  <a-input placeholder="" v-model="queryParam.itemText"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="12" :sm="24">
               <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 21px">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
          </span>
            </a-row>
          </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator" style="margin: 5px 0 10px 2px">
          <a-button @click="handleAdd" type="primary" icon="plus">新建数据</a-button>
        </div>
        <div style="margin-top: 15px">
          <a-table
            style="height:500px"
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
             @change="handleTableChange">

          <span slot="action" slot-scope="text, record">
             <a-divider type="vertical"/>


            <a-dropdown>
              <a class="ant-dropdown-link">
                更多 <a-icon type="down"/>
              </a>
              <a-menu slot="overlay">

                <a-menu-item>
                  <a @click="handleEdit(record)">编辑</a>
                </a-menu-item>
                <a-menu-item>
                  <a-popconfirm title="确定删除吗?" @confirm="() => dataDelete(record)">
                    <a>删除</a>
                  </a-popconfirm>
                </a-menu-item>
              </a-menu>
            </a-dropdown>
        </span>
          </a-table>
        </div>
        <!-- 右侧的角色权限配置 -->
        <user-role-modal ref="modalUserRole"></user-role-modal>
        <post-config-model ref="modalForm" @ok="modalFormOk"></post-config-model>
      </a-card>
    </a-col>

  </a-row>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { deleteAction, postAction, getAction } from '@/api/manage'
  import postConfigModel from './modules/postConfigModel'
  import moment from 'moment'
  import { adminCheck } from '@/api/api'
  export default {
    name: 'expireDateConfig',
    mixins: [JeecgListMixin],
    components: {
      postConfigModel,
      moment
    },
    data() {
      return {

        /* 数据源 */
        columns: [
            {
              title: '岗位',
              align: 'center',
              dataIndex: 'itemText',
            },
            {
              title: '创建时间',
              dataIndex: 'createTime',
              align:"center",
              // sorter: true,
              sorter:(a, b) => { return a.createTime>= b.createTime? 1 : -1 },
              customRender: (text) => {
                return moment(text).format('YYYY-MM-DD')
              }
            },
            {
              title: '操作',
              dataIndex: 'action',
              align: 'center',
              scopedSlots: { customRender: 'action' }
            }
          ],
        url: {
          list: "/sys/dictItem/listPost"
        }
      }

    },
    methods: {
      dataDelete(id) {
        var that = this;
        deleteAction("/sys/dictItem/delete", {id: id.id}).then((res) => {
          if (res.success) {
            that.$message.success('清空完成！');
            that.$emit('ok');
          } else {
            that.$message.warning('清空失败！');
          }
        });
      },
    }
  }
</script>
<style scoped>
@import '~@assets/less/common.less';
  /** Button按钮间距 */
  .ant-btn {
    margin-left: 8px
  }
</style>