taskWaiting.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="p-2">
  3. <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
  4. <div v-show="showSearch" class="mb-[10px]">
  5. <el-card shadow="hover" :style="{ marginTop: '10px', height: '60px' }">
  6. <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true">
  7. <el-form-item label="任务名称" prop="name">
  8. <el-input v-model="queryParams.name" placeholder="请输入任务名称" @keyup.enter="handleQuery"/>
  9. </el-form-item>
  10. <el-form-item label="流程定义名称" label-width="100" prop="processDefinitionName">
  11. <el-input v-model="queryParams.processDefinitionName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery"/>
  12. </el-form-item>
  13. <el-form-item label="流程定义KEY" label-width="100" prop="processDefinitionKey">
  14. <el-input v-model="queryParams.processDefinitionKey" placeholder="请输入流程定义KEY" @keyup.enter="handleQuery"/>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  18. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  19. </el-form-item>
  20. </el-form>
  21. </el-card>
  22. </div>
  23. </transition>
  24. <el-card shadow="hover">
  25. <div class="table-content" style="height: 75vh">
  26. <el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
  27. <el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
  28. <el-table-column :show-overflow-tooltip="true" align="left" label="流程定义名称">
  29. <template #default="scope">
  30. <span>{{ scope.row.processDefinitionName }}v{{ scope.row.processDefinitionVersion }}.0</span>
  31. </template>
  32. </el-table-column>
  33. <el-table-column align="left" prop="processDefinitionKey" label="流程定义KEY"></el-table-column>
  34. <el-table-column align="left" prop="name" label="任务名称"></el-table-column>
  35. <el-table-column align="left" prop="assigneeName" label="办理人">
  36. <template #default="scope">
  37. <template v-if="scope.row.participantVo && scope.row.assignee === null">
  38. <el-tag v-for="(item, index) in scope.row.participantVo.candidateName" :key="index" type="success">
  39. {{ item }}
  40. </el-tag>
  41. </template>
  42. <template v-else>
  43. <el-tag type="success">
  44. {{ scope.row.assigneeName || '无' }}
  45. </el-tag>
  46. </template>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center" label="流程状态" min-width="70">
  50. <template #default="scope">
  51. <dict-tag :options="wf_business_status" :value="scope.row.businessStatus"></dict-tag>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="left" prop="createTime" label="创建时间" width="160"></el-table-column>
  55. <el-table-column label="操作" align="center" width="200">
  56. <template #default="scope">
  57. <el-button type="primary" size="small" icon="Edit" @click="handleOpen(scope.row)">办理</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. </div>
  62. <pagination
  63. v-show="total > 0"
  64. v-model:page="queryParams.pageNum"
  65. v-model:limit="queryParams.pageSize"
  66. :total="total"
  67. @pagination="handleQuery"
  68. />
  69. </el-card>
  70. </div>
  71. </template>
  72. <script lang="ts" setup>
  73. import {getPageByTaskWait} from '@/api/workflow/task';
  74. import {TaskQuery, TaskVO} from '@/api/workflow/task/types';
  75. import workflowCommon from '@/api/workflow/workflowCommon';
  76. import {RouterJumpVo} from '@/api/workflow/workflowCommon/types';
  77. const {proxy} = getCurrentInstance() as ComponentInternalInstance;
  78. const {wf_business_status} = toRefs<any>(proxy?.useDict('wf_business_status'));
  79. //提交组件
  80. const queryFormRef = ref<ElFormInstance>();
  81. // 遮罩层
  82. const loading = ref(true);
  83. // 选中数组
  84. const ids = ref<Array<any>>([]);
  85. // 非单个禁用
  86. const single = ref(true);
  87. // 非多个禁用
  88. const multiple = ref(true);
  89. // 显示搜索条件
  90. const showSearch = ref(true);
  91. // 总条数
  92. const total = ref(0);
  93. // 模型定义表格数据
  94. const taskList = ref([]);
  95. // 查询参数
  96. const queryParams = ref<TaskQuery>({
  97. pageNum: 1,
  98. pageSize: 10,
  99. name: undefined,
  100. processDefinitionName: undefined,
  101. processDefinitionKey: undefined
  102. });
  103. onMounted(() => {
  104. getWaitingList();
  105. });
  106. /** 搜索按钮操作 */
  107. const handleQuery = () => {
  108. getWaitingList();
  109. };
  110. /** 重置按钮操作 */
  111. const resetQuery = () => {
  112. queryFormRef.value?.resetFields();
  113. queryParams.value.pageNum = 1;
  114. queryParams.value.pageSize = 10;
  115. handleQuery();
  116. };
  117. // 多选框选中数据
  118. const handleSelectionChange = (selection: any) => {
  119. ids.value = selection.map((item: any) => item.id);
  120. single.value = selection.length !== 1;
  121. multiple.value = !selection.length;
  122. };
  123. //分页
  124. const getWaitingList = () => {
  125. loading.value = true;
  126. getPageByTaskWait(queryParams.value).then((resp) => {
  127. taskList.value = resp.rows;
  128. total.value = resp.total;
  129. loading.value = false;
  130. });
  131. };
  132. //办理
  133. const handleOpen = async (row: TaskVO) => {
  134. const routerJumpVo = reactive<RouterJumpVo>({
  135. wfDefinitionConfigVo: row.wfDefinitionConfigVo,
  136. wfNodeConfigVo: row.wfNodeConfigVo,
  137. businessKey: row.businessKey,
  138. taskId: row.id,
  139. type: 'approval'
  140. });
  141. workflowCommon.routerJump(routerJumpVo, proxy);
  142. };
  143. </script>