claim.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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-download"
  19. v-if="permission.work_claim_sign"
  20. @click.stop="handleClaim(scope.row)">签收
  21. </el-button>
  22. <el-button type="text"
  23. size="small"
  24. icon="el-icon-info"
  25. v-if="permission.work_claim_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_claim_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 {claimList, claimTask} 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/blade-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. handleClaim(row) {
  151. this.$confirm("确定签收此任务?", {
  152. confirmButtonText: "确定",
  153. cancelButtonText: "取消",
  154. type: "warning"
  155. })
  156. .then(() => {
  157. return claimTask(row.taskId);
  158. })
  159. .then(() => {
  160. this.onLoad(this.page);
  161. this.$message({
  162. type: "success",
  163. message: "操作成功!"
  164. });
  165. });
  166. },
  167. handleDetail(row) {
  168. this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}`});
  169. },
  170. handleImage(row) {
  171. this.processInstanceId = row.processInstanceId;
  172. this.flowBox = true;
  173. },
  174. currentChange(currentPage){
  175. this.page.currentPage = currentPage;
  176. },
  177. sizeChange(pageSize){
  178. this.page.pageSize = pageSize;
  179. },
  180. refreshChange() {
  181. this.onLoad(this.page, this.query);
  182. },
  183. onLoad(page, params = {}) {
  184. const query = {
  185. ...this.query,
  186. category: (params.category) ? flowCategory(params.category) : null
  187. };
  188. this.loading = true;
  189. claimList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
  190. const data = res.data.data;
  191. this.page.total = data.total;
  192. this.data = data.records;
  193. this.loading = false;
  194. this.selectionClear();
  195. });
  196. }
  197. }
  198. };
  199. </script>