index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <!--<el-input v-model="listQuery.processInstanceId" placeholder="流程实例ID" style="width: 200px;"
  5. class="filter-item" @keyup.enter.native="btnQuery"/>-->
  6. <el-input
  7. v-model="listQuery.taskName"
  8. placeholder="任务名称"
  9. style="width: 200px"
  10. class="filter-item"
  11. @keyup.enter.native="btnQuery"
  12. />
  13. <el-input
  14. v-model="listQuery.processInstanceBusinessKey"
  15. placeholder="业务主键Key"
  16. style="width: 200px"
  17. class="filter-item"
  18. @keyup.enter.native="btnQuery"
  19. />
  20. <el-date-picker
  21. v-model="listQuery.taskDueAfter"
  22. value-format="yyyy-MM-dd"
  23. placeholder="到期日开始"
  24. type="date"
  25. style="width: 200px"
  26. class="filter-item"
  27. ></el-date-picker>
  28. <el-date-picker
  29. v-model="listQuery.taskDueBefore"
  30. value-format="yyyy-MM-dd"
  31. placeholder="到期日结束"
  32. type="date"
  33. style="width: 200px"
  34. class="filter-item"
  35. ></el-date-picker>
  36. <el-dropdown
  37. split-button
  38. type="primary"
  39. @click="btnQuery"
  40. class="filter-item"
  41. >
  42. <i class="el-icon-search el-icon--left"></i>查询
  43. <el-dropdown-menu slot="dropdown">
  44. <el-dropdown-item icon="el-icon-zoom-out" @click.native="btnReset"
  45. >重置</el-dropdown-item
  46. >
  47. </el-dropdown-menu>
  48. </el-dropdown>
  49. </div>
  50. <el-table
  51. :data="records"
  52. border
  53. fit
  54. highlight-current-row
  55. style="width: 100%"
  56. :cell-style="{ padding: '3px' }"
  57. >
  58. <el-table-column
  59. label="流程实例名称"
  60. prop="processInstanceName"
  61. align="center"
  62. >
  63. <template slot-scope="scope"
  64. ><span>{{ scope.row.processInstanceName }}</span></template
  65. >
  66. </el-table-column>
  67. <el-table-column label="任务名称" prop="name" align="center">
  68. <template slot-scope="scope"
  69. ><span>{{ scope.row.name }}</span></template
  70. >
  71. </el-table-column>
  72. <el-table-column
  73. label="开始时间"
  74. prop="createTime"
  75. align="center"
  76. width="165px"
  77. >
  78. <template slot-scope="scope"
  79. ><span>{{ scope.row.createTime }}</span></template
  80. >
  81. </el-table-column>
  82. <el-table-column label="到期日期" prop="dueDate" align="center">
  83. <template slot-scope="scope"
  84. ><span>{{ scope.row.dueDate }}</span></template
  85. >
  86. </el-table-column>
  87. <el-table-column label="所有人" prop="owner" align="center">
  88. <template slot-scope="scope"
  89. ><span>{{ scope.row.owner }}</span></template
  90. >
  91. </el-table-column>
  92. <el-table-column label="执行人" prop="assignee" align="center">
  93. <template slot-scope="scope"
  94. ><span>{{ scope.row.assignee }}</span></template
  95. >
  96. </el-table-column>
  97. <el-table-column label="操作" align="center">
  98. <template slot-scope="{ row }">
  99. <el-dropdown>
  100. <span class="el-dropdown-link"
  101. >操作<i class="el-icon-arrow-down el-icon--right"></i
  102. ></span>
  103. <el-dropdown-menu slot="dropdown">
  104. <el-dropdown-item
  105. icon="el-icon-view"
  106. @click.native="btnView(row.processInstanceId)"
  107. >查看详情
  108. </el-dropdown-item>
  109. <el-dropdown-item
  110. v-if="row.assignee == null || row.assignee == ''"
  111. icon="el-icon-edit"
  112. divided
  113. @click.native="btnClaim(row)"
  114. >认领并执行
  115. </el-dropdown-item>
  116. <!-- v-if="
  117. row.assignee === $store.getters.sysUser.userId &&
  118. row.endTime == null
  119. " -->
  120. <el-dropdown-item
  121. icon="el-icon-edit"
  122. divided
  123. @click.native="btnUnclaim(row)"
  124. >取消签收
  125. </el-dropdown-item>
  126. <el-dropdown-item
  127. icon="el-icon-edit"
  128. divided
  129. @click.native="btnExcuteTask(row)"
  130. >执行
  131. </el-dropdown-item>
  132. </el-dropdown-menu>
  133. </el-dropdown>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <pagination
  138. v-show="total > 0"
  139. :total="total"
  140. :current.sync="listQuery.current"
  141. :size.sync="listQuery.size"
  142. @pagination="list"
  143. />
  144. <!-- 执行任务 -->
  145. <execute-task
  146. v-if="dialogExcuteTaskVisible"
  147. :visible.sync="dialogExcuteTaskVisible"
  148. :executeTaskId="executeTaskId"
  149. @executeTaskFinished="list"
  150. ></execute-task>
  151. <process-detail
  152. v-if="dialogViewVisible"
  153. :visible.sync="dialogViewVisible"
  154. :processInstanceId="processInstanceId"
  155. ></process-detail>
  156. </div>
  157. </template>
  158. <script>
  159. import Pagination from '@/components/Pagination';
  160. import {
  161. deleteAction,
  162. getAction,
  163. postAction,
  164. putAction
  165. } from '@/api/flowable/manage';
  166. import { Message } from 'element-ui';
  167. import ExecuteTask from '../components/ExecuteTask';
  168. import ProcessDetail from '../components/ProcessDetail';
  169. export default {
  170. name: 'FlowableTaskTodo',
  171. components: { Pagination, ExecuteTask, ProcessDetail },
  172. data() {
  173. return {
  174. dicts: [],
  175. records: null,
  176. selectedRecords: [],
  177. total: 0,
  178. listQuery: {
  179. current: 1,
  180. size: 10,
  181. processInstanceId: undefined,
  182. taskName: undefined,
  183. processInstanceBusinessKey: undefined,
  184. taskDueAfter: undefined,
  185. taskDueBefore: undefined
  186. },
  187. dialogExcuteTaskVisible: false,
  188. formJson: undefined,
  189. executeTaskId: '',
  190. processInstanceId: '',
  191. dialogViewVisible: false
  192. };
  193. },
  194. created() {
  195. this.list();
  196. console.log(this.$store.getters);
  197. },
  198. methods: {
  199. list() {
  200. getAction('/flowable/task/listTodo', this.listQuery).then((res) => {
  201. const { data } = res;
  202. console.log(data);
  203. this.records = data.data.records;
  204. this.total = data.data.total;
  205. });
  206. },
  207. btnQuery() {
  208. this.listQuery.current = 1;
  209. this.list();
  210. },
  211. btnReset() {
  212. this.listQuery = {
  213. current: 1,
  214. size: 10,
  215. processInstanceId: undefined,
  216. taskName: undefined,
  217. processInstanceBusinessKey: undefined,
  218. taskDueAfter: undefined,
  219. taskDueBefore: undefined
  220. };
  221. this.list();
  222. },
  223. btnClaim(row) {
  224. putAction('/flowable/task/claim', { taskId: row.id })
  225. .then(({ msg }) => {
  226. this.list();
  227. this.btnExcuteTask(row);
  228. })
  229. .catch((response) => {
  230. this.list();
  231. });
  232. },
  233. btnUnclaim(row) {
  234. putAction('/flowable/task/unclaim', { taskId: row.id }).then(
  235. ({ msg }) => {
  236. Message.success(msg);
  237. this.list();
  238. }
  239. );
  240. },
  241. btnExcuteTask(row) {
  242. this.executeTaskId = row.id;
  243. this.dialogExcuteTaskVisible = true;
  244. },
  245. btnView(processInstanceId) {
  246. this.processInstanceId = processInstanceId;
  247. this.dialogViewVisible = true;
  248. }
  249. }
  250. };
  251. </script>