<script setup name='copyMine'>
import todoList from '../components/todoList.vue'
import { h, reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter(),
  column = reactive([
    {
      label: '序号',
      type: 'index',
      width: '80'
    },
    {
      label: '项目名称',
      key: 'projectName',
      prop: 'projectName',
      minWidth: '200',
      showOverflowTooltip: true
    },
    {
      label: '申报单位',
      key: 'buildOrg',
      prop: 'buildOrg',
      minWidth: '200',
      showOverflowTooltip: true
    },
    {
      label: '申报金额（万元）',
      key: 'declaredAmount',
      prop: 'declaredAmount',
      width: 140
    },
    {
      label: '预算年度',
      key: 'projectYear',
      prop: 'projectYear',
      width: 100
    },
    {
      label: '流程状态',
      key: 'processStatusName',
      prop: 'processStatusName',
      width: 100,
      render: row => [
        h('span', {
          class: [
            'dot mr-4',
            row.processStatusName === '审核中'
              ? 'bg-warning'
              : row.processStatusName === '审核通过'
                ? 'bg-success'
                : row.processStatusName === '被退回' || row.processStatusName === '被驳回'
                  ? 'bg-danger'
                  : ''
          ]
        }),
        h(
          'span',
          {
            class:
                  row.processStatusName === '审核中'
                    ? 'text-warning'
                    : row.processStatusName === '审核通过'
                      ? 'text-success'
                      : row.processStatusName === '被退回' || row.processStatusName === '被驳回'
                        ? 'text-danger'
                        : ''
          },
          row.processStatusName
        )
      ]
    },
    {
      label: '发起时间',
      key: 'processLaunchTime',
      prop: 'processLaunchTime',
      width: 180
    },
    {
      label: '操作',
      slot: 'action',
      width: 70,
      fixed: 'right'
    }
  ]),
  toHandle = (row) => {
    router.push({ name: 'copyMineDetail', query: { instanceId: row.instCode, projectId: row.projectId, nodeId: row.nodeId, taskId: row.taskId }})
  }

</script>
<template>
  <todo-list
    :column="column"
    state="4"
    :export-data="['projectName','buildOrgName','declareAmount','projectYear','processStatusName','processLaunchTime']"
    @to-handle="toHandle"
  />
</template>
