follow.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :permission="permissionList"
  10. @row-del="rowDel"
  11. @search-change="searchChange"
  12. @search-reset="searchReset"
  13. @selection-change="selectionChange"
  14. @current-change="currentChange"
  15. @size-change="sizeChange"
  16. @refresh-change="refreshChange"
  17. @on-load="onLoad">
  18. <template slot-scope="{row}"
  19. slot="suspensionState">
  20. <el-tag>{{row.suspensionState===1?'激活':'挂起'}}</el-tag>
  21. </template>
  22. </avue-crud>
  23. <el-dialog title="流程删除"
  24. append-to-body
  25. :visible.sync="followBox"
  26. width="20%">
  27. <el-form :model="form"
  28. ref="form"
  29. label-width="80px">
  30. <el-form-item label="删除理由">
  31. <el-input v-model="deleteReason"
  32. placeholder="请输入删除理由" />
  33. </el-form-item>
  34. </el-form>
  35. <span slot="footer"
  36. class="dialog-footer">
  37. <el-button @click="followBox = false">关 闭</el-button>
  38. <el-button type="primary"
  39. @click="handleDelete">确 定</el-button>
  40. </span>
  41. </el-dialog>
  42. </basic-container>
  43. </template>
  44. <script>
  45. import {mapGetters} from "vuex";
  46. import {followList, deleteProcessInstance} from "@/api/flow/flow";
  47. export default {
  48. data() {
  49. return {
  50. form: {},
  51. selectionId: '',
  52. processInstanceId: '',
  53. selectionList: [],
  54. query: {},
  55. loading: true,
  56. page: {
  57. pageSize: 10,
  58. currentPage: 1,
  59. total: 0
  60. },
  61. followBox: false,
  62. deleteReason: '',
  63. option: {
  64. height: 'auto',
  65. calcHeight: 30,
  66. tip: false,
  67. searchShow: true,
  68. searchMenuSpan: 6,
  69. border: true,
  70. index: true,
  71. selection: true,
  72. editBtn: false,
  73. addBtn: false,
  74. viewBtn: false,
  75. dialogWidth: 900,
  76. menuWidth: 100,
  77. dialogClickModal: false,
  78. column: [
  79. {
  80. label: "执行id",
  81. prop: "executionId",
  82. search: true,
  83. width: 320,
  84. },
  85. {
  86. label: "流程key",
  87. prop: "processDefinitionKey",
  88. search: true,
  89. },
  90. {
  91. label: "实例id",
  92. prop: "processInstanceId",
  93. search: true,
  94. width: 320,
  95. },
  96. {
  97. label: "状态",
  98. prop: "suspensionState",
  99. slot: true,
  100. width: 80,
  101. },
  102. {
  103. label: "发起人",
  104. prop: "startUser",
  105. width: 100,
  106. },
  107. {
  108. label: '开始时间',
  109. prop: 'startTime',
  110. width: 165,
  111. },
  112. ]
  113. },
  114. data: []
  115. };
  116. },
  117. computed: {
  118. ...mapGetters(["permission"]),
  119. permissionList() {
  120. return {
  121. delBtn: this.vaildData(this.permission.flow_follow_delete, false),
  122. };
  123. },
  124. ids() {
  125. let ids = [];
  126. this.selectionList.forEach(ele => {
  127. ids.push(ele.id);
  128. });
  129. return ids.join(",");
  130. }
  131. },
  132. methods: {
  133. rowDel(row) {
  134. this.followBox = true;
  135. this.selectionId = row.id;
  136. this.processInstanceId = row.processInstanceId;
  137. },
  138. handleDelete() {
  139. this.$confirm("确定将选择数据删除?", {
  140. confirmButtonText: "确定",
  141. cancelButtonText: "取消",
  142. type: "warning"
  143. })
  144. .then(() => {
  145. return deleteProcessInstance({deleteReason: this.deleteReason, processInstanceId: this.processInstanceId});
  146. })
  147. .then(() => {
  148. this.onLoad(this.page);
  149. this.followBox = false;
  150. this.$message({
  151. type: "success",
  152. message: "操作成功!"
  153. });
  154. });
  155. },
  156. searchReset() {
  157. this.query = {};
  158. this.onLoad(this.page);
  159. },
  160. searchChange(params, done) {
  161. this.query = params;
  162. this.page.currentPage = 1;
  163. this.onLoad(this.page, params);
  164. done();
  165. },
  166. selectionChange(list) {
  167. this.selectionList = list;
  168. },
  169. selectionClear() {
  170. this.selectionList = [];
  171. this.$refs.crud.toggleSelection();
  172. },
  173. currentChange(currentPage) {
  174. this.page.currentPage = currentPage;
  175. },
  176. sizeChange(pageSize) {
  177. this.page.pageSize = pageSize;
  178. },
  179. refreshChange() {
  180. this.onLoad(this.page, this.query);
  181. },
  182. onLoad(page, params = {}) {
  183. this.loading = true;
  184. followList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  185. const data = res.data.data;
  186. this.page.total = data.total;
  187. this.data = data.records;
  188. this.loading = false;
  189. this.selectionClear();
  190. });
  191. }
  192. }
  193. };
  194. </script>
  195. <style>
  196. .none-border {
  197. border: 0;
  198. background-color: transparent !important;
  199. }
  200. </style>