taskFinish.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <script setup lang="ts" name="FormManage">
  2. import apis from "@a"
  3. import router from "@r"
  4. const tableRef = ref()
  5. const modalRef = ref()
  6. const opts = reactive({
  7. columns: [
  8. { field: "id", name: "主键", width: 100, isSort: true, visible: false, tooltip: true },
  9. { field: "businessCode", name: "业务编码", visible: true, width: "auto", tooltip: true },
  10. { field: "businessTitle", name: "业务标题", visible: true, width: "auto", tooltip: true },
  11. { field: "flowName", name: "流程定义名称", visible: true, width: 120, tooltip: true },
  12. { field: "flowCode", name: "流程定义编码", visible: true, width: 120, tooltip: true },
  13. { field: "categoryName", name: "流程分类", visible: true, width: 120, tooltip: true },
  14. { field: "nodeName", name: "任务名称", visible: true, width: 150, tooltip: true },
  15. { field: "createByName", name: "申请人", width: 140, visible: true, tooltip: true },
  16. { field: "assigneeName", name: "办理人", width: 300, visible: true, tooltip: true },
  17. { field: "flowStatus", name: "流程状态", width: 100, visible: true, tooltip: true },
  18. { field: "flowTaskStatus", name: "任务状态", width: 100, visible: true, tooltip: true },
  19. { field: "createTime", name: "创建时间", visible: true, width: 150, tooltip: true },
  20. { field: "actions", name: `操作`, width: 80 }
  21. ] as any[],
  22. queryParams: {
  23. nodeName: undefined,
  24. flowName: undefined,
  25. flowCode: undefined,
  26. createByIds: undefined
  27. },
  28. searchFormItems: [
  29. {
  30. field: "nodeName",
  31. label: "任务名称",
  32. class: "w-100",
  33. required: false,
  34. placeholder: "请输入任务名称",
  35. component: "I",
  36. listeners: {
  37. keyup: (e: KeyboardEvent) => {
  38. if (e.code == "Enter") {
  39. handleQuery()
  40. }
  41. }
  42. },
  43. span: 5
  44. },
  45. {
  46. field: "flowName",
  47. label: "流程定义名称",
  48. class: "w-100",
  49. required: false,
  50. placeholder: "请输入流程定义名称",
  51. component: "I",
  52. listeners: {
  53. keyup: (e: KeyboardEvent) => {
  54. if (e.code == "Enter") {
  55. handleQuery()
  56. }
  57. }
  58. },
  59. span: 5
  60. },
  61. {
  62. field: "flowCode",
  63. label: "流程定义编码",
  64. class: "w-100",
  65. required: false,
  66. placeholder: "请输入流程定义编码",
  67. component: "I",
  68. listeners: {
  69. keyup: (e: KeyboardEvent) => {
  70. if (e.code == "Enter") {
  71. handleQuery()
  72. }
  73. }
  74. },
  75. span: 5
  76. }
  77. ] as any,
  78. tableListFun: apis.workflow.taskApi.getPageByTaskFinish,
  79. labelWidth: "80px"
  80. })
  81. const { queryParams } = toRefs(opts)
  82. /** 搜索按钮操作 */
  83. function handleQuery(query?: any) {
  84. query = query || tableRef.value?.getQueryParams() || queryParams.value
  85. addDateRange(query, query.dateRangeCreateTime)
  86. addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
  87. tableRef.value?.query(query)
  88. }
  89. /** 重置按钮操作 */
  90. function resetQuery(query?: any) {
  91. query = query || tableRef.value?.getQueryParams() || queryParams.value
  92. query.dateRangeCreateTime = [] as any
  93. addDateRange(query, query.dateRangeCreateTime)
  94. query.dateRangeUpdateTime = [] as any
  95. addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
  96. //
  97. }
  98. function handleView(row: any) {
  99. wfTaskJump(row, "view")
  100. }
  101. const userSelectRef = ref()
  102. const selectUserIds = ref<Array<number | string>>([])
  103. const userSelectCount = ref(0)
  104. function handleOpenSelectUser() {
  105. userSelectRef.value.open()
  106. }
  107. //确认选择申请人
  108. function onUserSelect(data: any) {
  109. userSelectCount.value = 0
  110. selectUserIds.value = []
  111. queryParams.value.createByIds = []
  112. if (data && data.length > 0) {
  113. userSelectCount.value = data.length
  114. selectUserIds.value = data.map((item) => item.userId)
  115. queryParams.value.createByIds = selectUserIds.value
  116. }
  117. }
  118. </script>
  119. <template>
  120. <div class="app-container">
  121. <VbDataTable
  122. ref="tableRef"
  123. keyField="id"
  124. :columns="opts.columns"
  125. :search-form-items="opts.searchFormItems"
  126. :remote-fun="opts.tableListFun"
  127. :modal="modalRef"
  128. v-model:query-params="queryParams"
  129. :check-multiple="true"
  130. :reset-search-form-fun="resetQuery"
  131. :custom-search-fun="handleQuery">
  132. <template #flowName="{ row }">
  133. <span>{{ row.flowName }}v{{ row.version }}.0</span>
  134. </template>
  135. <template #assigneeName="{ row }">
  136. <el-tag type="success">
  137. {{ row.assigneeName || "无" }}
  138. </el-tag>
  139. </template>
  140. <template #flowStatus="{ row }">
  141. <DictTag type="wf_business_status" :value="row.flowStatus"></DictTag>
  142. </template>
  143. <template #flowTaskStatus="{ row }">
  144. <DictTag type="wf_task_status" :value="row.flowTaskStatus"></DictTag>
  145. </template>
  146. <template #actions="{ row }">
  147. <vb-tooltip content="详情" placement="top">
  148. <el-button link type="success" @click="handleView(row)">
  149. <template #icon>
  150. <VbIcon icon-name="eye" icon-type="duotone" class="fs-3"></VbIcon>
  151. </template>
  152. </el-button>
  153. </vb-tooltip>
  154. </template>
  155. </VbDataTable>
  156. <UserSelect
  157. ref="userSelectRef"
  158. :multiple="true"
  159. :data="selectUserIds"
  160. @confirm="onUserSelect"></UserSelect>
  161. </div>
  162. </template>