<script setup name='haveHandled'>
import todoList from '../components/todoList.vue'
import { useRouter } from 'vue-router'
import { h, reactive } from 'vue'
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: 180,
      render: row => [
        h('span', {
          class: [
            'dot mr-4',
            row.processStatusName === '审核中'
              ? 'bg-warning'
              : row.processStatusName === '审核通过'
                ? 'bg-success'
                : row.processStatusName === '被退回' || row.processStatusName === '被驳回'
                  ? 'bg-danger'
                  : 'bg-info'
          ]
        }),
        h(
          'span',
          {
            class:
                  row.processStatusName === '审核中'
                    ? 'text-warning'
                    : row.processStatusName === '审核通过'
                      ? 'text-success'
                      : row.processStatusName === '被退回' || row.processStatusName === '被驳回'
                        ? 'text-danger'
                        : 'text-info'
          },
          `${row.nodeName ? `${row.nodeName}-` : ''}${row.processStatusName}`
        )
      ]
    },
    {
      label: '创建时间',
      key: 'processLaunchTime',
      prop: 'processLaunchTime',
      width: 180
    },
    {
      label: '处理时间',
      key: 'processHandleTime',
      prop: 'processHandleTime',
      width: 180
    },
    {
      label: '操作',
      slot: 'action',
      width: 70,
      fixed: 'right'
    }
  ]),
  toHandle = (row) => {
    router.push({ name: 'haveHandledDetail', query: { instanceId: row.instCode, projectId: row.projectId, nodeId: row.nodeId, taskId: row.taskId }})
  }

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

