<template>
  <div class="component-box-wrapper__half-transparent">
    <div class="component-content-box__dialog-like">
      <div class="component-header-box">
        <div class="component-header__title">人员待遇信息</div>
        <div class="component-header__close-button">
          <el-button plain icon="Close" circle title="关闭" @click="close"></el-button>
        </div>
      </div>
      <el-table :data="treatmentinfos" stripe height="360">
        <el-table-column label="人员编号" prop="psnNo"></el-table-column>
        <el-table-column label="待遇检查类型" prop="trtChkTypeName"></el-table-column>
        <el-table-column label="基金支付类型" prop="fundPayTypeName"></el-table-column>
        <el-table-column label="基金款项待遇享受标志" prop="trtEnjymntFlagName"></el-table-column>
        <el-table-column label="开始日期" prop="begndate"></el-table-column>
        <el-table-column label="结束日期" prop="enddate"></el-table-column>
        <el-table-column label="待遇检查结果" prop="trtChkRslt"></el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { ref, onMounted } from 'vue'
import { checkPersonTreatment } from '@/api/medical-insurance/si-query'
export default {
  props: {
    params: {
      type: Object,
      required: true,
    },
  },
  emits: ['close'],
  setup(props, ctx) {
    const treatmentinfos = ref([])

    const close = () => {
      ctx.emit('close')
    }

    onMounted(() => {
      checkPersonTreatment(props.params)
        .then((res) => {
          treatmentinfos.value = res
        })
        .catch(() => {
          ctx.emit('close')
        })
    })

    return {
      treatmentinfos,
      close,
    }
  },
}
</script>
