<template>
  <div>
    <el-row style="margin-top: 5px">
      <el-col :span="24">
        <el-table :data="itemApproveList">
          <el-table-column
            label="项目流程名称"
            align="center"
            prop="projectProcessName"
          />
          <el-table-column
            label="流程名称"
            align="center"
            prop="process.processName"
          />
          <el-table-column
            label="流程类型"
            align="center"
            prop="process.processType"
          />
          <el-table-column
            label="当前流程节点"
            align="center"
            prop="node.nodeName"
          />
          <el-table-column
            label="操作"
            align="center"
          >
            <template #default="scope">
              <el-button
                type="primary"
                icon="Memo"
                text
                @click="jumpApproveDetail(scope.row)"
              >详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
// 审核列表

defineOptions({
  name: 'InspectList'
})
import { onMounted, reactive } from 'vue'
import { getExamineList } from '@/api/process'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/pinia/modules/user'

const router = useRouter()

onMounted(() => {
  queryApproveList()
})
const user = useUserStore()
// 查询项目审批列表
const condition = reactive({
  pageInfo: {
    page: 1,
    pageSize: 10,
  },
  userId: user.userInfo.ID
})
const itemApproveList = reactive([])
const queryApproveList = () => {
  getExamineList(condition).then(res => {
    if (res.code === 0) {
      const list = res.data.list
      itemApproveList.length = 0
      itemApproveList.push(...list)
    }
  })
}

// 跳转到详情页
const jumpApproveDetail = (row) => {
  router.push({ path: '/layout/approve/approveDetail', query: { id: row.ID, type: 'inspect' }})
}
</script>

<style scoped>

</style>
