process.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!--
  2. - Copyright (c) 2018-2025, lengleng All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions are met:
  6. -
  7. - Redistributions of source code must retain the above copyright notice,
  8. - this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. - notice, this list of conditions and the following disclaimer in the
  11. - documentation and/or other materials provided with the distribution.
  12. - Neither the name of the pig4cloud.com developer nor the names of its
  13. - contributors may be used to endorse or promote products derived from
  14. - this software without specific prior written permission.
  15. - Author: lengleng (wangiegie@gmail.com)
  16. -->
  17. <template>
  18. <div class="execution">
  19. <basic-container>
  20. <avue-crud
  21. ref="crud"
  22. :page="page"
  23. :data="tableData"
  24. :table-loading="tableLoading"
  25. :option="tableOption"
  26. @on-load="getList"
  27. @search-change="searchChange"
  28. @refresh-change="refreshChange"
  29. @row-del="rowDel"
  30. >
  31. <template slot-scope="scope" slot="menuBtn">
  32. <el-dropdown-item
  33. v-if="permissions.act_process_manage"
  34. divided
  35. @click.native="handlePic(scope.row,scope.index)"
  36. >流程图
  37. </el-dropdown-item>
  38. <el-dropdown-item
  39. v-if="permissions.act_process_manage && scope.row.suspend"
  40. divided
  41. @click.native="handleStatus(scope.row,'active')"
  42. >激活
  43. </el-dropdown-item>
  44. <el-dropdown-item
  45. v-if="permissions.act_process_manage && !scope.row.suspend"
  46. divided
  47. @click.native="handleStatus(scope.row,'suspend')"
  48. >失效
  49. </el-dropdown-item>
  50. <el-dropdown-item
  51. v-if="permissions.act_process_manage"
  52. divided
  53. @click.native="handleDel(scope.row,'suspend')"
  54. >删除
  55. </el-dropdown-item>
  56. </template>
  57. </avue-crud>
  58. </basic-container>
  59. <el-dialog :visible.sync="showPicDialog" title="流程图">
  60. <img :src="actPicUrl" width="100%">
  61. </el-dialog>
  62. </div>
  63. </template>
  64. <script>
  65. import { delObj, fetchList, status } from '@/api/activiti/process'
  66. import { tableOption } from '@/const/crud/activiti/process'
  67. import { mapGetters } from 'vuex'
  68. export default {
  69. name: 'Process',
  70. data() {
  71. return {
  72. searchForm: {},
  73. showPicDialog: false,
  74. actPicUrl: '',
  75. tableData: [],
  76. page: {
  77. total: 0, // 总页数
  78. currentPage: 1, // 当前页数
  79. pageSize: 20 // 每页显示多少条
  80. },
  81. tableLoading: false,
  82. tableOption: tableOption
  83. }
  84. },
  85. created() {
  86. },
  87. mounted: function() {
  88. },
  89. computed: {
  90. ...mapGetters(['permissions'])
  91. },
  92. methods: {
  93. getList(page, params) {
  94. this.tableLoading = true
  95. fetchList(
  96. Object.assign(
  97. {
  98. descs: 'create_time',
  99. current: page.currentPage,
  100. size: page.pageSize
  101. },
  102. params,
  103. this.searchForm
  104. )
  105. ).then(response => {
  106. this.tableData = response.data.data.records
  107. this.page.total = response.data.data.total
  108. this.tableLoading = false
  109. })
  110. },
  111. handlePic(row) {
  112. this.actPicUrl =
  113. `/act/process/resource/` +
  114. row.deploymentId +
  115. '/' +
  116. row.processonDefinitionId +
  117. '/image'
  118. this.showPicDialog = true
  119. },
  120. handleStatus(row, type) {
  121. var _this = this
  122. this.$confirm(
  123. '是否确认操作ID为"' + row.processonDefinitionId + '"的流程?',
  124. '警告',
  125. {
  126. confirmButtonText: '确定',
  127. cancelButtonText: '取消',
  128. type: 'warning'
  129. }
  130. ).then(function() {
  131. return status(row.processonDefinitionId, type)
  132. }).then(() => {
  133. this.getList(this.page)
  134. _this.$message({
  135. showClose: true,
  136. message: '操作成功',
  137. type: 'success'
  138. })
  139. this.getList(this.page)
  140. })
  141. },
  142. handleDel(row, index) {
  143. this.$refs.crud.rowDel(row, index)
  144. },
  145. rowDel: function(row) {
  146. var _this = this
  147. this.$confirm(
  148. '是否确认删除ID为"' + row.deploymentId + '"的模型?',
  149. '警告',
  150. {
  151. confirmButtonText: '确定',
  152. cancelButtonText: '取消',
  153. type: 'warning'
  154. }
  155. ).then(function() {
  156. return delObj(row.deploymentId)
  157. }).then(() => {
  158. this.getList(this.page)
  159. _this.$message({
  160. showClose: true,
  161. message: '删除成功',
  162. type: 'success'
  163. })
  164. this.getList(this.page)
  165. }).catch(function() {
  166. })
  167. },
  168. /**
  169. * 搜索回调
  170. */
  171. searchChange(form) {
  172. this.searchForm = form
  173. this.getList(this.page, form)
  174. },
  175. /**
  176. * 刷新回调
  177. */
  178. refreshChange() {
  179. this.getList(this.page)
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. </style>