<template>
    <div class="reply" ref = "replyModal">
      <a-modal
        title="年休明细"
        width="85%"
        :visible="visible"
        :confirmLoading="loading"
        :getContainer ='()=>$refs.replyModal'
        @cancel="handleCancel"
        destroyOnClose
       >
            <template #footer>
                <a-button  @click="handleCancel" style="margin-left: 8px;">取消</a-button>
            </template>
            <div class="table-page-search-wrapper">
                <a-form-model layout="inline" ref="form" :model="formState" >
                    <a-row :gutter="24">
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="组织"  prop="name">
                                <a-input  v-model="formState.orgName" />
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="姓名"  >
                                <a-input placeholder="请输入" v-model="formState.name" />
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label=""  >
                                <a-button type="primary" icon="search" @click="searchSonList">查询</a-button>
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                </a-form-model>
                <a-table
                    bordered
                    :columns="columns"
                    :data-source="dataSource"
                    :loading="loading"
                    :scroll="{x: 1200 ,y:300}"
                    :pagination="false"
                >
                </a-table>
            </div>
      </a-modal>
    </div>
</template>
<script>
    
      import moment from 'moment'
      import pick from 'lodash.pick'
      import { FormTypes } from '@/utils/JEditableTableUtil'
      import { putAction,getAction } from '@/api/manage'
      export default {
        name: 'AnnualLeave',
        components: {
            moment,
        },
        data() {
          return {
              formState:{},
              dataSource: [],
              visible:false,
              loading:false,
              columns: [
                {
                    title: '编号',
                    align: "center",
                    dataIndex: 'code',
                    ellipsis: true,
                    width:'14%'
                },
                {
                    title: '姓名',
                    align: "center",
                    dataIndex: 'name',
                    ellipsis: true,
                    width:'14%'
                },
                {
                    title: '组织',
                    align: "center",
                    dataIndex: 'orgName',
                    ellipsis: true,
                    width:'14%'
                },
                {
                    title: '工资卡号',
                    align: "center",
                    dataIndex: 'cardNo',
                    ellipsis: true,
                    width:'15%',
                },
                {
                    title: '年假天数',
                    align: "center",
                    dataIndex: 'annualLeave',
                    ellipsis: true,
                    width:'14%'
                },
                {
                    title: '已请天数',
                    align: "center",
                    dataIndex: 'used',
                    ellipsis: true,
                    width:'14%'
                },
                {
                    title: '剩余天数',
                    align: "center",
                    dataIndex: 'surplus',
                    ellipsis: true,
                    width:'14%'
                },
                
             ]
          }
        },
        created(){
        },
        watch: {
        },
        methods: {
            handleCancel(){
                this.visible = false
                this.formState = {}
                this.dataSource = []
            },
            detail(id){
                this.formState = {}
                this.formState.id = id
                this.getTableList()
            },
            getTableList(){
                this.loading = true
                getAction('/salary/salaryAttendance/querySalaryAttendanceHolidayByMainId',this.formState).then(res=>{
                    this.loading = false
                    if(res.success){
                        this.dataSource =res.result
                    }else{
                        this.$message.error(res.message);
                    }
                })
            },
            searchSonList(){
                this.getTableList()
            }
        }
    }
    </script>
    
    <style scoped lang="less">
    /deep/ .nresume .ant-input{
      height: 100px !important;
    }

    /deep/ .ant-select{
      width: 100%;
    }
    .form-table-heard:before {
          content: '*';
          color: red;
    }
    /deep/ .ant-calendar-picker{
      width: 113px !important;
    }
    </style>