<script setup name="unitSelfEvaluation">
import { onMounted, reactive, ref, h } from 'vue'
import { list } from '@/http/apis/performanceEvaluation/unitSelfEvaluation'
const tableListRef = ref(),
  column = reactive([
    {
      label: '序号',
      type: 'index',
      width: '80'
    },
    {
      label: '评价计划',
      key: 'name',
      prop: 'name'
    },
    {
      label: '自评时间',
      key: 'time',
      prop: 'time',
      render: row => h('span', `项目终验后${row.startSelfDays}天后开始自评，${row.completeSelfDays}天内完成自评`)
    },
    {
      label: '备注',
      key: 'remark',
      prop: 'remark',
      render: row => h('span', `${row.remark || '-'}`)

    },
    {
      label: '操作',
      slot: 'action',
      fixed: 'right',
      width: '80'
    }
  ]),
  data = ref([]),
  total = ref(0),
  getTableData = async (pageParams = tableListRef.value.pageParams) => {
    const res = await list({
      ...pageParams
    })
    data.value = res.data.records
    total.value = res.data.total
  }
onMounted(() => {
  getTableData()
})
</script>

<template>
  <div>
    <el-card>
      <template #header>列表</template>
      <table-list
        ref="tableListRef"
        :column="column"
        :data="data"
        :total="total"
        @get-table-data="getTableData"
      >
        <template #action="{scope}">
          <a @click="$router.push({name:'unitSelfProjectList',query:{title:scope.row.name,planId:scope.row.id}})">自评</a>
        </template>
      </table-list>
    </el-card>
  </div>
</template>
