index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
  3. <ContentWrap>
  4. <!-- 搜索工作栏 -->
  5. <el-form
  6. ref="queryFormRef"
  7. :inline="true"
  8. :model="queryParams"
  9. class="-mb-15px"
  10. label-width="68px"
  11. >
  12. <el-form-item label="任务名称" prop="name">
  13. <el-input
  14. v-model="queryParams.name"
  15. class="!w-240px"
  16. clearable
  17. placeholder="请输入任务名称"
  18. @keyup.enter="handleQuery"
  19. />
  20. </el-form-item>
  21. <el-form-item label="创建时间" prop="createTime">
  22. <el-date-picker
  23. v-model="queryParams.createTime"
  24. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  25. class="!w-240px"
  26. end-placeholder="结束日期"
  27. start-placeholder="开始日期"
  28. type="daterange"
  29. value-format="YYYY-MM-DD HH:mm:ss"
  30. />
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button @click="handleQuery">
  34. <Icon class="mr-5px" icon="ep:search" />
  35. 搜索
  36. </el-button>
  37. <el-button @click="resetQuery">
  38. <Icon class="mr-5px" icon="ep:refresh" />
  39. 重置
  40. </el-button>
  41. </el-form-item>
  42. </el-form>
  43. </ContentWrap>
  44. <!-- 列表 -->
  45. <ContentWrap>
  46. <el-table v-loading="loading" :data="list">
  47. <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
  48. <el-table-column
  49. align="center"
  50. label="发起人"
  51. prop="processInstance.startUser.nickname"
  52. width="100"
  53. />
  54. <el-table-column
  55. :formatter="dateFormatter"
  56. align="center"
  57. label="发起时间"
  58. prop="createTime"
  59. width="180"
  60. />
  61. <el-table-column align="center" label="当前任务" prop="name" width="180" />
  62. <el-table-column
  63. :formatter="dateFormatter"
  64. align="center"
  65. label="任务开始时间"
  66. prop="createTime"
  67. width="180"
  68. />
  69. <el-table-column
  70. :formatter="dateFormatter"
  71. align="center"
  72. label="任务结束时间"
  73. prop="endTime"
  74. width="180"
  75. />
  76. <el-table-column align="center" label="审批状态" prop="status" width="120">
  77. <template #default="scope">
  78. <dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="scope.row.status" />
  79. </template>
  80. </el-table-column>
  81. <el-table-column align="center" label="审批建议" prop="reason" min-width="180" />
  82. <el-table-column align="center" label="耗时" prop="durationInMillis" width="160">
  83. <template #default="scope">
  84. {{ formatPast2(scope.row.durationInMillis) }}
  85. </template>
  86. </el-table-column>
  87. <el-table-column align="center" label="流程编号" prop="id" :show-overflow-tooltip="true" />
  88. <el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
  89. <el-table-column align="center" label="操作" fixed="right" width="80">
  90. <template #default="scope">
  91. <el-button link type="primary" @click="handleAudit(scope.row)">历史</el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <!-- 分页 -->
  96. <Pagination
  97. v-model:limit="queryParams.pageSize"
  98. v-model:page="queryParams.pageNo"
  99. :total="total"
  100. @pagination="getList"
  101. />
  102. </ContentWrap>
  103. </template>
  104. <script lang="ts" setup>
  105. import { DICT_TYPE } from '@/utils/dict'
  106. import { dateFormatter, formatPast2 } from '@/utils/formatTime'
  107. import * as TaskApi from '@/api/bpm/task'
  108. defineOptions({ name: 'BpmTodoTask' })
  109. const { push } = useRouter() // 路由
  110. const loading = ref(true) // 列表的加载中
  111. const total = ref(0) // 列表的总页数
  112. const list = ref([]) // 列表的数据
  113. const queryParams = reactive({
  114. pageNo: 1,
  115. pageSize: 10,
  116. name: '',
  117. createTime: []
  118. })
  119. const queryFormRef = ref() // 搜索的表单
  120. /** 查询任务列表 */
  121. const getList = async () => {
  122. loading.value = true
  123. try {
  124. const data = await TaskApi.getTaskDonePage(queryParams)
  125. list.value = data.list
  126. total.value = data.total
  127. } finally {
  128. loading.value = false
  129. }
  130. }
  131. /** 搜索按钮操作 */
  132. const handleQuery = () => {
  133. queryParams.pageNo = 1
  134. getList()
  135. }
  136. /** 重置按钮操作 */
  137. const resetQuery = () => {
  138. queryFormRef.value.resetFields()
  139. handleQuery()
  140. }
  141. /** 处理审批按钮 */
  142. const handleAudit = (row: any) => {
  143. push({
  144. name: 'BpmProcessInstanceDetail',
  145. query: {
  146. id: row.processInstance.id
  147. }
  148. })
  149. }
  150. /** 初始化 **/
  151. onMounted(() => {
  152. getList()
  153. })
  154. </script>