From d088628a4b421e7e0a8363b8b75529d8b2ecfe89 Mon Sep 17 00:00:00 2001 From: lyh <liuyuanheng@xalxzn.com> Date: 星期一, 24 二月 2025 10:07:14 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/flowable/modeler/modelerDesign.vue | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 400 insertions(+), 0 deletions(-) diff --git a/src/views/flowable/modeler/modelerDesign.vue b/src/views/flowable/modeler/modelerDesign.vue new file mode 100644 index 0000000..a3233e3 --- /dev/null +++ b/src/views/flowable/modeler/modelerDesign.vue @@ -0,0 +1,400 @@ +<template> + <div> +<!-- ==================娴佺▼瀹氫箟鍒楄〃=============== --> + <a-card v-if="!xmlFrame.open||xmlView"> + <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form-item label="娴佺▼鍚嶇О" prop="name"> + <el-input + v-model="queryParams.name" + placeholder="璇疯緭鍏ュ悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="娴佺▼鍒嗙被" prop="category"> + <el-select @change="handleQuery" v-model="queryParams.category" placeholder="璇烽�夋嫨娴佺▼鍒嗙被" clearable prop="category"> + <el-option label="璇烽�夋嫨" value="" /> + <el-option v-for="category in categorys" :key="category.id" :label="category.name" :value="category.id" /> + </el-select> + </el-form-item> + <el-form-item label="婵�娲�" prop="active"> + <el-switch + v-model="queryParams.active" + active-color="#13ce66" + inactive-color="#ff4949" + @change="handleQuery" + > + </el-switch> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + <el-form-item style="float:right"> + <el-button + type="primary" + icon="el-icon-plus" + size="mini" + @click="handleLoadXml" + >鏂板娴佺▼瀹氫箟</el-button> + </el-form-item> + </el-form> + + <el-table + v-loading="loading" fit + :data="definitionList" + row-key="id" + border + lazy + :load="load" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> + <el-table-column label="娴佺▼瀹氫箟id" align="center" prop="id" /> + <el-table-column label="娴佺▼鏍囪瘑Key" align="center" prop="key" /> + <el-table-column label="娴佺▼鍒嗙被" align="center" > + <template slot-scope="scope"> + <span>{{ getCategoryName(scope.row.category) }}</span> + </template> + </el-table-column> + <el-table-column label="娴佺▼鍚嶇О" align="center" :show-overflow-tooltip="true"> + <template slot-scope="scope"> + <el-button type="text" @click="handleReadImage(scope.row.deploymentId)"> + <span>{{ scope.row.name }}</span> + </el-button> + </template> + </el-table-column> + <el-table-column label="娴佺▼鐗堟湰" align="center"> + <template slot-scope="scope"> + <el-tag size="medium" >v{{ scope.row.version }}</el-tag> + </template> + </el-table-column> + <el-table-column label="鐘舵��" align="center"> + <template slot-scope="scope"> + <el-tag type="success" v-if="scope.row.suspensionState === 1">婵�娲�</el-tag> + <el-tag type="warning" v-if="scope.row.suspensionState === 2">鎸傝捣</el-tag> + </template> + </el-table-column> + <el-table-column label="閮ㄧ讲鏃堕棿" align="center" prop="deploymentTime" width="180"/> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-dropdown> + <span class="el-dropdown-link"> + 鏇村鎿嶄綔<i class="el-icon-arrow-down el-icon--right"></i> + </span> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item icon="el-icon-edit-outline" @click.native="handleLoadXml(scope.row)"> + 缂栬緫 + </el-dropdown-item> +<!-- <el-dropdown-item icon="el-icon-connection" @click.native="handleAddForm(scope.row)" v-if="scope.row.formId == null"> + 閰嶇疆琛ㄥ崟 + </el-dropdown-item>--> + <el-dropdown-item icon="el-icon-video-pause" @click.native="handleUpdateSuspensionState(scope.row)" v-if="scope.row.suspensionState === 1"> + 鎸傝捣 + </el-dropdown-item> + <el-dropdown-item icon="el-icon-video-play" @click.native="handleUpdateSuspensionState(scope.row)" v-if="scope.row.suspensionState === 2"> + 婵�娲� + </el-dropdown-item> + <el-dropdown-item icon="el-icon-delete" @click.native="handleDelete(scope.row)" > + 鍒犻櫎 + </el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + </template> + </el-table-column> + </el-table> + <el-pagination + v-show="total>0" + :total="total" + :current-page.sync="queryParams.pageNum" + :page-size.sync="queryParams.pageSize" + @size-change="getList" + @current-change="getList" + /> + </a-card> + <!-- 娴佺▼鍥� --> + <a-card v-if="xmlFrame.open&&!xmlView" :title="xmlFrame.title"> + <a slot="extra" href="#" @click="()=>{xmlFrame.open=false}">杩斿洖</a> + <bpmn-modeler + v-if="xmlShow" + ref="refNode" + :xml="xmlData" + :users="users" + :groups="groups" + :categorys="categorys" + :is-view="xmlView" + @save="save" + /> + </a-card> +<!-- 寮圭獥棰勮 --> + <a-modal :title="xmlFrame.title" :visible.sync="xmlView&&xmlFrame.open" :width="xmlFrame.width" + :footer="null" closable @cancel="()=>{xmlView=false,xmlFrame.open=false}" + > + <bpmn-modeler + v-if="xmlShow" + ref="refNode" + :xml="xmlData" + :users="users" + :groups="groups" + :categorys="categorys" + :is-view="xmlView" + @save="save" + /> + </a-modal> + + </div> +</template> + +<script> +import bpmnModeler from "workflow-bpmn-modeler"; +import { + categoryList, + delDeployment, + listDefinition, + readXml, + roleList, + saveXml, + updateState, + userList +} from "@views/flowable/api/definition"; + +export default { + components: { + bpmnModeler, + }, + data() { + return { + /*===================璁捐鍣ㄥ睘鎬�======================*/ + users: [], + groups: [], + categorys: [], + /*=================椤甸潰灞炴��===================*/ + loading: true, + // 鎬绘潯鏁� + total: 0, + // 娴佺▼瀹氫箟琛ㄦ牸鏁版嵁 + definitionList: [], + allDefinitionList: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + name: null, + category: null, + key: null, + tenantId: null, + deployTime: null, + derivedFrom: null, + derivedFromRoot: null, + parentDeploymentId: null, + engineVersion: null + }, + xmlFrame:{ + width:'70%', + title:'娴佺▼鍥�', + open: false, + src: "", + }, + // xml + xmlData:"", + xmlShow: true, + xmlView: false, + + }; + }, + created() { + this.initUserAndRole(); + this.getList(); + }, + methods: { + /*===============璁捐鍣�===============*/ + initUserAndRole(){ + userList({}).then(res=>{ + this.users = res.result||[] + this.users.map(o=>{ + o.id = o.username + o.name = o.realname + }) + }) + roleList({}).then(res=>{ + this.groups = res.result||[] + this.groups.map(o=>{ + o.name = o.roleName + }) + }) + categoryList({}).then(res=>{ + this.categorys = res.result||[] + }) + }, + getModelDetail(deployId) { + // 鍙戦�佽姹傦紝鑾峰彇xml + readXml(deployId).then(res =>{ + this.xmlData = res.result; + }) + }, + getCategoryName(category){ + let find = this.categorys.find(o=>o.id==category); + if (find){ + return find.name + } + return '' + }, + /*淇濆瓨娴佺▼瀹氫箟*/ + save(data) { + console.log(data); // { process: {...}, xml: '...', svg: '...' } + const params = { + name: data.process.name, + category: data.process.category, + xml: data.xml + } + saveXml(params).then(res => { + this.$message.success(res.message) + // 鍏抽棴褰撳墠鏍囩椤靛苟杩斿洖涓婁釜椤甸潰 + this.getList() + this.xmlFrame.open = false + }) + }, + /*================椤甸潰===============*/ + handleQuery() { + this.queryParams.pageNum = 1; + this.queryParams.suspensionState = this.queryParams.active?1:0; + this.getList(); + }, + /** 鏌ヨ娴佺▼瀹氫箟鍒楄〃 */ + getList() { + this.loading = true; + // 鏈�鏂扮増鏈� + const param1 = Object.assign({ + isLastVersion:1, + },this.queryParams) + listDefinition(param1).then(response => { + this.definitionList = response.result.records; + this.total = response.result.total; + this.loading = false; + for (const definition of this.definitionList) { + definition.hasChildren = true + } + }); + // 鎵�鏈� + const param2 = Object.assign({ + isLastVersion:0 + },this.queryParams,{ + pageSize: 9999, + pageNum:1 + }) + listDefinition(param2).then(response => { + console.log(response) + this.allDefinitionList = response.result.records; + }); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + resetForm(formName) { + this.$refs[formName].resetFields() + }, + /** 鎵撳紑娴佺▼璁捐寮圭獥椤甸潰 */ + handleLoadXml(row){ + if (row&&row.deploymentId){ + console.log(row.deploymentId) + this.handleReadImage(row.deploymentId) + this.xmlView = false + this.xmlFrame.title = "缂栬緫娴佺▼鍥�"; + } else { + //鏂板 + this.xmlData = '' + this.xmlView = false + this.xmlFrame.open = true + this.xmlFrame.title = '鏂板娴佺▼' + this.xmlShow = false + this.$nextTick(()=>{ + this.xmlShow = true + }) + } + this.xmlFrame.width = '90%' + }, + /** 娴佺▼鍥炬煡鐪� */ + handleReadImage(deploymentId){ + this.xmlFrame.title = "娴佺▼鍥�"; + this.xmlFrame.open = true; + this.xmlFrame.width = '70%'; + // this.xmlFrame.src = process.env.VUE_APP_BASE_API + "/flowable/definition/xmlFrame/" + deploymentId; + // 鍙戦�佽姹傦紝鑾峰彇xml + this.xmlView = true + readXml(deploymentId).then(res =>{ + if (res.success){ + this.xmlData = res.result + /*this.xmlShow = false + this.$nextTick(()=>{ + this.xmlShow = true + })*/ + } else { + this.$message.error("鑾峰彇娴佺▼鍥惧け璐ワ紒") + } + }) + }, + // 鎵撳紑涓氬姟琛ㄥ崟 + handleForm() { + }, + // 閰嶇疆涓氬姟琛ㄥ崟 + handleAddForm(row) { + }, + /** 鎸傝捣/婵�娲绘祦绋� */ + handleUpdateSuspensionState(row){ + let state = 1; + if (row.suspensionState === 1) { + state = 2 + } + const params = { + deployId: row.deploymentId, + state: state + } + updateState(params).then(res => { + this.$message.success(res.message); + this.getList(); + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + // const ids = row.deploymentId || this.ids; + const params = { + deployId: row.deploymentId + } + this.$confirm({ + title:"璀﹀憡", + content:'鏄惁纭鍒犻櫎娴佺▼瀹氫箟缂栧彿涓�"' + params.deployId + '"鐨勬暟鎹」?', + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + onOk:()=>{ + delDeployment(params).then(res=>{ + this.getList(); + if (res.success){ + this.$message.success('鍒犻櫎鎴愬姛'); + } else { + this.$message.success('鍒犻櫎澶辫触'); + } + }) + } + }) + }, + load(tree, treeNode, resolve) { + const key = tree.key; + const childrens = [] + for (const one of this.allDefinitionList) { + if (one.key==key&&one.id!=tree.id){ + childrens.push(one) + } + } + console.log(tree, treeNode,this.allDefinitionList,childrens) + resolve(childrens) + } + }, + computed: { + getContainer() { + return document.querySelector('#app') + } + } +}; +</script> \ No newline at end of file -- Gitblit v1.9.3