pending.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <ibps-layout ref="layout">
  3. <div slot="west">
  4. <ibps-type-tree
  5. :width="width"
  6. :height="height"
  7. title="任务分类"
  8. category-key="FLOW_TYPE"
  9. @node-click="handleNodeClick"
  10. @expand-collapse="handleExpandCollapse"
  11. />
  12. </div>
  13. <ibps-crud
  14. ref="crud"
  15. :style="{ marginLeft: width+'px' }"
  16. :height="height"
  17. :data="listData"
  18. :toolbars="listConfig.toolbars"
  19. :search-form="listConfig.searchForm"
  20. :pk-key="pkKey"
  21. :columns="listConfig.columns"
  22. :row-handle="listConfig.rowHandle"
  23. :pagination="pagination"
  24. :loading="loading"
  25. :index-row="false"
  26. @action-event="handleAction"
  27. @sort-change="handleSortChange"
  28. @column-link-click="handleLinkClick"
  29. @pagination-change="handlePaginationChange"
  30. >
  31. <template slot="searchFormCreator">
  32. <ibps-employee-selector
  33. v-model="searchFormCreator"
  34. style="width:200px;"
  35. />
  36. </template>
  37. <template v-slot:ownerName="{value}">
  38. <el-popover trigger="hover" placement="top" width="250">
  39. {{ value }}
  40. <div slot="reference" class="ibps-ellipsis">
  41. {{ value }}
  42. </div>
  43. </el-popover>
  44. </template>
  45. </ibps-crud>
  46. <bpmn-formrender
  47. :visible="dialogFormVisible"
  48. :task-id="taskId"
  49. :title="flowName"
  50. @callback="search"
  51. @close="visible => dialogFormVisible = visible"
  52. />
  53. <!-- 转办 -->
  54. <delegate
  55. :task-id="taskId"
  56. :title="title"
  57. :visible="delegateVisible"
  58. @callback="search"
  59. @close="visible => delegateVisible = visible"
  60. />
  61. <!-- 批量审批 -->
  62. <approve-dialog
  63. :visible="approveDialogVisible"
  64. :title="title"
  65. :task-id="taskId"
  66. :action="action"
  67. @callback="search"
  68. @close="visible => approveDialogVisible = visible"
  69. />
  70. </ibps-layout>
  71. </template>
  72. <script>
  73. import { pending } from '@/api/platform/office/bpmReceived'
  74. import { batchSuspendProcess, batchRecoverProcess } from '@/api/platform/bpmn/bpmTask'
  75. import ActionUtils from '@/utils/action'
  76. import FixHeight from '@/mixins/height'
  77. import { taskTypeOptions } from '@/business/platform/bpmn/constants'
  78. import IbpsTypeTree from '@/business/platform/cat/type/tree'
  79. import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
  80. import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
  81. import Delegate from '@/business/platform/bpmn/task-change/edit'
  82. import ApproveDialog from '@/business/platform/bpmn/form-ext/approve'
  83. export default {
  84. components: {
  85. IbpsTypeTree,
  86. IbpsEmployeeSelector,
  87. Delegate,
  88. ApproveDialog,
  89. BpmnFormrender
  90. },
  91. mixins: [FixHeight],
  92. data() {
  93. return {
  94. width: 200,
  95. height: document.clientHeight,
  96. dialogFormVisible: false, // 弹窗
  97. approveDialogVisible: false, // 批量审批
  98. flowName:'',
  99. delegateVisible: false,
  100. action: '',
  101. taskId: '', // 编辑dialog需要使用
  102. title: '',
  103. pkKey: 'id', // 主键 如果主键不是pk需要传主键
  104. typeId: '',
  105. loading: false,
  106. listData: [],
  107. listConfig: {
  108. // 工具栏
  109. toolbars: [
  110. { key: 'search' },
  111. {
  112. key: 'agree',
  113. label: '同意',
  114. icon: 'ibps-icon-check-square-o'
  115. },
  116. {
  117. key: 'stop',
  118. label: '终止',
  119. icon: 'ibps-icon-ioxhost'
  120. },
  121. {
  122. key: 'suspend',
  123. label: '挂起',
  124. icon: 'ibps-icon-ioxhost '
  125. },
  126. {
  127. key: 'recover',
  128. label: '恢复',
  129. icon: 'ibps-icon-ioxhost '
  130. }
  131. ],
  132. // 查询条件
  133. searchForm: {
  134. forms: [
  135. { prop: 'Q^subject_^SL', name: 'Q^temp.subject_^SL', label: '请求标题', link: 'dialog', labelWidth: 80, itemWidth: 200 },
  136. { prop: 'Q^procDefName^SL', name: 'Q^temp.procDefName^SL', label: '流程名称', labelWidth: 80, itemWidth: 200 },
  137. {
  138. prop: ['Q^create_time_^DL', 'Q^create_time_^DG'],
  139. name: ['Q^temp.create_time_^DL', 'Q^temp.create_time_^DG'],
  140. label: '时间',
  141. fieldType: 'daterange',
  142. labelWidth: 80,
  143. itemWidth: 200
  144. },
  145. { prop: 'taskType',
  146. label: '任务类型',
  147. itemWidth: 200,
  148. fieldType: 'select',
  149. labelWidth: 80,
  150. options: taskTypeOptions
  151. }
  152. ]
  153. },
  154. // 表格字段配置
  155. columns: [
  156. { prop: 'taskSubjectName', label: '请求标题', link: 'dialog' },
  157. { prop: 'procDefName', label: '流程名称', width: 120 },
  158. { prop: 'name', label: '当前节点', width: 120 },
  159. { prop: 'createTime', label: '创建时间', width: 140 },
  160. { prop: 'ownerName', label: '所属人', width: 150 },
  161. { prop: 'status', label: '待办类型', tags: taskTypeOptions, width: 100 }
  162. ],
  163. // 管理列
  164. rowHandle: {
  165. effect: 'display',
  166. width: '80px',
  167. actions: [
  168. {
  169. key: 'delegate',
  170. label: '转办',
  171. icon: 'ibps-icon-mail-forward',
  172. hidden: (row, index) => {
  173. if (row.allowShfit === 'Y') return false
  174. return true
  175. }
  176. }
  177. ]
  178. }
  179. },
  180. pagination: {},
  181. sorts: {},
  182. searchFormCreator: ''
  183. }
  184. },
  185. created() {
  186. this.loadData()
  187. },
  188. methods: {
  189. /**
  190. * 加载数据
  191. */
  192. loadData() {
  193. this.loading = true
  194. pending(this.getFormatParams()).then(response => {
  195. response.data.dataResult.forEach((item) => {
  196. const taskSubject = item.subject.split('#')
  197. this.$set(item, 'taskSubjectName', taskSubject[0] +'#'+ taskSubject[1]+'#')
  198. })
  199. ActionUtils.handleListData(this, response.data)
  200. this.loading = false
  201. }).catch(() => {
  202. this.loading = false
  203. })
  204. },
  205. /**
  206. * 获取格式化参数
  207. */
  208. getFormatParams() {
  209. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  210. if (this.$utils.isNotEmpty(this.searchFormCreator)) {
  211. params['Q^creatorId^SL'] = this.searchFormCreator
  212. }
  213. if (this.$utils.isNotEmpty(this.typeId)) {
  214. params['Q^temp.TYPE_ID_^S'] = this.typeId
  215. }
  216. return ActionUtils.formatParams(
  217. params,
  218. this.pagination,
  219. this.sorts)
  220. },
  221. /**
  222. * 处理分页事件
  223. */
  224. handlePaginationChange(page) {
  225. ActionUtils.setPagination(this.pagination, page)
  226. this.loadData()
  227. },
  228. /**
  229. * 处理排序
  230. */
  231. handleSortChange(sort) {
  232. ActionUtils.setSorts(this.sorts, sort)
  233. this.loadData()
  234. },
  235. search() {
  236. this.loadData()
  237. },
  238. /**
  239. * 重置查询条件
  240. */
  241. reset() {
  242. this.$refs['crud'].handleReset()
  243. },
  244. /**
  245. * 点击表格
  246. */
  247. handleLinkClick(data, columns) {
  248. this.taskId = data.taskId || ''
  249. this.flowName =data.name
  250. this.dialogFormVisible = true
  251. },
  252. /**
  253. * 处理按钮事件
  254. */
  255. handleAction(command, position, selection, data) {
  256. switch (command) {
  257. case 'search':// 查询
  258. ActionUtils.setFirstPagination(this.pagination)
  259. this.search()
  260. break
  261. case 'stop': // 终止
  262. ActionUtils.selectedMultiRecord(selection).then((ids) => {
  263. this.handleBatchApprove(ids, 'stop')
  264. this.title = '批量终止流程'
  265. }).catch(() => { })
  266. break
  267. case 'agree': // 同意
  268. ActionUtils.selectedMultiRecord(selection).then((ids) => {
  269. this.handleBatchApprove(ids, 'agree')
  270. this.title = '批量同意审批'
  271. }).catch(() => { })
  272. break
  273. case 'suspend': // 挂起
  274. ActionUtils.selectedMultiRecord(selection).then((ids) => {
  275. this.handleSuspend(ids)
  276. }).catch(() => { })
  277. break
  278. case 'recover': // 恢复
  279. ActionUtils.selectedMultiRecord(selection).then((ids) => {
  280. this.handleRecover(ids)
  281. }).catch(() => { })
  282. break
  283. case 'delegate': // 转办
  284. ActionUtils.selectedRecord(selection).then((id) => {
  285. this.title = '任务转办'
  286. this.handleDelegate(id)
  287. }).catch(() => { })
  288. break
  289. default:
  290. break
  291. }
  292. },
  293. handleNodeClick(typeId) {
  294. this.typeId = typeId
  295. this.loadData()
  296. },
  297. /**
  298. * 处理批量审批
  299. */
  300. handleBatchApprove(id = '', action = 'agree') {
  301. this.taskId = id
  302. this.action = action
  303. this.approveDialogVisible = true
  304. },
  305. /**
  306. * 批量挂起任务
  307. */
  308. handleSuspend(ids) {
  309. this.$confirm('确认批量挂起流程任务?', '信息').then(() => {
  310. batchSuspendProcess({ taskIds: ids }).then(() => {
  311. ActionUtils.successMessage('挂起流程任务成功')
  312. this.search()
  313. }).catch(err => {
  314. console.error(err)
  315. })
  316. })
  317. },
  318. /**
  319. * 批量挂起任务
  320. */
  321. handleRecover(ids) {
  322. this.$confirm('确认批量恢复流程任务?', '信息').then(() => {
  323. batchRecoverProcess({ taskIds: ids }).then(() => {
  324. ActionUtils.successMessage('恢复流程任务成功')
  325. this.search()
  326. }).catch(err => {
  327. console.error(err)
  328. })
  329. })
  330. },
  331. handleDelegate(id) {
  332. this.taskId = id
  333. this.delegateVisible = true
  334. },
  335. handleExpandCollapse(isExpand) {
  336. this.width = isExpand ? 230 : 30
  337. }
  338. }
  339. }
  340. </script>