index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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="id" width="300px" />
  48. <el-table-column align="center" label="任务名称" prop="name" />
  49. <el-table-column align="center" label="所属流程" prop="processInstance.name" />
  50. <el-table-column align="center" label="流程发起人" prop="processInstance.startUserNickname" />
  51. <el-table-column align="center" label="状态" prop="result">
  52. <template #default="scope">
  53. <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result" />
  54. </template>
  55. </el-table-column>
  56. <el-table-column align="center" label="原因" prop="reason" />
  57. <el-table-column
  58. :formatter="dateFormatter"
  59. align="center"
  60. label="创建时间"
  61. prop="createTime"
  62. width="180"
  63. />
  64. <el-table-column align="center" label="操作">
  65. <template #default="scope">
  66. <el-button link type="primary" @click="openDetail(scope.row)">详情</el-button>
  67. <el-button link type="primary" @click="handleAudit(scope.row)">流程</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <!-- 分页 -->
  72. <Pagination
  73. v-model:limit="queryParams.pageSize"
  74. v-model:page="queryParams.pageNo"
  75. :total="total"
  76. @pagination="getList"
  77. />
  78. </ContentWrap>
  79. <!-- 表单弹窗:详情 -->
  80. <TaskDetail ref="detailRef" @success="getList" />
  81. </template>
  82. <script lang="ts" setup>
  83. import { DICT_TYPE } from '@/utils/dict'
  84. import { dateFormatter } from '@/utils/formatTime'
  85. import * as TaskApi from '@/api/bpm/task'
  86. import TaskDetail from './TaskDetail.vue'
  87. defineOptions({ name: 'BpmTodoTask' })
  88. const { push } = useRouter() // 路由
  89. const loading = ref(true) // 列表的加载中
  90. const total = ref(0) // 列表的总页数
  91. const list = ref([]) // 列表的数据
  92. const queryParams = reactive({
  93. pageNo: 1,
  94. pageSize: 10,
  95. name: '',
  96. createTime: []
  97. })
  98. const queryFormRef = ref() // 搜索的表单
  99. /** 查询任务列表 */
  100. const getList = async () => {
  101. loading.value = true
  102. try {
  103. const data = await TaskApi.getDoneTaskPage(queryParams)
  104. list.value = data.list
  105. total.value = data.total
  106. } finally {
  107. loading.value = false
  108. }
  109. }
  110. /** 搜索按钮操作 */
  111. const handleQuery = () => {
  112. queryParams.pageNo = 1
  113. getList()
  114. }
  115. /** 重置按钮操作 */
  116. const resetQuery = () => {
  117. queryFormRef.value.resetFields()
  118. handleQuery()
  119. }
  120. /** 详情操作 */
  121. const detailRef = ref()
  122. const openDetail = (row: TaskApi.TaskVO) => {
  123. detailRef.value.open(row)
  124. }
  125. /** 处理审批按钮 */
  126. const handleAudit = (row) => {
  127. push({
  128. name: 'BpmProcessInstanceDetail',
  129. query: {
  130. id: row.processInstance.id
  131. }
  132. })
  133. }
  134. /** 初始化 **/
  135. onMounted(() => {
  136. getList()
  137. })
  138. </script>