allTaskWaiting.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <script setup lang="ts" name="FormManage">
  2. import apis from "@a"
  3. const tableRef = ref()
  4. const modalRef = ref()
  5. const opts = reactive({
  6. columns: [
  7. { field: "id", name: "主键", width: 100, isSort: true, visible: false, tooltip: true },
  8. {
  9. field: "flowName",
  10. name: "流程定义名称",
  11. visible: true,
  12. width: "auto",
  13. tooltip: true
  14. },
  15. {
  16. field: "flowCode",
  17. name: "流程定义编码",
  18. visible: true,
  19. width: 150,
  20. tooltip: true
  21. },
  22. { field: "nodeName", name: "任务名称", visible: true, width: 120, tooltip: true },
  23. { field: "createByName", name: "申请人", visible: true, width: 120, tooltip: true },
  24. { field: "categoryName", name: "流程分类", visible: true, width: 120, tooltip: true },
  25. { field: "version", name: "版本号", visible: true, width: 100, tooltip: true },
  26. { field: "assigneeName", name: "办理人", width: 300, visible: true, tooltip: true },
  27. { field: "flowStatus", name: "流程状态", width: 80, visible: true, tooltip: true },
  28. { field: "flowTaskStatus", name: "任务状态", width: 80, visible: true, tooltip: true },
  29. { field: "createTime", name: "创建时间", visible: true, width: 155, tooltip: true },
  30. { field: "actions", name: `操作`, width: 180 }
  31. ] as any,
  32. queryParams: {
  33. runStatus: "1",
  34. nodeName: undefined,
  35. flowName: undefined,
  36. createByIds: undefined
  37. },
  38. searchFormItems: [
  39. {
  40. field: "runStatus",
  41. label: "",
  42. class: "w-100",
  43. required: false,
  44. component: "VS",
  45. data: () => {
  46. return [
  47. { label: "待办任务", value: "1" },
  48. { label: "已办任务", value: "2" }
  49. ]
  50. },
  51. props: {
  52. type: "radio"
  53. },
  54. listeners: {
  55. change: (e) => {
  56. queryParams.value.runStatus = e
  57. handleQuery()
  58. }
  59. },
  60. span: 4
  61. },
  62. {
  63. field: "nodeName",
  64. label: "任务名称",
  65. class: "w-100",
  66. required: false,
  67. placeholder: "请输入任务名称",
  68. component: "I",
  69. listeners: {
  70. keyup: (e: KeyboardEvent) => {
  71. if (e.code == "Enter") {
  72. handleQuery()
  73. }
  74. }
  75. },
  76. span: 5
  77. },
  78. {
  79. field: "flowName",
  80. label: "流程定义名称",
  81. class: "w-100",
  82. required: false,
  83. placeholder: "请输入流程定义名称",
  84. component: "I",
  85. listeners: {
  86. keyup: (e: KeyboardEvent) => {
  87. if (e.code == "Enter") {
  88. handleQuery()
  89. }
  90. }
  91. },
  92. span: 5
  93. }
  94. ] as any,
  95. tableListFun: getTableListFun,
  96. labelWidth: "80px"
  97. })
  98. const { queryParams } = toRefs(opts)
  99. /** 搜索按钮操作 */
  100. function handleQuery(query?: any) {
  101. query = query || tableRef.value?.getQueryParams() || queryParams.value
  102. addDateRange(query, query.dateRangeCreateTime)
  103. addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
  104. tableRef.value?.query(query)
  105. }
  106. /** 重置按钮操作 */
  107. function resetQuery(query?: any) {
  108. query = query || tableRef.value?.getQueryParams() || queryParams.value
  109. query.dateRangeCreateTime = [] as any
  110. addDateRange(query, query.dateRangeCreateTime)
  111. query.dateRangeUpdateTime = [] as any
  112. addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
  113. //
  114. }
  115. const processMeddleRef = ref()
  116. const userSelectRef = ref()
  117. const applyUserSelectRef = ref()
  118. let curRow
  119. function handleUpdateAssignee(row: any) {
  120. curRow = row
  121. userSelectRef.value.open()
  122. }
  123. function onSubmitUpdateAssignee(data: any) {
  124. if (data && data.length > 0) {
  125. message
  126. .confirm(`是否将[${curRow.processDefinitionName}]任务的经办人更改为:${data[0].userName}`)
  127. .then(() => {
  128. apis.workflow.taskApi.updateAssignee(curRow.id, data[0].userId).then(() => {
  129. handleQuery()
  130. message.msgSuccess("修改成功")
  131. })
  132. })
  133. } else {
  134. message.msgWarning("请选择用户!")
  135. }
  136. }
  137. function handleView(row: any) {
  138. wfTaskJump(row, "view")
  139. }
  140. function handleMeddle(row: any) {
  141. processMeddleRef.value.open(row.id)
  142. }
  143. const selectUserIds = ref([])
  144. const userSelectCount = ref(0)
  145. //打开申请人选择
  146. const handleOpenUserSelect = () => {
  147. applyUserSelectRef.value.open()
  148. }
  149. const onSelectUserCallback = (data: any) => {
  150. userSelectCount.value = 0
  151. selectUserIds.value = []
  152. queryParams.value.createByIds = []
  153. if (data && data.length > 0) {
  154. userSelectCount.value = data.length
  155. selectUserIds.value = data.map((item) => item.userId)
  156. queryParams.value.createByIds = selectUserIds.value
  157. }
  158. }
  159. function onGetWaitingList() {
  160. queryParams.value.runStatus == "1"
  161. handleQuery()
  162. }
  163. function getTableListFun(query: any) {
  164. return new Promise((resolve, reject) => {
  165. queryParams.value.runStatus == "1"
  166. ? apis.workflow.taskApi.getPageByTaskWait(queryParams.value).then((res: any) => {
  167. resolve(res)
  168. })
  169. : apis.workflow.taskApi.getPageByTaskFinish(queryParams.value).then((res: any) => {
  170. resolve(res)
  171. })
  172. })
  173. }
  174. //消息组件
  175. const messageTypeRef = ref()
  176. function handleUrgeTaskOpen(row: any) {
  177. messageTypeRef.value.open()
  178. }
  179. function onUrgeTaskSubmit(data: any) {
  180. message.confirm(`是否催办任务`).then(() => {
  181. apis.workflow.taskApi.urgeTask(data).then(() => {
  182. messageTypeRef.value.close()
  183. message.msgSuccess("催办成功")
  184. handleQuery()
  185. })
  186. })
  187. }
  188. </script>
  189. <template>
  190. <div class="app-container">
  191. <VbDataTable
  192. ref="tableRef"
  193. keyField="id"
  194. :columns="opts.columns"
  195. :search-form-items="opts.searchFormItems"
  196. :remote-fun="opts.tableListFun"
  197. :modal="modalRef"
  198. v-model:query-params="queryParams"
  199. :check-multiple="true"
  200. :reset-search-form-fun="resetQuery"
  201. :custom-search-fun="handleQuery">
  202. <template #processDefinitionName="{ row }">
  203. <span>{{ row.processDefinitionName }}v{{ row.processDefinitionVersion }}.0</span>
  204. </template>
  205. <template #assigneeName="{ row }">
  206. <template v-if="queryParams.runStatus == '1'">
  207. <template v-if="row.participantVo && row.assignee === null">
  208. <el-tag
  209. class="me-1"
  210. v-for="(item, index) in row.participantVo.candidateName"
  211. :key="index"
  212. type="success">
  213. {{ item }}
  214. </el-tag>
  215. </template>
  216. <template v-else>
  217. <el-tag type="success">
  218. {{ row.assigneeName || "无" }}
  219. </el-tag>
  220. </template>
  221. </template>
  222. <template v-else>
  223. <el-tag type="success">
  224. {{ row.assigneeName || "无" }}
  225. </el-tag>
  226. </template>
  227. </template>
  228. <template #businessStatus="{ row }">
  229. <DictTag
  230. v-if="queryParams.runStatus == '1'"
  231. type="wf_business_status"
  232. :value="row.businessStatus"></DictTag>
  233. <el-tag v-else type="success">已完成</el-tag>
  234. </template>
  235. <template #createTime="{ row }">
  236. <span v-if="queryParams.runStatus == '1'">{{ row.createTime }}</span>
  237. <span v-else>{{ row.startTime }}</span>
  238. </template>
  239. <template #actions="{ row }">
  240. <vb-tooltip content="流程详情" placement="top">
  241. <el-button link type="success" @click="handleView(row)">
  242. <template #icon>
  243. <VbIcon icon-name="eye" icon-type="duotone" class="fs-3"></VbIcon>
  244. </template>
  245. </el-button>
  246. </vb-tooltip>
  247. <vb-tooltip v-if="queryParams.runStatus == '1'" content="流程干预" placement="top">
  248. <el-button link type="success" @click="handleMeddle(row)">
  249. <template #icon>
  250. <VbIcon icon-name="abstract-23" icon-type="duotone" class="fs-3"></VbIcon>
  251. </template>
  252. </el-button>
  253. </vb-tooltip>
  254. <vb-tooltip content="修改经办人" placement="top">
  255. <el-button
  256. link
  257. type="primary"
  258. @click="handleUpdateAssignee(row)"
  259. v-hasPermission="'workflow:formManage:edit'">
  260. <template #icon>
  261. <VbIcon icon-name="notepad-edit" icon-type="duotone" class="fs-3"></VbIcon>
  262. </template>
  263. </el-button>
  264. </vb-tooltip>
  265. <vb-tooltip content="催办" placement="top">
  266. <el-button
  267. link
  268. type="primary"
  269. @click="handleUrgeTaskOpen(row)"
  270. v-hasPermission="'workflow:formManage:edit'">
  271. <template #icon>
  272. <VbIcon icon-name="notepad-edit" icon-type="duotone" class="fs-3"></VbIcon>
  273. </template>
  274. </el-button>
  275. </vb-tooltip>
  276. </template>
  277. </VbDataTable>
  278. <!-- 选人组件 -->
  279. <UserSelect
  280. ref="userSelectRef"
  281. :multiple="false"
  282. @confirm="onSubmitUpdateAssignee"></UserSelect>
  283. <!-- 选人组件 -->
  284. <UserSelect
  285. ref="applyUserSelectRef"
  286. :multiple="true"
  287. :data="selectUserIds"
  288. @confirm="onSelectUserCallback"></UserSelect>
  289. <!-- 流程干预组件 -->
  290. <ProcessMeddle ref="processMeddleRef" @submit="onGetWaitingList"></ProcessMeddle>
  291. <!-- 流程催办组件 -->
  292. <MessageType ref="messageTypeRef" @submit="onUrgeTaskSubmit"></MessageType>
  293. </div>
  294. </template>