<template>
  <fvSearchForm :searchConfig="searchConfig" @search="search" style="margin-left: 16px"></fvSearchForm>
  <fvTable ref="tableIns" :tableConfig="tableConfig">
    <template #empty>
      <el-empty description="暂无数据"/>
    </template>
  </fvTable>
</template>

<script setup lang="jsx">
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {toThousands} from '@/utils/changePrice.js'
import { getSubCompOpt } from '@/api/user/user.js';
import {reactive, ref} from "vue";
import {useRoute, useRouter} from "vue-router";
const router = useRouter()
const route = useRoute()
const searchConfig = ref([

  {
    label: '主项目',
    prop: 'masterProjectName',
    component: 'el-input',
    props: {
      placeholder: '请输入主项目查询',
      clearable: true,
      filterable: true,
      checkStrictly: true
    }
  },
  // {
  //   label: '子项目',
  //   prop: 'subProjectName',
  //   component: 'el-input',
  //   props: {
  //     placeholder: '请输入子项目查询',
  //     clearable: true,
  //     filterable: true,
  //     checkStrictly: true
  //   }
  // },
  // {
  //   label: '项目类型',
  //   prop: 'projectType',
  //   component: shallowRef(fvSelect),
  //   props: {
  //     placeholder: '请选择项目类型',
  //     cacheKey: 'project_type',
  //     clearable: true,
  //     filterable: true,
  //     remote: true
  //   },
  //   colProps: {}
  // },
  // {
  //   label: '归档时间',
  //   prop: 'filingTime',
  //   component: 'el-date-picker',
  //   props: {
  //     placeholder: '请选择归档时间',
  //     clearable: true,
  //     type:'date',
  //     format: 'YYYY-MM-DD HH:mm',
  //     valueFormat:'YYYY-MM-DD HH:mm',
  //   },
  //   colProps: {}
  // },
])
const tableIns = ref()
const tableConfig = reactive({
  columns: [
    // {
    //   prop: 'name',
    //   type: 'index',
    //   label: '序号',
    //   align: 'center',
    //   width:85,
    //   index: index => {
    //     return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
    //   }
    // },
    {
      prop: 'paymentYear',
      label: '支付年份',
      align: 'center',
      width: 80
    },
    {
      prop: 'paymentMonth',
      label: '支付月份',
      align: 'center',
      width: 80
    },

    {
      prop: 'masterProjectName',
      label: '主项目',
      align: 'center',
      width: 120,

    },

    {
      prop: 'subProjectName',
      label: '子项目',
      align: 'center',
      width: 120,
    },
    {
      prop: 'certificateDate',
      label: '凭证日期',
      align: 'center',
      width: 120,
    },
    {
      prop: 'voucherNumber',
      label: '凭证号',
      align: 'center'
    },
    {
      prop: 'entryNumber',
      label: '分录号',
      align: 'center',

    },
    {
      prop: 'remarks',
      label: '摘要',
      align: 'center',
    },
    {
      prop: 'accountCode',
      label: '科目编码',
      align: 'center',
      showOverflowTooltip: false,

    },
    {
      prop: 'accountName',
      label: '科目名称',
      align: 'center',
    },
    {
      prop: 'auxiliaryItem',
      label: '辅助项',
      align: 'center',
    },
    {
      prop: 'recordedAmount',
      label: '会计凭证记载金额(元)',
      align: 'center',
      width: 170
    },
    {
      prop: 'rdAmount',
      label: '归集研发费用金额(元)',
      align: 'center',
      width: 170
    },
  ],
  api: '/workflow/mosr/payment/list',
  params: {},
  export:{
    open :true,
    fileName:`研发费用明细表.xlsx`
  }
})
const search = (val) => {
  tableConfig.params = {...val}
  tableIns.value.refresh()
}
const init = async () => {
  const res = await getSubCompOpt()
  searchConfig.value.find(item=>item.prop == 'affiliatedCompanyIds').props.data = res.data
}

// init()

</script>
<style scoped lang="scss">
:deep(.el-table__header) {
  .is-leaf:first-child {
    .cell {
      margin-left: -25px !important;
    }
  }
}

:deep(.el-table__body) {
  .el-table__cell:first-child {
    .cell {
      margin-left: -13px !important;
    }
  }
}
:deep(.el-date-editor--month){
  width: 100%;
}
</style>
