From 5a98e5f9ce50bb5de56a54cae14e5ea49fbe2c07 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 17 三月 2025 16:19:29 +0800 Subject: [PATCH] 更新流程实现 --- src/api/flowable/definition.js | 11 +++++ src/components/Process/index.vue | 40 ++++++++++++++++++++ src/views/flowable/definition/model.vue | 18 ++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/api/flowable/definition.js b/src/api/flowable/definition.js index b280346..03fb263 100644 --- a/src/api/flowable/definition.js +++ b/src/api/flowable/definition.js @@ -95,7 +95,7 @@ }) } -// 璇诲彇xml鏂囦欢 +// 淇濆瓨xml鏂囦欢 export function saveXml(data) { return request({ url: '/flowable/definition/save', @@ -104,6 +104,15 @@ }) } +// 鏇存柊xml鏂囦欢 +export function updateXml(data) { + return request({ + url: '/flowable/definition/update', + method: 'post', + data: data + }) +} + // 鏂板娴佺▼瀹氫箟 export function addDeployment(data) { return request({ diff --git a/src/components/Process/index.vue b/src/components/Process/index.vue index 56e62f3..290cb9b 100644 --- a/src/components/Process/index.vue +++ b/src/components/Process/index.vue @@ -39,6 +39,7 @@ <el-button size="mini" icon="el-icon-download" @click="saveXML(true)">涓嬭浇xml</el-button> <el-button size="mini" icon="el-icon-picture" @click="saveImg('svg', true)">涓嬭浇svg</el-button> <el-button size="mini" type="primary" @click="save">淇濆瓨妯″瀷</el-button> + <el-button size="mini" type="warning" @click="update">鏇存柊妯″瀷</el-button> <el-button size="mini" type="danger" @click="goBack">鍏抽棴</el-button> </el-button-group> </div> @@ -68,6 +69,7 @@ // 寮曞叆flowable鐨勮妭鐐规枃浠� import FlowableModule from './flowable/flowable.json' import customControlsModule from './customPanel' +import {taskWait} from "@/api/projectProcess/projectProcess"; export default { name: "BpmnModel", components: {Designer}, @@ -256,6 +258,39 @@ this.goBack(); }, + update() { + this.$prompt('鏇存柊娴佺▼涓嶄細浜х敓鏂扮増鏈紝閲嶈鐨勬槸浣犱笉鑳戒慨鏀规祦绋嬫帹杩涗腑宸茬粡鎵ц杩囩殑浠诲姟鑺傜偣锛屽惁鍒欎細寮曡捣鏁版嵁闂锛侊紒锛�<span style="color: red">璇峰湪涓嬫柟杈撳叆锛氭垜宸茬煡鏅�</span>', '鏇存柊娴佺▼', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + customClass: 'updateC', + dangerouslyUseHTMLString: true, + inputType: 'textarea', + inputValidator: (value) => { + if (!value || value.trim() === '') { + return "璇疯緭鍏ワ細鎴戝凡鐭ユ檽" + } + if (value !== "鎴戝凡鐭ユ檽") { + return "杈撳叆閿欒锛岃杈撳叆锛氭垜宸茬煡鏅�" + } + return true + }, + inputErrorMessage: '璇疯緭鍏ワ細鎴戝凡鐭ユ檽' + }).then(async ({value}) => { + const process = this.getProcess() + const xml = await this.saveXML() + const svg = await this.saveImg() + const result = {process, xml, svg} + this.$emit('update', result) + window.parent.postMessage(result, '*') + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堟搷浣�' + }); + }); + }, + // 鎵撳紑娴佺▼鏂囦欢 openBpmn(file) { const reader = new FileReader() @@ -348,5 +383,10 @@ width: 100%; margin: 0 0 5px; } + +} + +.updateC { + width: 500px; } </style> diff --git a/src/views/flowable/definition/model.vue b/src/views/flowable/definition/model.vue index 3ef28fd..93ca8e3 100644 --- a/src/views/flowable/definition/model.vue +++ b/src/views/flowable/definition/model.vue @@ -5,6 +5,7 @@ :xml="xml" :is-view="false" @save="save" + @update="update" @showXML="showXML" /> <!--鍦ㄧ嚎鏌ョ湅xml--> @@ -17,7 +18,7 @@ </div> </template> <script> -import {readXml, roleList, saveXml, userList,expList} from "@/api/flowable/definition"; +import {readXml, roleList, saveXml, userList, expList, updateXml} from "@/api/flowable/definition"; import BpmnModel from '@/components/Process' import vkBeautify from 'vkbeautify' import hljs from 'highlight.js' @@ -101,6 +102,21 @@ this.$tab.closeOpenPage(obj); }) }, + /** 鏇存柊xml */ + update(data) { + const params = { + deploymentId: this.$route.query && this.$route.query.deployId, + name: data.process.name, + category: data.process.category, + xml: data.xml + } + updateXml(params).then(res => { + this.$modal.msgSuccess(res.msg) + // 鍏抽棴褰撳墠鏍囩椤靛苟杩斿洖涓婁釜椤甸潰 + const obj = { path: "/flowable/definition", query: { t: Date.now()} }; + this.$tab.closeOpenPage(obj); + }) + }, /** 鎸囧畾娴佺▼鍔炵悊浜哄憳鍒楄〃 */ getDataList() { userList().then(res => { -- Gitblit v1.8.0