index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <doc-alert title="审批通过、不通过、驳回" url="https://doc.iocoder.cn/bpm/task-todo-done/" />
  3. <doc-alert title="审批加签、减签" url="https://doc.iocoder.cn/bpm/sign/" />
  4. <doc-alert
  5. title="审批转办、委派、抄送"
  6. url="https://doc.iocoder.cn/bpm/task-delegation-and-cc/"
  7. />
  8. <doc-alert title="审批加签、减签" url="https://doc.iocoder.cn/bpm/sign/" />
  9. <ContentWrap>
  10. <!-- 搜索工作栏 -->
  11. <el-form
  12. ref="queryFormRef"
  13. :inline="true"
  14. :model="queryParams"
  15. class="-mb-15px"
  16. label-width="68px"
  17. >
  18. <el-form-item label="" prop="name">
  19. <el-input
  20. v-model="queryParams.name"
  21. class="!w-240px"
  22. clearable
  23. placeholder="请输入任务名称"
  24. @keyup.enter="handleQuery"
  25. />
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button @click="handleQuery">
  29. <Icon class="mr-5px" icon="ep:search" />
  30. 搜索
  31. </el-button>
  32. </el-form-item>
  33. <el-form-item label="" prop="category" :style="{ position: 'absolute', right: '300px' }">
  34. <el-select
  35. v-model="queryParams.category"
  36. placeholder="请选择流程分类"
  37. clearable
  38. class="!w-155px"
  39. @change="handleQuery"
  40. >
  41. <el-option
  42. v-for="category in categoryList"
  43. :key="category.code"
  44. :label="category.name"
  45. :value="category.code"
  46. />
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item label="" prop="status" :style="{ position: 'absolute', right: '130px' }">
  50. <el-select
  51. v-model="queryParams.status"
  52. placeholder="请选择流程状态"
  53. clearable
  54. class="!w-155px"
  55. @change="handleQuery"
  56. >
  57. <el-option
  58. v-for="dict in getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)"
  59. :key="dict.value"
  60. :label="dict.label"
  61. :value="dict.value"
  62. />
  63. </el-select>
  64. </el-form-item>
  65. <!-- 高级筛选 -->
  66. <el-form-item :style="{ position: 'absolute', right: '0px' }">
  67. <el-popover
  68. :visible="showPopover"
  69. persistent
  70. :width="400"
  71. :show-arrow="false"
  72. placement="bottom-end"
  73. >
  74. <template #reference>
  75. <el-button @click="showPopover = !showPopover" >
  76. <Icon icon="ep:plus" class="mr-5px" />高级筛选
  77. </el-button>
  78. </template>
  79. <el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category">
  80. <el-select
  81. v-model="queryParams.category"
  82. placeholder="请选择流程发起人"
  83. clearable
  84. class="!w-390px"
  85. >
  86. <el-option
  87. v-for="category in categoryList"
  88. :key="category.code"
  89. :label="category.name"
  90. :value="category.code"
  91. />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime">
  95. <el-date-picker
  96. v-model="queryParams.createTime"
  97. value-format="YYYY-MM-DD HH:mm:ss"
  98. type="daterange"
  99. start-placeholder="开始日期"
  100. end-placeholder="结束日期"
  101. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  102. class="!w-240px"
  103. />
  104. </el-form-item>
  105. <el-form-item class="bold-label" label-position="top">
  106. <el-button @click="handleQuery"> 确认</el-button>
  107. <el-button @click="showPopover = false"> 取消</el-button>
  108. <el-button @click="resetQuery"> 清空</el-button>
  109. </el-form-item>
  110. </el-popover>
  111. </el-form-item>
  112. </el-form>
  113. </ContentWrap>
  114. <!-- 列表 -->
  115. <ContentWrap>
  116. <el-table v-loading="loading" :data="list">
  117. <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
  118. <el-table-column
  119. align="center"
  120. label="发起人"
  121. prop="processInstance.startUser.nickname"
  122. width="100"
  123. />
  124. <el-table-column
  125. :formatter="dateFormatter"
  126. align="center"
  127. label="发起时间"
  128. prop="createTime"
  129. width="180"
  130. />
  131. <el-table-column align="center" label="当前任务" prop="name" width="180" />
  132. <el-table-column
  133. :formatter="dateFormatter"
  134. align="center"
  135. label="任务开始时间"
  136. prop="createTime"
  137. width="180"
  138. />
  139. <el-table-column
  140. :formatter="dateFormatter"
  141. align="center"
  142. label="任务结束时间"
  143. prop="endTime"
  144. width="180"
  145. />
  146. <el-table-column align="center" label="审批状态" prop="status" width="120">
  147. <template #default="scope">
  148. <dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="scope.row.status" />
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="center" label="审批建议" prop="reason" min-width="180" />
  152. <el-table-column align="center" label="耗时" prop="durationInMillis" width="160">
  153. <template #default="scope">
  154. {{ formatPast2(scope.row.durationInMillis) }}
  155. </template>
  156. </el-table-column>
  157. <el-table-column align="center" label="流程编号" prop="id" :show-overflow-tooltip="true" />
  158. <el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
  159. <el-table-column align="center" label="操作" fixed="right" width="80">
  160. <template #default="scope">
  161. <el-button link type="primary" @click="handleAudit(scope.row)">历史</el-button>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <!-- 分页 -->
  166. <Pagination
  167. v-model:limit="queryParams.pageSize"
  168. v-model:page="queryParams.pageNo"
  169. :total="total"
  170. @pagination="getList"
  171. />
  172. </ContentWrap>
  173. </template>
  174. <script lang="ts" setup>
  175. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  176. import { dateFormatter, formatPast2 } from '@/utils/formatTime'
  177. import * as TaskApi from '@/api/bpm/task'
  178. import { CategoryApi, CategoryVO } from '@/api/bpm/category'
  179. defineOptions({ name: 'BpmTodoTask' })
  180. const { push } = useRouter() // 路由
  181. const loading = ref(true) // 列表的加载中
  182. const total = ref(0) // 列表的总页数
  183. const list = ref([]) // 列表的数据
  184. const queryParams = reactive({
  185. pageNo: 1,
  186. pageSize: 10,
  187. name: '',
  188. category: undefined,
  189. status: undefined,
  190. createTime: []
  191. })
  192. const queryFormRef = ref() // 搜索的表单
  193. const categoryList = ref<CategoryVO[]>([]) // 流程分类列表
  194. const showPopover = ref(false)
  195. /** 查询任务列表 */
  196. const getList = async () => {
  197. loading.value = true
  198. try {
  199. const data = await TaskApi.getTaskDonePage(queryParams)
  200. list.value = data.list
  201. total.value = data.total
  202. } finally {
  203. loading.value = false
  204. }
  205. }
  206. /** 搜索按钮操作 */
  207. const handleQuery = () => {
  208. queryParams.pageNo = 1
  209. getList()
  210. }
  211. /** 重置按钮操作 */
  212. const resetQuery = () => {
  213. queryFormRef.value.resetFields()
  214. handleQuery()
  215. }
  216. /** 处理审批按钮 */
  217. const handleAudit = (row: any) => {
  218. push({
  219. name: 'BpmProcessInstanceDetail',
  220. query: {
  221. id: row.processInstance.id,
  222. taskId: row.id
  223. }
  224. })
  225. }
  226. /** 初始化 **/
  227. onMounted(async () => {
  228. await getList()
  229. categoryList.value = await CategoryApi.getCategorySimpleList()
  230. })
  231. </script>