综合办公系统
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  21. v-hasPermi="['system:deployment:add']">发起申请</el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  25. v-hasPermi="['system:deployment:remove']">删除</el-button>
  26. </el-col>
  27. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  28. </el-row>
  29. <el-table v-loading="loading" :data="myProcessList" border @selection-change="handleSelectionChange">
  30. <el-table-column type="selection" width="55" align="center" />
  31. <el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true" />
  32. <el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true" />
  33. <el-table-column label="流程类别" align="center" prop="category" width="100px" />
  34. <!-- <el-table-column label="流程版本" align="center" width="80px">
  35. <template slot-scope="scope">
  36. <el-tag size="medium">v{{ scope.row.procDefVersion }}</el-tag>
  37. </template>
  38. </el-table-column> -->
  39. <el-table-column label="提交时间" align="center" prop="createTime" width="180" />
  40. <el-table-column label="流程状态" align="center" width="100">
  41. <template slot-scope="scope">
  42. <el-tag v-if="scope.row.finishTime == null" size="mini">进行中</el-tag>
  43. <el-tag type="success" v-if="scope.row.finishTime != null" size="mini">已完成</el-tag>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="耗时" align="center" prop="duration" width="180" />
  47. <el-table-column label="当前节点" align="center" prop="taskName" />
  48. <el-table-column label="办理人" align="center">
  49. <template slot-scope="scope">
  50. <label v-if="scope.row.assigneeName">{{ scope.row.assigneeName }} <el-tag type="info" size="mini">{{
  51. scope.row.assigneeDeptName }}</el-tag></label>
  52. <!-- <label v-if="scope.row.candidate">{{scope.row.candidate}}</label>-->
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="操作" width="150" fixed="right" class-name="small-padding fixed-width">
  56. <template slot-scope="scope">
  57. <el-button @click="handleFlowRecord(scope.row)" type="text" size="small">进度</el-button>
  58. <el-button @click="handleStop(scope.row)" type="text" size="small">取消申请</el-button>
  59. <el-button @click="handleDelete(scope.row)" type="text" size="small"
  60. v-hasPermi="['system:deployment:remove']">删除</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  65. @pagination="getList" />
  66. <!-- 发起流程 -->
  67. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
  68. <el-form :model="queryProcessParams" ref="queryProcessForm" :inline="true" v-show="showSearch" label-width="68px">
  69. <el-form-item label="名称" prop="name">
  70. <el-input v-model="queryProcessParams.name" placeholder="请输入名称" clearable size="small"
  71. @keyup.enter.native="handleQuery" />
  72. </el-form-item>
  73. <el-form-item>
  74. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleProcessQuery">搜索</el-button>
  75. <el-button icon="el-icon-refresh" size="mini" @click="resetProcessQuery">重置</el-button>
  76. </el-form-item>
  77. </el-form>
  78. <el-table v-loading="processLoading" fit :data="definitionList" border>
  79. <el-table-column label="流程名称" align="center" prop="name" />
  80. <!-- <el-table-column label="流程版本" align="center">
  81. <template slot-scope="scope">
  82. <el-tag size="medium">v{{ scope.row.version }}</el-tag>
  83. </template>
  84. </el-table-column> -->
  85. <el-table-column label="流程分类" align="center" prop="category" />
  86. <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
  87. <template slot-scope="scope">
  88. <el-button size="mini" type="text" icon="el-icon-edit-outline"
  89. @click="handleStartProcess(scope.row)">发起申请</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination v-show="processTotal > 0" :total="processTotal" :page.sync="queryProcessParams.pageNum"
  94. :limit.sync="queryProcessParams.pageSize" @pagination="listDefinition" />
  95. </el-dialog>
  96. <el-dialog title="流程进度" :visible.sync="detailsOpen" append-to-body width="600px">
  97. <el-scrollbar style="height: 600px;">
  98. <RowDetail :rows="clickRow"></RowDetail>
  99. </el-scrollbar>
  100. </el-dialog>
  101. </div>
  102. </template>
  103. <script>
  104. import {
  105. getDeployment,
  106. delDeployment,
  107. addDeployment,
  108. updateDeployment,
  109. exportDeployment,
  110. flowRecord
  111. } from "@/api/flowable/finished";
  112. import { todoList } from "@/api/flowable/todo";
  113. import { myProcessList, stopProcess } from "@/api/flowable/process";
  114. import { listDefinition } from "@/api/flowable/definition";
  115. import { getNextFlowNodeByStart } from "@/api/flowable/todo";
  116. import { definitionStart, flowXmlAndNode } from "@/api/flowable/definition";
  117. import { Snowflake } from '@/utils/snowFlake.js'
  118. import RowDetail from './send/rowDetail.vue'
  119. export default {
  120. name: "Deploy",
  121. components: {
  122. RowDetail
  123. },
  124. data() {
  125. return {
  126. // 遮罩层
  127. loading: true,
  128. processLoading: true,
  129. // 选中数组
  130. ids: [],
  131. // 非单个禁用
  132. single: true,
  133. // 非多个禁用
  134. multiple: true,
  135. // 显示搜索条件
  136. showSearch: true,
  137. // 总条数
  138. total: 0,
  139. processTotal: 0,
  140. // 我发起的流程列表数据
  141. myProcessList: [],
  142. // 弹出层标题
  143. title: "",
  144. // 是否显示弹出层
  145. open: false,
  146. // 详情弹出框
  147. detailsOpen: false,
  148. src: "",
  149. definitionList: [],
  150. // 查询参数
  151. queryParams: {
  152. pageNum: 1,
  153. pageSize: 10,
  154. name: null,
  155. category: null,
  156. key: null,
  157. tenantId: null,
  158. deployTime: null,
  159. derivedFrom: null,
  160. derivedFromRoot: null,
  161. parentDeploymentId: null,
  162. engineVersion: null
  163. },
  164. // 查询参数
  165. queryProcessParams: {
  166. pageNum: 1,
  167. pageSize: 10,
  168. name: null,
  169. category: null,
  170. key: null,
  171. tenantId: null,
  172. deployTime: null,
  173. derivedFrom: null,
  174. derivedFromRoot: null,
  175. parentDeploymentId: null,
  176. engineVersion: null
  177. },
  178. // 表单参数
  179. form: {},
  180. // 表单校验
  181. rules: {
  182. },
  183. // 当前点击的行数据
  184. clickRow: {}
  185. };
  186. },
  187. created() {
  188. this.getList();
  189. },
  190. methods: {
  191. /** 查询流程定义列表 */
  192. getList() {
  193. this.loading = true;
  194. myProcessList(this.queryParams).then(response => {
  195. this.myProcessList = response.data.records;
  196. this.total = response.data.total;
  197. this.loading = false;
  198. });
  199. },
  200. // 取消按钮
  201. cancel() {
  202. this.open = false;
  203. this.reset();
  204. },
  205. // 表单重置
  206. reset() {
  207. this.form = {
  208. id: null,
  209. name: null,
  210. category: null,
  211. key: null,
  212. tenantId: null,
  213. deployTime: null,
  214. derivedFrom: null,
  215. derivedFromRoot: null,
  216. parentDeploymentId: null,
  217. engineVersion: null
  218. };
  219. this.resetForm("form");
  220. },
  221. /** 搜索按钮操作 */
  222. handleQuery() {
  223. this.queryParams.pageNum = 1;
  224. this.getList();
  225. },
  226. /** 重置按钮操作 */
  227. resetQuery() {
  228. this.resetForm("queryForm");
  229. this.handleQuery();
  230. },
  231. /** 搜索按钮操作 */
  232. handleProcessQuery() {
  233. this.queryProcessParams.pageNum = 1;
  234. this.listDefinition();
  235. },
  236. /** 重置按钮操作 */
  237. resetProcessQuery() {
  238. this.resetForm("queryProcessForm");
  239. this.handleProcessQuery();
  240. },
  241. // 多选框选中数据
  242. handleSelectionChange(selection) {
  243. this.ids = selection.map(item => item.procInsId)
  244. this.single = selection.length !== 1
  245. this.multiple = !selection.length
  246. },
  247. /** 新增按钮操作 */
  248. handleAdd() {
  249. this.open = true;
  250. this.title = "发起申请";
  251. this.listDefinition();
  252. },
  253. listDefinition() {
  254. listDefinition(this.queryProcessParams).then(response => {
  255. this.definitionList = response.data.records;
  256. this.processTotal = response.data.total;
  257. this.processLoading = false;
  258. });
  259. },
  260. /** 发起流程申请 */
  261. handleStartProcess(row) {
  262. if (row.category == "assess") {
  263. getNextFlowNodeByStart({ deploymentId: row.deploymentId, variables: {} }).then(res => {
  264. let data = res.data;
  265. if (data.dataType === 'dynamic') {
  266. if (data.type === 'assignee') { // 指定人员
  267. this.checkSendUser = true;
  268. this.checkType = "single";
  269. } else if (data.type === 'candidateUsers') { // 候选人员(多个)
  270. this.checkSendUser = true;
  271. this.checkType = "multiple";
  272. } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
  273. this.checkSendRole = true;
  274. } else { // 会签
  275. // 流程设计指定的 elementVariable 作为会签人员列表
  276. this.multiInstanceVars = data.vars;
  277. this.checkSendUser = true;
  278. this.checkType = "multiple";
  279. }
  280. this.taskOpen = true;
  281. this.taskTitle = "选择任务接收";
  282. } else {
  283. const variables = {};
  284. const formData = {};
  285. formData.disabled = true;
  286. formData.formBtns = false;
  287. formData.formId = new Snowflake(1n, 1n, 0n).nextId().toString();
  288. if (row.id) {
  289. variables.variables = formData;
  290. // 启动流程并将表单数据加入流程变量
  291. definitionStart(row.id, JSON.stringify(variables)).then(res => {
  292. this.$modal.msgSuccess(res.msg);
  293. let procInstanceId = res.data;
  294. todoList({
  295. pageNum: 1,
  296. pageSize: 99999999, processInsId: procInstanceId
  297. }).then(toDoRes => {
  298. let records = toDoRes.data.records;
  299. if(records.length == 1){
  300. records = records[0]
  301. }
  302. this.$router.push({
  303. path: '/flowable/task/todo/detail/index',
  304. query: {
  305. procInsId: records.procInsId,
  306. executionId: records.executionId,
  307. deployId: records.deployId,
  308. taskId: records.taskId,
  309. taskName: records.taskName,
  310. startUser: records.startUserName + '-' + records.startDeptName,
  311. formId: formData.formId,
  312. procDefName: records.procDefName
  313. }
  314. })
  315. })
  316. // this.goBack();
  317. // this.$router.push({
  318. // path: '/flowable/task/myProcess/send/index',
  319. // query: {
  320. // deployId: row.deploymentId,
  321. // procDefId: row.id,
  322. // name: row.name
  323. // }
  324. // })
  325. })
  326. }
  327. }
  328. })
  329. }else{
  330. }
  331. },
  332. /** 取消流程申请 */
  333. handleStop(row) {
  334. const params = {
  335. instanceId: row.procInsId
  336. }
  337. stopProcess(params).then(res => {
  338. this.$modal.msgSuccess(res.msg);
  339. this.getList();
  340. });
  341. },
  342. /** 流程流转记录 */
  343. handleFlowRecord(row) {
  344. // this.$router.push({
  345. // path: '/flowable/task/myProcess/detail/index',
  346. // query: {
  347. // procInsId: row.procInsId,
  348. // deployId: row.deployId,
  349. // taskId: row.taskId
  350. // }
  351. // })
  352. this.clickRow = row;
  353. this.detailsOpen = true;
  354. },
  355. /** 修改按钮操作 */
  356. handleUpdate(row) {
  357. this.reset();
  358. const id = row.id || this.ids
  359. getDeployment(id).then(response => {
  360. this.form = response.data;
  361. this.open = true;
  362. this.title = "修改流程定义";
  363. });
  364. },
  365. /** 提交按钮 */
  366. submitForm() {
  367. this.$refs["form"].validate(valid => {
  368. if (valid) {
  369. if (this.form.id != null) {
  370. updateDeployment(this.form).then(response => {
  371. this.$modal.msgSuccess("修改成功");
  372. this.open = false;
  373. this.getList();
  374. });
  375. } else {
  376. addDeployment(this.form).then(response => {
  377. this.$modal.msgSuccess("新增成功");
  378. this.open = false;
  379. this.getList();
  380. });
  381. }
  382. }
  383. });
  384. },
  385. /** 删除按钮操作 */
  386. handleDelete(row) {
  387. const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
  388. this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
  389. confirmButtonText: "确定",
  390. cancelButtonText: "取消",
  391. type: "warning"
  392. }).then(() => {
  393. return delDeployment(ids);
  394. }).then(() => {
  395. this.getList();
  396. this.$modal.msgSuccess("删除成功");
  397. })
  398. },
  399. /** 导出按钮操作 */
  400. handleExport() {
  401. const queryParams = this.queryParams;
  402. this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
  403. confirmButtonText: "确定",
  404. cancelButtonText: "取消",
  405. type: "warning"
  406. }).then(() => {
  407. return exportDeployment(queryParams);
  408. }).then(response => {
  409. this.download(response.msg);
  410. })
  411. }
  412. }
  413. };
  414. </script>