start.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="data"
  5. ref="crud"
  6. v-model="form"
  7. :page="page"
  8. @search-change="searchChange"
  9. @search-reset="searchReset"
  10. @selection-change="selectionChange"
  11. @on-load="onLoad">
  12. <template slot-scope="scope" slot="menu">
  13. <el-button type="text"
  14. size="small"
  15. v-if="permission.work_start_flow"
  16. plain
  17. class="none-border"
  18. @click.stop="handleStart(scope.row)">发起
  19. </el-button>
  20. <el-button type="text"
  21. size="small"
  22. v-if="permission.work_start_image"
  23. plain
  24. class="none-border"
  25. @click.stop="handleImage(scope.row,scope.index)">流程图
  26. </el-button>
  27. </template>
  28. <template slot-scope="{row}"
  29. slot="version">
  30. <el-tag>v{{row.version}}</el-tag>
  31. </template>
  32. <template slot-scope="{row}"
  33. slot="suspensionState">
  34. <el-tag>{{row.suspensionState===1?'激活':'挂起'}}</el-tag>
  35. </template>
  36. <template slot-scope="{row}"
  37. slot="category">
  38. <el-tag>{{row.categoryName}}</el-tag>
  39. </template>
  40. </avue-crud>
  41. <el-dialog title="流程图"
  42. :visible.sync="flowBox"
  43. :fullscreen="true">
  44. <iframe
  45. :src=flowUrl
  46. width="100%"
  47. height="700"
  48. title="流程图"
  49. frameBorder="no"
  50. border="0"
  51. marginWidth="0"
  52. marginHeight="0"
  53. scrolling="no"
  54. allowTransparency="yes">
  55. </iframe>
  56. <span slot="footer"
  57. class="dialog-footer">
  58. <el-button @click="flowBox = false">关 闭</el-button>
  59. </span>
  60. </el-dialog>
  61. </basic-container>
  62. </template>
  63. <script>
  64. import {mapGetters} from "vuex";
  65. import {startList} from "@/api/work/work";
  66. import {flowCategory,flowRoute} from "@/util/flow";
  67. export default {
  68. data() {
  69. return {
  70. form: {},
  71. selectionId: '',
  72. selectionList: [],
  73. page: {
  74. pageSize: 10,
  75. currentPage: 1,
  76. total: 0
  77. },
  78. flowBox: false,
  79. flowUrl: '',
  80. workBox: false,
  81. option: {
  82. tip: false,
  83. border: true,
  84. index: true,
  85. selection: true,
  86. editBtn: false,
  87. addBtn: false,
  88. viewBtn: false,
  89. delBtn: false,
  90. dialogWidth: 300,
  91. dialogHeight: 400,
  92. column: [
  93. {
  94. label: "流程分类",
  95. type: "select",
  96. row: true,
  97. dicUrl: "/api/blade-system/dict/dictionary?code=flow",
  98. props: {
  99. label: "dictValue",
  100. value: "dictKey"
  101. },
  102. slot: true,
  103. prop: "category",
  104. search: true,
  105. },
  106. {
  107. label: '流程标识',
  108. prop: 'key',
  109. },
  110. {
  111. label: '流程名称',
  112. prop: 'name',
  113. },
  114. {
  115. label: '流程版本',
  116. prop: 'version',
  117. slot: true,
  118. },
  119. {
  120. label: '状态',
  121. prop: 'suspensionState',
  122. slot: true,
  123. },
  124. {
  125. label: '部署时间',
  126. prop: 'deploymentTime',
  127. },
  128. ]
  129. },
  130. data: []
  131. };
  132. },
  133. computed: {
  134. ...mapGetters(["permission", "flowRoutes"]),
  135. ids() {
  136. let ids = [];
  137. this.selectionList.forEach(ele => {
  138. ids.push(ele.id);
  139. });
  140. return ids.join(",");
  141. },
  142. },
  143. methods: {
  144. searchReset() {
  145. this.onLoad(this.page);
  146. },
  147. searchChange(params) {
  148. this.onLoad(this.page, params);
  149. },
  150. selectionChange(list) {
  151. this.selectionList = list;
  152. },
  153. handleStart(row) {
  154. this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/form/${row.id}`});
  155. },
  156. handleImage(row) {
  157. this.flowUrl = `/api/blade-flow/process/resource-view?processDefinitionId=${row.id}`;
  158. this.flowBox = true;
  159. },
  160. onLoad(page, params = {}) {
  161. const values = {
  162. ...params,
  163. category: (params.category) ? flowCategory(params.category) : null
  164. }
  165. startList(page.currentPage, page.pageSize, values).then(res => {
  166. const data = res.data.data;
  167. this.page.total = data.total;
  168. this.data = data.records;
  169. });
  170. }
  171. }
  172. };
  173. </script>
  174. <style>
  175. .none-border {
  176. border: 0;
  177. background-color: transparent !important;
  178. }
  179. </style>