index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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
  80. label="所属流程"
  81. class="font-bold"
  82. label-position="top"
  83. prop="processDefinitionKey"
  84. >
  85. <el-select
  86. v-model="queryParams.processDefinitionKey"
  87. placeholder="请选择流程定义"
  88. clearable
  89. @change="handleQuery"
  90. class="!w-390px"
  91. >
  92. <el-option
  93. v-for="item in processDefinitionList"
  94. :key="item.key"
  95. :label="item.name"
  96. :value="item.key"
  97. />
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime">
  101. <el-date-picker
  102. v-model="queryParams.createTime"
  103. value-format="YYYY-MM-DD HH:mm:ss"
  104. type="daterange"
  105. start-placeholder="开始日期"
  106. end-placeholder="结束日期"
  107. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  108. class="!w-240px"
  109. />
  110. </el-form-item>
  111. <el-form-item class="bold-label" label-position="top">
  112. <el-button @click="handleQuery"> 确认</el-button>
  113. <el-button @click="showPopover = false"> 取消</el-button>
  114. <el-button @click="resetQuery"> 清空</el-button>
  115. </el-form-item>
  116. </el-popover>
  117. </el-form-item>
  118. </el-form>
  119. </ContentWrap>
  120. <!-- 列表 -->
  121. <ContentWrap>
  122. <el-table v-loading="loading" :data="list">
  123. <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
  124. <el-table-column label="摘要" prop="processInstance.summary" width="180">
  125. <template #default="scope">
  126. <div
  127. class="flex flex-col"
  128. v-if="scope.row.processInstance.summary && scope.row.processInstance.summary.length > 0"
  129. >
  130. <div v-for="(item, index) in scope.row.processInstance.summary" :key="index">
  131. <el-text type="info"> {{ item.key }} : {{ item.value }} </el-text>
  132. </div>
  133. </div>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. align="center"
  138. label="发起人"
  139. prop="processInstance.startUser.nickname"
  140. width="100"
  141. />
  142. <el-table-column
  143. :formatter="dateFormatter"
  144. align="center"
  145. label="发起时间"
  146. prop="createTime"
  147. width="180"
  148. />
  149. <el-table-column align="center" label="当前任务" prop="name" width="180" />
  150. <el-table-column
  151. :formatter="dateFormatter"
  152. align="center"
  153. label="任务开始时间"
  154. prop="createTime"
  155. width="180"
  156. />
  157. <el-table-column
  158. :formatter="dateFormatter"
  159. align="center"
  160. label="任务结束时间"
  161. prop="endTime"
  162. width="180"
  163. />
  164. <el-table-column align="center" label="审批状态" prop="status" width="120">
  165. <template #default="scope">
  166. <dict-tag :type="DICT_TYPE.BPM_TASK_STATUS" :value="scope.row.status" />
  167. </template>
  168. </el-table-column>
  169. <el-table-column align="center" label="审批建议" prop="reason" min-width="180" />
  170. <el-table-column align="center" label="耗时" prop="durationInMillis" width="160">
  171. <template #default="scope">
  172. {{ formatPast2(scope.row.durationInMillis) }}
  173. </template>
  174. </el-table-column>
  175. <el-table-column
  176. align="center"
  177. label="流程编号"
  178. prop="processInstanceId"
  179. :show-overflow-tooltip="true"
  180. />
  181. <el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
  182. <el-table-column align="center" label="操作" fixed="right" width="130">
  183. <template #default="scope">
  184. <el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
  185. <el-button link type="primary" @click="handleAudit(scope.row)">历史</el-button>
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. <!-- 分页 -->
  190. <Pagination
  191. v-model:limit="queryParams.pageSize"
  192. v-model:page="queryParams.pageNo"
  193. :total="total"
  194. @pagination="getList"
  195. />
  196. </ContentWrap>
  197. </template>
  198. <script lang="ts" setup>
  199. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  200. import { dateFormatter, formatPast2 } from '@/utils/formatTime'
  201. import * as TaskApi from '@/api/bpm/task'
  202. import { CategoryApi, CategoryVO } from '@/api/bpm/category'
  203. import * as DefinitionApi from '@/api/bpm/definition'
  204. defineOptions({ name: 'BpmDoneTask' })
  205. const { push } = useRouter() // 路由
  206. const message = useMessage()
  207. const loading = ref(true) // 列表的加载中
  208. const total = ref(0) // 列表的总页数
  209. const list = ref([]) // 列表的数据
  210. const processDefinitionList = ref<any[]>([]) // 流程定义列表
  211. const queryParams = reactive({
  212. pageNo: 1,
  213. pageSize: 10,
  214. name: '',
  215. category: undefined,
  216. status: undefined,
  217. processDefinitionKey: '',
  218. createTime: []
  219. })
  220. const queryFormRef = ref() // 搜索的表单
  221. const categoryList = ref<CategoryVO[]>([]) // 流程分类列表
  222. const showPopover = ref(false) // 高级筛选是否展示
  223. /** 查询任务列表 */
  224. const getList = async () => {
  225. loading.value = true
  226. try {
  227. const data = await TaskApi.getTaskDonePage(queryParams)
  228. list.value = data.list
  229. total.value = data.total
  230. } finally {
  231. loading.value = false
  232. }
  233. }
  234. /** 搜索按钮操作 */
  235. const handleQuery = () => {
  236. queryParams.pageNo = 1
  237. getList()
  238. }
  239. /** 重置按钮操作 */
  240. const resetQuery = () => {
  241. queryFormRef.value.resetFields()
  242. handleQuery()
  243. }
  244. /** 处理审批按钮 */
  245. const handleAudit = (row: any) => {
  246. push({
  247. name: 'BpmProcessInstanceDetail',
  248. query: {
  249. id: row.processInstance.id,
  250. taskId: row.id
  251. }
  252. })
  253. }
  254. /** 测回按钮 */
  255. const handleWithdraw = (row: any) => {
  256. TaskApi.withdrawTask(row.id).then(() => {
  257. message.success('撤回成功')
  258. getList()
  259. })
  260. }
  261. /** 初始化 **/
  262. onMounted(async () => {
  263. await getList()
  264. categoryList.value = await CategoryApi.getCategorySimpleList()
  265. // 获取流程定义列表
  266. processDefinitionList.value = await DefinitionApi.getSimpleProcessDefinitionList()
  267. })
  268. </script>