综合办公系统
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.

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