index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script setup lang="ts" name="Done">
  2. import dayjs from 'dayjs'
  3. import duration from 'dayjs/plugin/duration'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. import { useTable } from '@/hooks/web/useTable'
  6. import { useI18n } from '@/hooks/web/useI18n'
  7. import type { TaskDoneVO } from '@/api/bpm/task/types'
  8. import { allSchemas } from './done.data'
  9. import * as TaskDoneApi from '@/api/bpm/task'
  10. dayjs.extend(duration)
  11. const { t } = useI18n() // 国际化
  12. const { push } = useRouter()
  13. // ========== 列表相关 ==========
  14. const { register, tableObject, methods } = useTable<TaskDoneVO>({
  15. getListApi: TaskDoneApi.getDoneTaskPage
  16. })
  17. const { getList, setSearchParams } = methods
  18. // 审批操作
  19. const handleAudit = async (row: TaskDoneVO) => {
  20. push('/bpm/process-instance/detail?id=' + row.processInstance.id)
  21. }
  22. // ========== 初始化 ==========
  23. getList()
  24. </script>
  25. <template>
  26. <!-- 搜索工作区 -->
  27. <ContentWrap>
  28. <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
  29. </ContentWrap>
  30. <ContentWrap>
  31. <!-- 列表 -->
  32. <Table
  33. :columns="allSchemas.tableColumns"
  34. :selection="false"
  35. :data="tableObject.tableList"
  36. :loading="tableObject.loading"
  37. :pagination="{
  38. total: tableObject.total
  39. }"
  40. v-model:pageSize="tableObject.pageSize"
  41. v-model:currentPage="tableObject.currentPage"
  42. @register="register"
  43. >
  44. <template #status="{ row }">
  45. <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
  46. </template>
  47. <template #createTime="{ row }">
  48. <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
  49. </template>
  50. <template #endTime="{ row }">
  51. <span>{{ dayjs(row.endTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
  52. </template>
  53. <template #durationInMillis="{ row }">
  54. <span>{{ dayjs.duration(row.durationInMillis).asMilliseconds() }}</span>
  55. </template>
  56. <template #action="{ row }">
  57. <el-button link type="primary" v-hasPermi="['bpm:task:query']" @click="handleAudit(row)">
  58. <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
  59. </el-button>
  60. </template>
  61. </Table>
  62. </ContentWrap>
  63. </template>