综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="名称" prop="name">
  5. <el-input v-model="queryParams.name" placeholder="请输入名称" clearable size="small"
  6. @keyup.enter.native="handleQuery" />
  7. </el-form-item>
  8. <el-form-item label="开始时间" prop="deployTime">
  9. <el-date-picker clearable size="small" v-model="queryParams.deployTime" type="date" value-format="yyyy-MM-dd"
  10. placeholder="选择时间">
  11. </el-date-picker>
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  21. v-hasPermi="['system:deployment:remove']">删除</el-button>
  22. </el-col>
  23. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  24. </el-row>
  25. <el-table v-loading="loading" :data="finishedList" border @selection-change="handleSelectionChange">
  26. <el-table-column type="selection" width="55" align="center" />
  27. <el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true" />
  28. <el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true" />
  29. <el-table-column label="任务节点" align="center" prop="taskName" />
  30. <el-table-column label="流程发起人" align="center">
  31. <template slot-scope="scope">
  32. <label>{{ scope.row.startUserName }} <el-tag type="info" size="mini">{{ scope.row.startDeptName }}</el-tag></label>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="接收时间" align="center" prop="createTime" width="180" />
  36. <el-table-column label="审批时间" align="center" prop="finishTime" width="180" />
  37. <el-table-column label="耗时" align="center" prop="duration" width="180" />
  38. <el-table-column label="操作" width="150" fixed="right" class-name="small-padding fixed-width">
  39. <template slot-scope="scope">
  40. <el-button size="mini" type="text" icon="el-icon-tickets" @click="handleFlowRecord(scope.row)">流转记录</el-button>
  41. <el-button size="mini" type="text" icon="el-icon-refresh-left" @click="handleRevoke(scope.row)">撤回
  42. </el-button>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  47. @pagination="getList" />
  48. </div>
  49. </template>
  50. <script>
  51. import { finishedList, getDeployment, delDeployment, addDeployment, updateDeployment, exportDeployment, revokeProcess } from "@/api/flowable/finished";
  52. import { getProcessVariables } from "@/api/flowable/definition";
  53. export default {
  54. name: "Deploy",
  55. components: {
  56. },
  57. data() {
  58. return {
  59. // 遮罩层
  60. loading: true,
  61. // 选中数组
  62. ids: [],
  63. // 非单个禁用
  64. single: true,
  65. // 非多个禁用
  66. multiple: true,
  67. // 显示搜索条件
  68. showSearch: true,
  69. // 总条数
  70. total: 0,
  71. // 已办任务列表数据
  72. finishedList: [],
  73. // 弹出层标题
  74. title: "",
  75. // 是否显示弹出层
  76. open: false,
  77. src: "",
  78. // 查询参数
  79. queryParams: {
  80. pageNum: 1,
  81. pageSize: 10,
  82. name: null,
  83. category: null,
  84. key: null,
  85. tenantId: null,
  86. deployTime: null,
  87. derivedFrom: null,
  88. derivedFromRoot: null,
  89. parentDeploymentId: null,
  90. engineVersion: null
  91. },
  92. // 表单参数
  93. form: {},
  94. // 表单校验
  95. rules: {
  96. }
  97. };
  98. },
  99. created() {
  100. this.getList();
  101. },
  102. methods: {
  103. /** 查询流程定义列表 */
  104. getList() {
  105. this.loading = true;
  106. finishedList(this.queryParams).then(response => {
  107. this.finishedList = response.data.records;
  108. this.total = response.data.total;
  109. this.loading = false;
  110. });
  111. },
  112. // 取消按钮
  113. cancel() {
  114. this.open = false;
  115. this.reset();
  116. },
  117. // 表单重置
  118. reset() {
  119. this.form = {
  120. id: null,
  121. name: null,
  122. category: null,
  123. key: null,
  124. tenantId: null,
  125. deployTime: null,
  126. derivedFrom: null,
  127. derivedFromRoot: null,
  128. parentDeploymentId: null,
  129. engineVersion: null
  130. };
  131. this.resetForm("form");
  132. },
  133. setIcon(val) {
  134. if (val) {
  135. return "el-icon-check";
  136. } else {
  137. return "el-icon-time";
  138. }
  139. },
  140. setColor(val) {
  141. if (val) {
  142. return "#2bc418";
  143. } else {
  144. return "#b3bdbb";
  145. }
  146. },
  147. /** 搜索按钮操作 */
  148. handleQuery() {
  149. this.queryParams.pageNum = 1;
  150. this.getList();
  151. },
  152. /** 重置按钮操作 */
  153. resetQuery() {
  154. this.resetForm("queryForm");
  155. this.handleQuery();
  156. },
  157. // 多选框选中数据
  158. handleSelectionChange(selection) {
  159. this.ids = selection.map(item => item.id)
  160. this.single = selection.length !== 1
  161. this.multiple = !selection.length
  162. },
  163. /** 新增按钮操作 */
  164. handleAdd() {
  165. this.reset();
  166. this.open = true;
  167. this.title = "添加流程定义";
  168. },
  169. /** 流程流转记录 */
  170. handleFlowRecord(row) {
  171. console.log(row);
  172. getProcessVariables(row.taskId).then(res => {
  173. this.$router.push({
  174. path: '/flowable/task/finished/detail/index',
  175. query: {
  176. procInsId: row.procInsId,
  177. deployId: row.deployId,
  178. taskId: row.taskId,
  179. formId: res.data.formId
  180. }
  181. })
  182. })
  183. },
  184. /** 撤回任务 */
  185. handleRevoke(row) {
  186. const params = {
  187. instanceId: row.procInsId,
  188. taskId: row.taskId
  189. }
  190. revokeProcess(params).then(res => {
  191. this.$modal.msgSuccess(res.msg);
  192. this.getList();
  193. });
  194. },
  195. /** 修改按钮操作 */
  196. handleUpdate(row) {
  197. this.reset();
  198. const id = row.id || this.ids
  199. getDeployment(id).then(response => {
  200. this.form = response.data;
  201. this.open = true;
  202. this.title = "修改流程定义";
  203. });
  204. },
  205. /** 提交按钮 */
  206. submitForm() {
  207. this.$refs["form"].validate(valid => {
  208. if (valid) {
  209. if (this.form.id != null) {
  210. updateDeployment(this.form).then(response => {
  211. this.$modal.msgSuccess("修改成功");
  212. this.open = false;
  213. this.getList();
  214. });
  215. } else {
  216. addDeployment(this.form).then(response => {
  217. this.$modal.msgSuccess("新增成功");
  218. this.open = false;
  219. this.getList();
  220. });
  221. }
  222. }
  223. });
  224. },
  225. /** 删除按钮操作 */
  226. handleDelete(row) {
  227. const ids = row.id || this.ids;
  228. this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
  229. confirmButtonText: "确定",
  230. cancelButtonText: "取消",
  231. type: "warning"
  232. }).then(function () {
  233. return delDeployment(ids);
  234. }).then(() => {
  235. this.getList();
  236. this.$modal.msgSuccess("删除成功");
  237. })
  238. },
  239. /** 导出按钮操作 */
  240. handleExport() {
  241. const queryParams = this.queryParams;
  242. this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
  243. confirmButtonText: "确定",
  244. cancelButtonText: "取消",
  245. type: "warning"
  246. }).then(function () {
  247. return exportDeployment(queryParams);
  248. }).then(response => {
  249. this.download(response.msg);
  250. })
  251. }
  252. }
  253. };
  254. </script>