index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 style="width: 240px;" size="small"
  6. @keyup.enter.native="handleQuery"/>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  10. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  11. </el-form-item>
  12. </el-form>
  13. <el-row :gutter="10" class="mb8">
  14. <el-col :span="1.5">
  15. <el-button
  16. type="primary"
  17. icon="el-icon-plus"
  18. size="mini"
  19. @click="openBpmn"
  20. v-hasPermi="['infra:config:create']"
  21. >新建流程</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="list">
  26. <el-table-column label="ID" align="center" prop="id" />
  27. <el-table-column label="流程名字" align="center" prop="name" />
  28. <!-- <el-table-column label="创建时间" align="center" prop="createTime" >-->
  29. <!-- <template slot-scope="scope">-->
  30. <!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
  31. <!-- </template>-->
  32. <!-- </el-table-column>-->
  33. <el-table-column label="操作" align="center" >
  34. <template slot-scope="scope">
  35. <!-- <el-button size="mini" type="text" icon="el-icon-setting" @click="change(scope.row)">设计流程</el-button>-->
  36. <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="modelDelete(scope.row)">删除</el-button>-->
  37. <!-- <el-button size="mini" type="text" icon="el-icon-thumb" @click="modelDeploy(scope.row)">发布</el-button>-->
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  42. @pagination="getList"/>
  43. <el-dialog :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true">
  44. <vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave" :bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close"></vue-bpmn>
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <script>
  49. import {page} from "@/api/bpm/processDefinition";
  50. import VueBpmn from "@/components/bpmn/VueBpmn";
  51. export default {
  52. name: "processDefinition",
  53. data() {
  54. return {
  55. // 遮罩层
  56. loading: true,
  57. // 显示搜索条件
  58. showSearch: true,
  59. showBpmnBool: false,
  60. // 总条数
  61. total: 0,
  62. // 表格数据
  63. list: [],
  64. bpmnXML: null,
  65. bpmnData: {},
  66. // 查询参数
  67. queryParams: {
  68. pageNo: 1,
  69. pageSize: 10
  70. }
  71. };
  72. },
  73. components: {VueBpmn},
  74. created() {
  75. this.getList();
  76. },
  77. methods: {
  78. /** 查询登录日志列表 */
  79. getList() {
  80. this.loading = true;
  81. page(this.queryParams).then(response => {
  82. this.list = response.data.list;
  83. this.total = response.data.total;
  84. this.loading = false;
  85. }
  86. );
  87. },
  88. // 登录状态字典翻译
  89. statusFormat(row, column) {
  90. return this.selectDictLabel(this.statusOptions, row.status);
  91. },
  92. /** 搜索按钮操作 */
  93. handleQuery() {
  94. this.queryParams.pageNo = 1;
  95. this.getList();
  96. },
  97. /** 重置按钮操作 */
  98. resetQuery() {
  99. this.dateRange = [];
  100. this.resetForm("queryForm");
  101. this.handleQuery();
  102. },
  103. processSave(data) {
  104. const that = this;
  105. // 如果存在id 说明是修改
  106. if (data.id) {
  107. let postData = JSON.parse(data.metaInfo)
  108. postData.bpmnXml = data.bpmnXml
  109. postData.id = data.id
  110. postData.name = data.name
  111. postData.key = data.key
  112. postData.description = data.description
  113. modelUpdate(postData).then(response => {
  114. this.msgSuccess("保存成功");
  115. })
  116. this.showBpmnBool = false
  117. this.getList();
  118. return
  119. }
  120. modelSave(data).then(response => {
  121. that.bpmnData.id = response.data
  122. this.msgSuccess("保存成功");
  123. })
  124. this.showBpmnBool = false
  125. this.getList();
  126. },
  127. openBpmn() {
  128. this.bpmnData = {}
  129. this.bpmnXML = ""
  130. this.showBpmnBool = true
  131. },
  132. close() {
  133. this.showBpmnBool = false
  134. this.getList();
  135. },
  136. change(row) {
  137. const that = this;
  138. this.bpmnXML = ""
  139. this.bpmnData = {}
  140. exportBpmnXml({
  141. modelId: row.id
  142. }).then(response => {
  143. that.bpmnXML = response
  144. that.bpmnData = row
  145. that.showBpmnBool = true
  146. })
  147. },
  148. modelDelete(row) {
  149. const that = this;
  150. this.$confirm('是否删除该流程!!', "警告", {
  151. confirmButtonText: "确定",
  152. cancelButtonText: "取消",
  153. type: "warning"
  154. }).then(function() {
  155. modelDelete({
  156. modelId: row.id
  157. }).then(response => {
  158. that.getList();
  159. that.msgSuccess("删除成功");
  160. })
  161. })
  162. },
  163. modelDeploy(row) {
  164. const that = this;
  165. this.$confirm('是否部署该流程!!', "提示", {
  166. confirmButtonText: "确定",
  167. cancelButtonText: "取消",
  168. type: "success"
  169. }).then(function() {
  170. modelDeploy({
  171. modelId: row.id
  172. }).then(response => {
  173. that.getList();
  174. that.msgSuccess("部署成功");
  175. })
  176. })
  177. }
  178. }
  179. };
  180. </script>
  181. <style>
  182. .el-dialog > .el-dialog__body{
  183. margin: 0;
  184. border: 0;
  185. }
  186. .bpmn-viewer-header{
  187. background: white;
  188. }
  189. .v-modal{
  190. z-index: 2000!important;
  191. }
  192. </style>