index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="app-container">
  3. <!-- 列表 -->
  4. <el-table v-loading="loading" :data="list">
  5. <el-table-column label="定义编号" align="center" prop="id" />
  6. <el-table-column label="定义名称" align="center" prop="name" width="200">
  7. <template slot-scope="scope">
  8. <el-button type="text" @click="handleBpmnDetail(scope.row)">
  9. <span>{{ scope.row.name }}</span>
  10. </el-button>
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="定义分类" align="center" prop="category" width="100">
  14. <template slot-scope="scope">
  15. <span>{{ getDictDataLabel(DICT_TYPE.BPM_MODEL_CATEGORY, scope.row.category) }}</span>
  16. </template>
  17. </el-table-column>
  18. <el-table-column label="表单信息" align="center" prop="formId">
  19. <template slot-scope="scope">
  20. <el-button v-if="scope.row.formId" type="text" @click="handleFormDetail(scope.row)">
  21. <span>{{ scope.row.formName }}</span>
  22. </el-button>
  23. <label v-else>暂无表单</label>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80">
  27. <template slot-scope="scope">
  28. <el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag>
  29. <el-tag size="medium" type="warning" v-else>未部署</el-tag>
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="激活状态" align="center" prop="version" width="80">
  33. <template slot-scope="scope">
  34. <el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
  35. <el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180">
  39. <template slot-scope="scope">
  40. <span>{{ parseTime(scope.row.deploymentTime) }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="定义描述" align="center" prop="description" width="300" show-overflow-tooltip />
  44. </el-table>
  45. <!-- 流程表单配置详情 -->
  46. <el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body>
  47. <parser :key="new Date().getTime()" :form-conf="detailForm" />
  48. </el-dialog>
  49. <!-- 流程模型图的预览 -->
  50. <el-dialog title="流程图" :visible.sync="showBpmnOpen" width="80%" append-to-body>
  51. <my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" />
  52. </el-dialog>
  53. <!-- 分页组件 -->
  54. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  55. @pagination="getList"/>
  56. </div>
  57. </template>
  58. <script>
  59. import {getDefinitionBpmnXML, getDefinitionPage} from "@/api/bpm/definition";
  60. import {DICT_TYPE, getDictDatas} from "@/utils/dict";
  61. import {getForm} from "@/api/bpm/form";
  62. import {decodeFields} from "@/utils/formGenerator";
  63. import Parser from '@/components/parser/Parser'
  64. export default {
  65. name: "processDefinition",
  66. components: {
  67. Parser
  68. },
  69. data() {
  70. return {
  71. // 遮罩层
  72. loading: true,
  73. // 总条数
  74. total: 0,
  75. // 表格数据
  76. list: [],
  77. // 查询参数
  78. queryParams: {
  79. pageNo: 1,
  80. pageSize: 10
  81. },
  82. // 流程表单详情
  83. detailOpen: false,
  84. detailForm: {
  85. fields: []
  86. },
  87. // BPMN 数据
  88. showBpmnOpen: false,
  89. bpmnXML: null,
  90. bpmnControlForm: {
  91. prefix: "activiti"
  92. },
  93. // 数据字典
  94. categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
  95. };
  96. },
  97. created() {
  98. const key = this.$route.query && this.$route.query.key
  99. if (key) {
  100. this.queryParams['key'] = key
  101. }
  102. this.getList();
  103. },
  104. methods: {
  105. /** 查询流程定义列表 */
  106. getList() {
  107. this.loading = true;
  108. getDefinitionPage(this.queryParams).then(response => {
  109. this.list = response.data.list;
  110. this.total = response.data.total;
  111. this.loading = false;
  112. }
  113. );
  114. },
  115. /** 流程表单的详情按钮操作 */
  116. handleFormDetail(row) {
  117. getForm(row.formId).then(response => {
  118. // 设置值
  119. const data = response.data
  120. this.detailForm = {
  121. ...JSON.parse(data.conf),
  122. fields: decodeFields(data.fields)
  123. }
  124. // 弹窗打开
  125. this.detailOpen = true
  126. })
  127. },
  128. /** 流程图的详情按钮操作 */
  129. handleBpmnDetail(row) {
  130. getDefinitionBpmnXML(row.id).then(response => {
  131. this.bpmnXML = response.data
  132. // 弹窗打开
  133. this.showBpmnOpen = true
  134. })
  135. },
  136. }
  137. };
  138. </script>
  139. <style lang="scss">
  140. .my-process-designer {
  141. height: calc(100vh - 200px);
  142. }
  143. </style>