index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="app-container">
  3. <doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" />
  4. <!-- 搜索工作栏 -->
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  6. <el-form-item label="流程名" prop="name">
  7. <el-input v-model="queryParams.name" placeholder="请输入流程名" clearable @keyup.enter.native="handleQuery"/>
  8. </el-form-item>
  9. <el-form-item label="所属流程" prop="processDefinitionId">
  10. <el-input v-model="queryParams.processDefinitionId" placeholder="请输入流程定义的编号" clearable @keyup.enter.native="handleQuery"/>
  11. </el-form-item>
  12. <el-form-item label="流程分类" prop="category">
  13. <el-select v-model="queryParams.category" placeholder="请选择流程分类" clearable>
  14. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)"
  15. :key="dict.value" :label="dict.label" :value="dict.value"/>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="提交时间" prop="createTime">
  19. <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  20. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
  21. </el-form-item>
  22. <el-form-item label="状态" prop="status">
  23. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
  24. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)"
  25. :key="dict.value" :label="dict.label" :value="dict.value"/>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="结果" prop="result">
  29. <el-select v-model="queryParams.result" placeholder="请选择流结果" clearable>
  30. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)"
  31. :key="dict.value" :label="dict.label" :value="dict.value"/>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <!-- 操作工具栏 -->
  40. <el-row :gutter="10" class="mb8">
  41. <el-col :span="1.5">
  42. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  43. v-hasPermi="['bpm:process-instance:query']">发起流程</el-button>
  44. </el-col>
  45. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  46. </el-row>
  47. <!-- 列表 -->
  48. <el-table v-loading="loading" :data="list">
  49. <el-table-column label="编号" align="center" prop="id" width="320" />
  50. <el-table-column label="流程名" align="center" prop="name" />
  51. <el-table-column label="流程分类" align="center" prop="category">
  52. <template v-slot="scope">
  53. <dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="当前审批任务" align="center" prop="tasks">
  57. <template v-slot="scope">
  58. <el-button v-for="task in scope.row.tasks" :key="task.id" type="text"">
  59. <span>{{ task.name }}</span>
  60. </el-button>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="状态" align="center" prop="status">
  64. <template v-slot="scope">
  65. <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="scope.row.status" />
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="结果" align="center" prop="result">
  69. <template v-slot="scope">
  70. <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="提交时间" align="center" prop="createTime" width="180">
  74. <template v-slot="scope">
  75. <span>{{ parseTime(scope.row.createTime) }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="结束时间" align="center" prop="createTime" width="180">
  79. <template v-slot="scope">
  80. <span>{{ parseTime(scope.row.endTime) }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  84. <template v-slot="scope">
  85. <el-button type="text" size="small" icon="el-icon-delete" v-if="scope.row.result === 1"
  86. v-hasPermi="['bpm:process-instance:cancel']" @click="handleCancel(scope.row)">取消</el-button>
  87. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)"
  88. v-hasPermi="['bpm:process-instance:query']">详情</el-button>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <!-- 分页组件 -->
  93. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  94. @pagination="getList"/>
  95. </div>
  96. </template>
  97. <script>
  98. import { getMyProcessInstancePage, cancelProcessInstance } from "@/api/bpm/processInstance";
  99. export default {
  100. name: "BpmProcessInstance",
  101. components: {
  102. },
  103. data() {
  104. return {
  105. // 遮罩层
  106. loading: true,
  107. // 显示搜索条件
  108. showSearch: true,
  109. // 总条数
  110. total: 0,
  111. // 工作流的流程实例的拓展列表
  112. list: [],
  113. // 查询参数
  114. queryParams: {
  115. pageNo: 1,
  116. pageSize: 10,
  117. name: null,
  118. processDefinitionId: null,
  119. category: null,
  120. status: null,
  121. result: null,
  122. createTime: []
  123. }
  124. };
  125. },
  126. created() {
  127. this.getList();
  128. },
  129. methods: {
  130. /** 查询列表 */
  131. getList() {
  132. this.loading = true;
  133. // 执行查询
  134. getMyProcessInstancePage(this.queryParams).then(response => {
  135. this.list = response.data.list;
  136. this.total = response.data.total;
  137. this.loading = false;
  138. });
  139. },
  140. /** 搜索按钮操作 */
  141. handleQuery() {
  142. this.queryParams.pageNo = 1;
  143. this.getList();
  144. },
  145. /** 重置按钮操作 */
  146. resetQuery() {
  147. this.resetForm("queryForm");
  148. this.handleQuery();
  149. },
  150. /** 新增按钮操作 **/
  151. handleAdd() {
  152. this.$router.push({ name: "BpmProcessInstanceCreate"})
  153. },
  154. /** 取消按钮操作 */
  155. handleCancel(row) {
  156. const id = row.id;
  157. this.$prompt('请输入取消原因?', "取消流程", {
  158. type: 'warning',
  159. confirmButtonText: "确定",
  160. cancelButtonText: "取消",
  161. inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
  162. inputErrorMessage: "取消原因不能为空",
  163. }).then(({ value }) => {
  164. return cancelProcessInstance(id, value);
  165. }).then(() => {
  166. this.getList();
  167. this.$modal.msgSuccess("取消成功");
  168. })
  169. },
  170. /** 处理详情按钮 */
  171. handleDetail(row) {
  172. this.$router.push({ name: "BpmProcessInstanceDetail", query: { id: row.id}});
  173. },
  174. }
  175. };
  176. </script>