index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 label="摘要" prop="processInstance.summary" min-width="180">
  119. <template #default="scope">
  120. <div class="flex flex-col" v-if="scope.row.processInstance.summary && scope.row.processInstance.summary.length > 0">
  121. <div v-for="(item, index) in scope.row.processInstance.summary" :key="index">
  122. <el-text type="info"> {{ item.key }} : {{ item.value }} </el-text>
  123. </div>
  124. </div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column
  128. align="center"
  129. label="发起人"
  130. prop="processInstance.startUser.nickname"
  131. width="100"
  132. />
  133. <el-table-column
  134. :formatter="dateFormatter"
  135. align="center"
  136. label="发起时间"
  137. prop="createTime"
  138. width="180"
  139. />
  140. <el-table-column align="center" label="当前任务" prop="name" width="180" />
  141. <el-table-column
  142. :formatter="dateFormatter"
  143. align="center"
  144. label="任务开始时间"
  145. prop="createTime"
  146. width="180"
  147. />
  148. <el-table-column
  149. :formatter="dateFormatter"
  150. align="center"
  151. label="任务结束时间"
  152. prop="endTime"
  153. width="180"
  154. />
  155. <el-table-column align="center" label="审批状态" prop="status" width="120">
  156. <template #default="scope">
  157. <dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="scope.row.status" />
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="center" label="审批建议" prop="reason" min-width="180" />
  161. <el-table-column align="center" label="耗时" prop="durationInMillis" width="160">
  162. <template #default="scope">
  163. {{ formatPast2(scope.row.durationInMillis) }}
  164. </template>
  165. </el-table-column>
  166. <el-table-column align="center" label="流程编号" prop="id" :show-overflow-tooltip="true" />
  167. <el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
  168. <el-table-column align="center" label="操作" fixed="right" width="80">
  169. <template #default="scope">
  170. <el-button link type="primary" @click="handleAudit(scope.row)">历史</el-button>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. <!-- 分页 -->
  175. <Pagination
  176. v-model:limit="queryParams.pageSize"
  177. v-model:page="queryParams.pageNo"
  178. :total="total"
  179. @pagination="getList"
  180. />
  181. </ContentWrap>
  182. </template>
  183. <script lang="ts" setup>
  184. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  185. import { dateFormatter, formatPast2 } from '@/utils/formatTime'
  186. import * as TaskApi from '@/api/bpm/task'
  187. import { CategoryApi, CategoryVO } from '@/api/bpm/category'
  188. defineOptions({ name: 'BpmTodoTask' })
  189. const { push } = useRouter() // 路由
  190. const loading = ref(true) // 列表的加载中
  191. const total = ref(0) // 列表的总页数
  192. const list = ref([]) // 列表的数据
  193. const queryParams = reactive({
  194. pageNo: 1,
  195. pageSize: 10,
  196. name: '',
  197. category: undefined,
  198. status: undefined,
  199. createTime: []
  200. })
  201. const queryFormRef = ref() // 搜索的表单
  202. const categoryList = ref<CategoryVO[]>([]) // 流程分类列表
  203. const showPopover = ref(false)
  204. /** 查询任务列表 */
  205. const getList = async () => {
  206. loading.value = true
  207. try {
  208. const data = await TaskApi.getTaskDonePage(queryParams)
  209. list.value = data.list
  210. total.value = data.total
  211. } finally {
  212. loading.value = false
  213. }
  214. }
  215. /** 搜索按钮操作 */
  216. const handleQuery = () => {
  217. queryParams.pageNo = 1
  218. getList()
  219. }
  220. /** 重置按钮操作 */
  221. const resetQuery = () => {
  222. queryFormRef.value.resetFields()
  223. handleQuery()
  224. }
  225. /** 处理审批按钮 */
  226. const handleAudit = (row: any) => {
  227. push({
  228. name: 'BpmProcessInstanceDetail',
  229. query: {
  230. id: row.processInstance.id,
  231. taskId: row.id
  232. }
  233. })
  234. }
  235. /** 初始化 **/
  236. onMounted(async () => {
  237. await getList()
  238. categoryList.value = await CategoryApi.getCategorySimpleList()
  239. })
  240. </script>