<template>
  <div>
    <div v-if="items.length">
      <LongStrip :items="items"></LongStrip>
      <CtPagination
        :total="total"
        :page="page.pageNo"
        :limit="page.pageSize"
        @handleChange="handleChangePage"
      ></CtPagination>
    </div>
    <Empty v-else></Empty>
  </div>
</template>

<script setup>
// 已投递
defineOptions({ name: 'position-delivery' })
import { ref } from 'vue'
import { dealDictObjData } from '@/utils/position'
import { getJobDeliveryList } from '@/api/position'

const total = ref(0)
const items = ref([])
const page = ref({
  pageNo: 1,
  pageSize: 20
})


// 获取已投递职位列表
const getPositionList = async () => {
  const { list, total: number } = await getJobDeliveryList(page.value)
  items.value = list.map(e => {
    e.job = { ...e.job, ...dealDictObjData({}, e.job) }
    e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
    e.active = false
    return e
  })
  total.value = number
}
getPositionList()

const handleChangePage = (index) => {
  page.value.pageNo = index
  getPositionList()
}
</script>

<style scoped lang="scss">

</style>
