start.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. :page.sync="page"
  7. v-model="form"
  8. ref="crud"
  9. @search-change="searchChange"
  10. @search-reset="searchReset"
  11. @selection-change="selectionChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad">
  16. <template slot="menuLeft">
  17. <el-radio-group v-model="mode" size="small">
  18. <el-radio-button label="1">通用流程</el-radio-button>
  19. <el-radio-button label="2">定制流程</el-radio-button>
  20. </el-radio-group>
  21. </template>
  22. <template slot-scope="scope" slot="menu">
  23. <el-button type="text"
  24. size="small"
  25. v-if="permission.work_start_flow"
  26. plain
  27. class="none-border"
  28. @click.stop="handleStart(scope.row)">发起
  29. </el-button>
  30. <el-button type="text"
  31. size="small"
  32. v-if="permission.work_start_image"
  33. plain
  34. class="none-border"
  35. @click.stop="handleImage(scope.row,scope.index)">流程图
  36. </el-button>
  37. </template>
  38. <template slot-scope="{row}"
  39. slot="tenantId">
  40. <el-tag>{{row.tenantId===''?'通用':row.tenantId}}</el-tag>
  41. </template>
  42. <template slot-scope="{row}"
  43. slot="version">
  44. <el-tag>v{{row.version}}</el-tag>
  45. </template>
  46. <template slot-scope="{row}"
  47. slot="suspensionState">
  48. <el-tag>{{row.suspensionState===1?'激活':'挂起'}}</el-tag>
  49. </template>
  50. <template slot-scope="{row}"
  51. slot="category">
  52. <el-tag>{{row.categoryName}}</el-tag>
  53. </template>
  54. </avue-crud>
  55. <el-dialog title="流程图"
  56. append-to-body
  57. :visible.sync="flowBox"
  58. :fullscreen="true">
  59. <iframe
  60. :src=flowUrl
  61. width="100%"
  62. height="700"
  63. title="流程图"
  64. frameBorder="no"
  65. border="0"
  66. marginWidth="0"
  67. marginHeight="0"
  68. scrolling="no"
  69. allowTransparency="yes">
  70. </iframe>
  71. <span slot="footer"
  72. class="dialog-footer">
  73. <el-button @click="flowBox = false">关 闭</el-button>
  74. </span>
  75. </el-dialog>
  76. </basic-container>
  77. </template>
  78. <script>
  79. import {mapGetters} from "vuex";
  80. import {startList} from "@/api/work/work";
  81. import {flowCategory, flowRoute} from "@/util/flow";
  82. export default {
  83. data() {
  84. return {
  85. form: {},
  86. mode: '1',
  87. selectionId: '',
  88. selectionList: [],
  89. query: {},
  90. loading: true,
  91. page: {
  92. pageSize: 10,
  93. currentPage: 1,
  94. total: 0
  95. },
  96. flowBox: false,
  97. flowUrl: '',
  98. workBox: false,
  99. option: {
  100. height: 'auto',
  101. calcHeight: 30,
  102. tip: false,
  103. searchShow: true,
  104. searchMenuSpan: 12,
  105. border: true,
  106. index: true,
  107. selection: true,
  108. editBtn: false,
  109. addBtn: false,
  110. viewBtn: false,
  111. delBtn: false,
  112. menuWidth: 150,
  113. dialogWidth: 900,
  114. dialogClickModal: false,
  115. column: [
  116. {
  117. label: '租户编号',
  118. prop: 'tenantId',
  119. slot: true,
  120. width: 120,
  121. },
  122. {
  123. label: "流程分类",
  124. type: "select",
  125. row: true,
  126. dicUrl: "/api/blade-system/dict/dictionary?code=flow",
  127. props: {
  128. label: "dictValue",
  129. value: "dictKey"
  130. },
  131. dataType: "number",
  132. slot: true,
  133. prop: "category",
  134. search: true,
  135. width: 100,
  136. },
  137. {
  138. label: '流程标识',
  139. prop: 'key',
  140. },
  141. {
  142. label: '流程名称',
  143. prop: 'name',
  144. search: true,
  145. },
  146. {
  147. label: '流程版本',
  148. prop: 'version',
  149. slot: true,
  150. width: 80,
  151. },
  152. {
  153. label: '状态',
  154. prop: 'suspensionState',
  155. slot: true,
  156. width: 80,
  157. },
  158. {
  159. label: '部署时间',
  160. prop: 'deploymentTime',
  161. width: 165,
  162. },
  163. ]
  164. },
  165. data: []
  166. };
  167. },
  168. watch: {
  169. 'mode'() {
  170. this.onLoad(this.page);
  171. }
  172. },
  173. computed: {
  174. ...mapGetters(["permission", "flowRoutes"]),
  175. ids() {
  176. let ids = [];
  177. this.selectionList.forEach(ele => {
  178. ids.push(ele.id);
  179. });
  180. return ids.join(",");
  181. },
  182. },
  183. methods: {
  184. searchReset() {
  185. this.query = {};
  186. this.onLoad(this.page);
  187. },
  188. searchChange(params, done) {
  189. this.query = params;
  190. this.page.currentPage = 1;
  191. this.onLoad(this.page, params);
  192. done();
  193. },
  194. selectionChange(list) {
  195. this.selectionList = list;
  196. },
  197. selectionClear() {
  198. this.selectionList = [];
  199. this.$refs.crud.toggleSelection();
  200. },
  201. handleStart(row) {
  202. this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/form/${row.id}`});
  203. },
  204. handleImage(row) {
  205. this.flowUrl = `/api/blade-flow/process/resource-view?processDefinitionId=${row.id}`;
  206. this.flowBox = true;
  207. },
  208. currentChange(currentPage) {
  209. this.page.currentPage = currentPage;
  210. },
  211. sizeChange(pageSize) {
  212. this.page.pageSize = pageSize;
  213. },
  214. refreshChange() {
  215. this.onLoad(this.page, this.query);
  216. },
  217. onLoad(page, params = {}) {
  218. const query = {
  219. ...this.query,
  220. category: (params.category) ? flowCategory(params.category) : null,
  221. mode: this.mode
  222. };
  223. this.loading = true;
  224. startList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
  225. const data = res.data.data;
  226. this.page.total = data.total;
  227. this.data = data.records;
  228. this.loading = false;
  229. this.selectionClear();
  230. });
  231. }
  232. }
  233. };
  234. </script>
  235. <style>
  236. .none-border {
  237. border: 0;
  238. background-color: transparent !important;
  239. }
  240. </style>