process.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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="app-container pull-auto">
  19. <basic-container>
  20. <avue-crud ref="crud"
  21. :page="page"
  22. :data="tableData"
  23. :table-loading="tableLoading"
  24. :option="tableOption"
  25. @current-change="currentChange"
  26. @size-change="sizeChange"
  27. @search-change="searchChange"
  28. @refresh-change="refreshChange"
  29. @row-del="rowDel">
  30. <template slot-scope="scope"
  31. slot="dropMenu">
  32. <el-dropdown-item divided
  33. v-if="permissions.sys_log_del"
  34. @click.native="handlePic(scope.row,scope.index)">流程图</el-dropdown-item>
  35. <el-dropdown-item divided
  36. v-if="permissions.sys_log_del && scope.row.suspend"
  37. @click.native="handleStatus(scope.row,'active')">激活</el-dropdown-item>
  38. <el-dropdown-item divided
  39. v-if="permissions.sys_log_del && !scope.row.suspend"
  40. @click.native="handleStatus(scope.row,'suspend')">失效</el-dropdown-item>
  41. <el-dropdown-item divided
  42. v-if="permissions.sys_log_del"
  43. @click.native="handleDel(scope.row,'suspend')">删除</el-dropdown-item>
  44. </template>
  45. </avue-crud>
  46. </basic-container>
  47. <el-dialog title="流程图"
  48. :visible.sync="showPicDialog">
  49. <img :src="actPicUrl">
  50. </el-dialog>
  51. </div>
  52. </template>
  53. <script>
  54. import { fetchList, delObj, addObj, status } from '@/api/process'
  55. import { tableOption } from '@/const/crud/process'
  56. import { mapGetters } from 'vuex'
  57. export default {
  58. name: 'process',
  59. data () {
  60. return {
  61. showPicDialog: false,
  62. actPicUrl: '',
  63. tableData: [],
  64. page: {
  65. total: 0, // 总页数
  66. currentPage: 1, // 当前页数
  67. pageSize: 20 // 每页显示多少条
  68. },
  69. listQuery: {
  70. page: 1,
  71. limit: 20,
  72. category: undefined
  73. },
  74. tableLoading: false,
  75. tableOption: tableOption
  76. }
  77. },
  78. created () {
  79. this.getList()
  80. },
  81. mounted: function () { },
  82. computed: {
  83. ...mapGetters(['permissions'])
  84. },
  85. methods: {
  86. getList () {
  87. this.tableLoading = true
  88. this.listQuery.orderByField = 'create_time'
  89. this.listQuery.isAsc = false
  90. fetchList(this.listQuery).then(response => {
  91. this.tableData = response.data.records
  92. this.page.total = response.data.total
  93. this.tableLoading = false
  94. })
  95. },
  96. currentChange (val) {
  97. this.listQuery.page = val
  98. this.getList()
  99. },
  100. sizeChange (val) {
  101. this.listQuery.limit = val
  102. this.getList()
  103. },
  104. handlePic (row, index) {
  105. this.actPicUrl = `/act/process/resource/` + row.deploymentId + '/' + row.processonDefinitionId + "/image"
  106. this.showPicDialog = true
  107. },
  108. handleStatus (row, type) {
  109. var _this = this
  110. this.$confirm('是否确认操作ID为"' + row.processonDefinitionId + '"的流程?', '警告', {
  111. confirmButtonText: '确定',
  112. cancelButtonText: '取消',
  113. type: 'warning'
  114. }).then(function () {
  115. return status(row.processonDefinitionId, type)
  116. }).then(data => {
  117. this.getList()
  118. _this.$message({
  119. showClose: true,
  120. message: '操作成功',
  121. type: 'success'
  122. })
  123. }).catch(function (err) { })
  124. },
  125. handleDel (row, index) {
  126. this.$refs.crud.rowDel(row, index)
  127. },
  128. rowDel: function (row, index) {
  129. var _this = this
  130. this.$confirm('是否确认删除ID为"' + row.deploymentId + '"的模型?', '警告', {
  131. confirmButtonText: '确定',
  132. cancelButtonText: '取消',
  133. type: 'warning'
  134. })
  135. .then(function () {
  136. return delObj(row.deploymentId)
  137. })
  138. .then(data => {
  139. this.getList()
  140. _this.$message({
  141. showClose: true,
  142. message: '删除成功',
  143. type: 'success'
  144. })
  145. })
  146. .catch(function (err) { })
  147. },
  148. /**
  149. * 搜索回调
  150. */
  151. searchChange (form) {
  152. this.listQuery.category = form.category
  153. this.getList()
  154. },
  155. /**
  156. * 刷新回调
  157. */
  158. refreshChange () {
  159. this.getList()
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. </style>