index.vue 8.3 KB

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