index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <ContentWrap>
  3. <!-- 搜索工作栏 -->
  4. <el-form
  5. ref="queryFormRef"
  6. :inline="true"
  7. :model="queryParams"
  8. class="-mb-15px"
  9. label-width="68px"
  10. >
  11. <el-form-item label="任务名称" prop="name">
  12. <el-input
  13. v-model="queryParams.name"
  14. class="!w-240px"
  15. clearable
  16. placeholder="请输入任务名称"
  17. @keyup.enter="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="创建时间" prop="createTime">
  21. <el-date-picker
  22. v-model="queryParams.createTime"
  23. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  24. class="!w-240px"
  25. end-placeholder="结束日期"
  26. start-placeholder="开始日期"
  27. type="daterange"
  28. value-format="YYYY-MM-DD HH:mm:ss"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button @click="handleQuery">
  33. <Icon class="mr-5px" icon="ep:search" />
  34. 搜索
  35. </el-button>
  36. <el-button @click="resetQuery">
  37. <Icon class="mr-5px" icon="ep:refresh" />
  38. 重置
  39. </el-button>
  40. </el-form-item>
  41. </el-form>
  42. </ContentWrap>
  43. <!-- 列表 -->
  44. <ContentWrap>
  45. <el-table v-loading="loading" :data="list">
  46. <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
  47. <el-table-column
  48. align="center"
  49. label="发起人"
  50. prop="processInstance.startUser.nickname"
  51. width="100"
  52. />
  53. <el-table-column
  54. :formatter="dateFormatter"
  55. align="center"
  56. label="发起时间"
  57. prop="createTime"
  58. width="180"
  59. />
  60. <el-table-column align="center" label="当前任务" prop="name" width="180" />
  61. <el-table-column
  62. :formatter="dateFormatter"
  63. align="center"
  64. label="任务开始时间"
  65. prop="createTime"
  66. width="180"
  67. />
  68. <el-table-column
  69. :formatter="dateFormatter"
  70. align="center"
  71. label="任务结束时间"
  72. prop="endTime"
  73. width="180"
  74. />
  75. <el-table-column align="center" label="审批人" prop="assigneeUser.nickname" width="100" />
  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="processInstanceId" :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. // 它和【待办任务】【已办任务】的差异是,该菜单可以看全部的流程任务
  109. defineOptions({ name: 'BpmManagerTask' })
  110. const { push } = useRouter() // 路由
  111. const loading = ref(true) // 列表的加载中
  112. const total = ref(0) // 列表的总页数
  113. const list = ref([]) // 列表的数据
  114. const queryParams = reactive({
  115. pageNo: 1,
  116. pageSize: 10,
  117. name: '',
  118. createTime: []
  119. })
  120. const queryFormRef = ref() // 搜索的表单
  121. /** 查询任务列表 */
  122. const getList = async () => {
  123. loading.value = true
  124. try {
  125. const data = await TaskApi.getTaskManagerPage(queryParams)
  126. list.value = data.list
  127. total.value = data.total
  128. } finally {
  129. loading.value = false
  130. }
  131. }
  132. /** 搜索按钮操作 */
  133. const handleQuery = () => {
  134. queryParams.pageNo = 1
  135. getList()
  136. }
  137. /** 重置按钮操作 */
  138. const resetQuery = () => {
  139. queryFormRef.value.resetFields()
  140. handleQuery()
  141. }
  142. /** 处理审批按钮 */
  143. const handleAudit = (row: any) => {
  144. push({
  145. name: 'BpmProcessInstanceDetail',
  146. query: {
  147. id: row.processInstance.id
  148. }
  149. })
  150. }
  151. /** 初始化 **/
  152. onMounted(() => {
  153. getList()
  154. })
  155. </script>