todo.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. @search-change="searchChange"
  9. @search-reset="searchReset"
  10. @selection-change="selectionChange"
  11. @current-change="currentChange"
  12. @size-change="sizeChange"
  13. @refresh-change="refreshChange"
  14. @on-load="onLoad">
  15. <template slot-scope="scope" slot="menu">
  16. <el-button type="text"
  17. size="small"
  18. icon="el-icon-s-check"
  19. v-if="permission.work_todo_handle"
  20. @click.stop="handleWork(scope.row)">处理
  21. </el-button>
  22. <el-button type="text"
  23. size="small"
  24. icon="el-icon-info"
  25. v-if="permission.work_todo_detail"
  26. @click.stop="handleDetail(scope.row)">详情
  27. </el-button>
  28. <el-button type="text"
  29. size="small"
  30. icon="el-icon-search"
  31. v-if="permission.work_todo_follow"
  32. @click.stop="handleImage(scope.row,scope.index)">流程图
  33. </el-button>
  34. </template>
  35. <template slot-scope="{row}"
  36. slot="processDefinitionVersion">
  37. <el-tag>v{{row.processDefinitionVersion}}</el-tag>
  38. </template>
  39. </avue-crud>
  40. <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
  41. </basic-container>
  42. </template>
  43. <script>
  44. import {mapGetters} from "vuex";
  45. import {todoList} from "@/api/work/work";
  46. import {flowCategory,flowRoute} from "@/util/flow";
  47. export default {
  48. data() {
  49. return {
  50. form: {},
  51. selectionId: '',
  52. selectionList: [],
  53. query: {},
  54. loading: true,
  55. page: {
  56. pageSize: 10,
  57. currentPage: 1,
  58. total: 0
  59. },
  60. processInstanceId: '',
  61. flowBox: false,
  62. workBox: false,
  63. option: {
  64. height: 'auto',
  65. calcHeight: 30,
  66. tip: false,
  67. simplePage: true,
  68. searchShow: true,
  69. searchMenuSpan: 6,
  70. border: true,
  71. index: true,
  72. selection: true,
  73. editBtn: false,
  74. addBtn: false,
  75. viewBtn: false,
  76. delBtn: false,
  77. dialogWidth: 900,
  78. menuWidth: 200,
  79. dialogClickModal: false,
  80. column: [
  81. {
  82. label: "流程分类",
  83. type: "select",
  84. row: true,
  85. dicUrl: "/api/galaxy-system/dict/dictionary?code=flow",
  86. props: {
  87. label: "dictValue",
  88. value: "dictKey"
  89. },
  90. dataType: "number",
  91. slot: true,
  92. prop: "category",
  93. search: true,
  94. hide: true,
  95. width: 100,
  96. },
  97. {
  98. label: '流程名称',
  99. prop: 'processDefinitionName',
  100. search: true,
  101. },
  102. {
  103. label: '当前步骤',
  104. prop: 'taskName',
  105. },
  106. {
  107. label: '流程版本',
  108. prop: 'processDefinitionVersion',
  109. slot: true,
  110. width: 80,
  111. },
  112. {
  113. label: '申请时间',
  114. prop: 'createTime',
  115. width: 165,
  116. },
  117. ]
  118. },
  119. data: []
  120. };
  121. },
  122. computed: {
  123. ...mapGetters(["permission", "flowRoutes"]),
  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. searchReset() {
  134. this.query = {};
  135. this.onLoad(this.page);
  136. },
  137. searchChange(params, done) {
  138. this.query = params;
  139. this.page.currentPage = 1;
  140. this.onLoad(this.page, params);
  141. done();
  142. },
  143. selectionChange(list) {
  144. this.selectionList = list;
  145. },
  146. selectionClear() {
  147. this.selectionList = [];
  148. this.$refs.crud.toggleSelection();
  149. },
  150. handleWork(row) {
  151. this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/handle/${row.taskId}/${row.processInstanceId}/${row.businessId}` });
  152. },
  153. handleDetail(row) {
  154. this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
  155. },
  156. handleImage(row) {
  157. this.processInstanceId = row.processInstanceId;
  158. this.flowBox = true;
  159. },
  160. currentChange(currentPage){
  161. this.page.currentPage = currentPage;
  162. },
  163. sizeChange(pageSize){
  164. this.page.pageSize = pageSize;
  165. },
  166. refreshChange() {
  167. this.onLoad(this.page, this.query);
  168. },
  169. onLoad(page, params = {}) {
  170. const query = {
  171. ...this.query,
  172. category: (params.category) ? flowCategory(params.category) : null
  173. };
  174. this.loading = true;
  175. todoList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
  176. const data = res.data.data;
  177. this.page.total = data.total;
  178. this.data = data.records;
  179. this.loading = false;
  180. this.selectionClear();
  181. });
  182. }
  183. }
  184. };
  185. </script>