Changes
This commit is contained in:
parent
b9943bc48b
commit
79f81dfb60
31
.gitignore
vendored
31
.gitignore
vendored
@ -1,11 +1,24 @@
|
||||
# ---> Vue
|
||||
# gitignore template for Vue.js projects
|
||||
#
|
||||
# Recommended template: Node.gitignore
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# TODO: where does this rule come from?
|
||||
docs/_book
|
||||
|
||||
# TODO: where does this rule come from?
|
||||
test/
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
13
index.html
Normal file
13
index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
24
package.json
Normal file
24
package.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "bpm_web",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@logicflow/core": "^2.0.7",
|
||||
"@logicflow/extension": "^2.0.11",
|
||||
"element-plus": "^2.8.8",
|
||||
"file-saver": "^2.0.5",
|
||||
"vkbeautify": "^0.99.3",
|
||||
"vue": "^3.5.12",
|
||||
"x2js": "^3.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"vite": "^5.4.10"
|
||||
}
|
||||
}
|
2
public/clear.svg
Normal file
2
public/clear.svg
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M7.004 23.087l7.08-7.081-7.07-7.071L8.929 7.02l7.067 7.069L23.084 7l1.912 1.913-7.089 7.093 7.075 7.077-1.912 1.913-7.074-7.073L8.917 25z"/></svg>
|
After Width: | Height: | Size: 378 B |
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
493
src/App.vue
Normal file
493
src/App.vue
Normal file
@ -0,0 +1,493 @@
|
||||
<script setup>
|
||||
|
||||
import LogicFlow, {EventType} from "@logicflow/core";
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import {Control, DndPanel, Menu, SelectionSelect} from "@logicflow/extension";
|
||||
import '@logicflow/extension/lib/style/index.css'
|
||||
import "@logicflow/core/lib/style/index.css";
|
||||
import X2JS from "x2js";
|
||||
import {ElMessage} from "element-plus";
|
||||
import { saveAs } from 'file-saver';
|
||||
import vkbeautify from 'vkbeautify';
|
||||
|
||||
const upload = ref(null);
|
||||
|
||||
const state = reactive({
|
||||
logicFlowObj: null,
|
||||
operateNodeId: 0,
|
||||
descriptionDialogFormVisible: false,
|
||||
setClassFormVisible: false,
|
||||
loadXMLFormVisible: false,
|
||||
})
|
||||
|
||||
const descriptionForm = reactive({
|
||||
description: '',
|
||||
fileName:'',
|
||||
})
|
||||
|
||||
const classForm = reactive({
|
||||
clazz: ''
|
||||
})
|
||||
|
||||
const xmlForm = reactive({
|
||||
xmlStr: '',
|
||||
xmlFile: null
|
||||
})
|
||||
|
||||
let node_id = 1;
|
||||
const x2js = new X2JS();
|
||||
|
||||
onMounted(() => {
|
||||
LogicFlow.use(DndPanel);
|
||||
LogicFlow.use(SelectionSelect);
|
||||
LogicFlow.use(Menu);
|
||||
LogicFlow.use(Control);
|
||||
|
||||
const lf = new LogicFlow({
|
||||
container: document.querySelector('.container'),
|
||||
stopScrollGraph: true,
|
||||
stopZoomGraph: true,
|
||||
grid: {
|
||||
type: 'dot',
|
||||
size: 20,
|
||||
},
|
||||
textEdit: true,
|
||||
isSilentMode: false,
|
||||
edgeType: 'line',
|
||||
snapline: true,
|
||||
// 样式配置
|
||||
style: {
|
||||
rect: {
|
||||
radius: 6
|
||||
}
|
||||
}
|
||||
});
|
||||
state.logicFlowObj = lf
|
||||
|
||||
lf.extension.control.addItem({
|
||||
key: 'clear-page',
|
||||
iconClass: 'custom-clear-page',
|
||||
title: '',
|
||||
text: '重置',
|
||||
onClick: (lf, ev) => {
|
||||
lf.render()
|
||||
},
|
||||
})
|
||||
|
||||
lf.extension.dndPanel.setPatternItems([
|
||||
{
|
||||
type: 'circle',
|
||||
text: 'start',
|
||||
label: '开始节点',
|
||||
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAABGdBTUEAALGPC/xhBQAAAnBJREFUOBGdVL1rU1EcPfdGBddmaZLiEhdx1MHZQXApraCzQ7GKLgoRBxMfcRELuihWKcXFRcEWF8HBf0DdDCKYRZpnl7p0svLe9Zzbd29eQhTbC8nv+9zf130AT63jvooOGS8Vf9Nt5zxba7sXQwODfkWpkbjTQfCGUd9gIp3uuPP8bZ946g56dYQvnBg+b1HB8VIQmMFrazKcKSvFW2dQTxJnJdQ77urmXWOMBCmXM2Rke4S7UAW+/8ywwFoewmBps2tu7mbTdp8VMOkIRAkKfrVawalJTtIliclFbaOBqa0M2xImHeVIfd/nKAfVq/LGnPss5Kh00VEdSzfwnBXPUpmykNss4lUI9C1ga+8PNrBD5YeqRY2Zz8PhjooIbfJXjowvQJBqkmEkVnktWhwu2SM7SMx7Cj0N9IC0oQXRo8xwAGzQms+xrB/nNSUWVveI48ayrFGyC2+E2C+aWrZHXvOuz+CiV6iycWe1Rd1Q6+QUG07nb5SbPrL4426d+9E1axKjY3AoRrlEeSQo2Eu0T6BWAAr6COhTcWjRaYfKG5csnvytvUr/WY4rrPMB53Uo7jZRjXaG6/CFfNMaXEu75nG47X+oepU7PKJvvzGDY1YLSKHJrK7vFUwXKkaxwhCW3u+sDFMVrIju54RYYbFKpALZAo7sB6wcKyyrd+aBMryMT2gPyD6GsQoRFkGHr14TthZni9ck0z+Pnmee460mHXbRAypKNy3nuMdrWgVKj8YVV8E7PSzp1BZ9SJnJAsXdryw/h5ctboUVi4AFiCd+lQaYMw5z3LGTBKjLQOeUF35k89f58Vv/tGh+l+PE/wG0rgfIUbZK5AAAAABJRU5ErkJggg==',
|
||||
},
|
||||
{
|
||||
type: 'rect',
|
||||
text: 'autoTask',
|
||||
label: '用户任务',
|
||||
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAEFVwZaAAAABGdBTUEAALGPC/xhBQAAAqlJREFUOBF9VM9rE0EUfrMJNUKLihGbpLGtaCOIR8VjQMGDePCgCCIiCNqzCAp2MyYUCXhUtF5E0D+g1t48qAd7CCLqQUQKEWkStcEfVGlLdp/fm3aW2QQdyLzf33zz5m2IsAZ9XhDpyaaIZkTS4ASzK41TFao88GuJ3hsr2pAbipHxuSYyKRugagICGANkfFnNh3HeE2N0b3nN2cgnpcictw5veJIzxmDamSlxxQZicq/mflxhbaH8BLRbuRwNtZp0JAhoplVRUdzmCe/vO27wFuuA3S5qXruGdboy5/PRGFsbFGKo/haRtQHIrM83bVeTrOgNhZReWaYGnE4aUQgTJNvijJFF4jQ8BxJE5xfKatZWmZcTQ+BVgh7s8SgPlCkcec4mGTmieTP4xd7PcpIEg1TX6gdeLW8rTVMVLVvb7ctXoH0Cydl2QOPJBG21STE5OsnbweVYzAnD3A7PVILuY0yiiyDwSm2g441r6rMSgp6iK42yqroI2QoXeJVeA+YeZSa47gZdXaZWQKTrG93rukk/l2Al6Kzh5AZEl7dDQy+JjgFahQjRopSxPbrbvK7GRe9ePWBo1wcU7sYrFZtavXALwGw/7Dnc50urrHJuTPSoO2IMV3gUQGNg87IbSOIY9BpiT9HV7FCZ94nPXb3MSnwHn/FFFE1vG6DTby+r31KAkUktB3Qf6ikUPWxW1BkXSPQeMHHiW0+HAd2GelJsZz1OJegCxqzl+CLVHa/IibuHeJ1HAKzhuDR+ymNaRFM+4jU6UWKXorRmbyqkq/D76FffevwdCp+jN3UAN/C9JRVTDuOxC/oh+EdMnqIOrlYteKSfadVRGLJFJPSB/ti/6K8f0CNymg/iH2gO/f0DwE0yjAFO6l8JaR5j0VPwPwfaYHqOqrCI319WzwhwzNW/aQAAAABJRU5ErkJggg==',
|
||||
className: 'important-node'
|
||||
},
|
||||
{
|
||||
type: 'circle',
|
||||
text: 'end',
|
||||
label: '结束节点',
|
||||
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAABGdBTUEAALGPC/xhBQAAA1BJREFUOBFtVE1IVUEYPXOf+tq40Y3vPcmFIdSjIorWoRG0ERWUgnb5FwVhYQSl72oUoZAboxKNFtWiwKRN0M+jpfSzqJAQclHo001tKkjl3emc8V69igP3znzfnO/M9zcDcKT67azmjYWTwl9Vn7Vumeqzj1DVb6cleQY4oAVnIOPb+mKAGxQmKI5CWNJ2aLPatxWa3aB9K7/fB+/Z0jUF6TmMlFLQqrkECWQzOZxYGjTlOl8eeKaIY5yHnFn486xBustDjWT6dG7pmjHOJd+33t0iitTPkK6tEvjxq4h2MozQ6WFSX/LkDUGfFwfhEZj1Auz/U4pyAi5Sznd7uKzznXeVHlI/Aywmk6j7fsUsEuCGADrWARXXwjxWQsUbIupDHJI7kF5dRktg0eN81IbiZXiTESic50iwS+t1oJgL83jAiBupLDCQqwziaWSoAFSeIR3P5Xv5az00wyIn35QRYTwdSYbz8pH8fxUUAtxnFvYmEmgI0wYXUXcCCSpeEVpXlsRhBnCEATxWylL9+EKCAYhe1NGstUa6356kS9NVvt3DU2fd+Wtbm/+lSbylJqsqkSm9CRhvoJVlvKPvF1RKY/FcPn5j4UfIMLn8D4UYb54BNsilTDXKnF4CfTobA0FpoW/LSp306wkXM+XaOJhZaFkcNM82ASNAWMrhrUbRfmyeI1FvRBTpN06WKxa9BK0o2E4Pd3zfBBEwPsv9sQBnmLVbLEIZ/Xe9LYwJu/Er17W6HYVBc7vmuk0xUQ+pqxdom5Fnp55SiytXLPYoMXNM4u4SNSCFWnrVIzKG3EGyMXo6n/BQOe+bX3FClY4PwydVhthOZ9NnS+ntiLh0fxtlUJHAuGaFoVmttpVMeum0p3WEXbcll94l1wM/gZ0Ccczop77VvN2I7TlsZCsuXf1WHvWEhjO8DPtyOVg2/mvK9QqboEth+7pD6NUQC1HN/TwvydGBARi9MZSzLE4b8Ru3XhX2PBxf8E1er2A6516o0w4sIA+lwURhAON82Kwe2iDAC1Watq4XHaGQ7skLcFOtI5lDxuM2gZe6WFIotPAhbaeYlU4to5cuarF1QrcZ/lwrLaCJl66JBocYZnrNlvm2+MBCTmUymPrYZVbjdlr/BxlMjmNmNI3SAAAAAElFTkSuQmCC',
|
||||
}
|
||||
]);
|
||||
|
||||
lf.extension.menu.setMenuByType({
|
||||
type: "circle",
|
||||
menu: [
|
||||
{
|
||||
text: '删除',
|
||||
callback(node) {
|
||||
// node为该节点数据
|
||||
lf.deleteNode(node.id);
|
||||
},
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
lf.extension.menu.setMenuByType({
|
||||
type: "rect",
|
||||
menu: [
|
||||
{
|
||||
text: '删除',
|
||||
callback(node) {
|
||||
// node为该节点数据
|
||||
lf.deleteNode(node.id);
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "设置clazz",
|
||||
callback(node) {
|
||||
state.operateNodeId = node.id
|
||||
state.setClassFormVisible = true
|
||||
classForm.clazz = node.properties?.clazz ? node.properties?.clazz : ""
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
lf.on(EventType.NODE_DND_ADD, (data) => {
|
||||
if (data.data.text.value === 'start') {
|
||||
node_id = 1
|
||||
lf.getNodeModelById(data.data.id).setProperties({
|
||||
transition: {
|
||||
_g: ":-15,20",
|
||||
},
|
||||
_id: node_id,
|
||||
_name: "开始",
|
||||
_g: "105,17,30,30"
|
||||
});
|
||||
node_id++
|
||||
} else if (data.data.type === 'rect') {
|
||||
lf.getNodeModelById(data.data.id).setProperties({
|
||||
transition: {
|
||||
_g: ":-15,20",
|
||||
},
|
||||
_g: "72,469,88,48",
|
||||
_id: node_id,
|
||||
});
|
||||
node_id++
|
||||
} else if (data.data.text.value === 'end') {
|
||||
lf.getNodeModelById(data.data.id).setProperties({
|
||||
_id: node_id,
|
||||
_name: "结束",
|
||||
_g: "101,549,30,30"
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
lf.on(EventType.EDGE_ADD, (data) => {
|
||||
const sourceNode = lf.getNodeModelById(data.data.sourceNodeId)
|
||||
const targetNode = lf.getNodeModelById(data.data.targetNodeId)
|
||||
sourceNode.setProperties({
|
||||
...sourceNode.properties,
|
||||
transition: {
|
||||
_to: targetNode.properties._id,
|
||||
...sourceNode.properties.transition,
|
||||
},
|
||||
})
|
||||
})
|
||||
lf.render();
|
||||
})
|
||||
|
||||
const onButtonClick = () => {
|
||||
const result_data = state.logicFlowObj.getGraphData()
|
||||
if (result_data.nodes.length === 0 ) {
|
||||
ElMessage.error('一个节点也没有?')
|
||||
return;
|
||||
} else if (result_data.nodes.length !== result_data.edges.length + 1) {
|
||||
ElMessage.error('检查一下有没有没链接的节点?')
|
||||
return;
|
||||
}
|
||||
const null_class_arr = result_data.nodes.filter(item => (item.properties.clazz == null || item.properties.clazz.length === 0) && item.type === 'rect')
|
||||
if (null_class_arr.length > 0) {
|
||||
ElMessage.error(`${null_class_arr[0].text.value} 节点没有配置class路径,请检查?`)
|
||||
return;
|
||||
}
|
||||
state.descriptionDialogFormVisible = true
|
||||
}
|
||||
|
||||
const onDialogButtonClick = () => {
|
||||
const result_data = state.logicFlowObj.getGraphData()
|
||||
const description = descriptionForm.description;
|
||||
const result_description = description.trim();
|
||||
const start_node = result_data.nodes.filter(item => item.text.value === 'start' || item.text.value === '开始')
|
||||
const autoTask_node = result_data.nodes.filter(item => item.type === 'rect')
|
||||
const end_node = result_data.nodes.filter(item => item.text.value === 'end')
|
||||
let result_autoTask = []
|
||||
autoTask_node.forEach(item => {
|
||||
const { height, width, clazz, ...autoTask_properties } = item.properties
|
||||
autoTask_properties._id = autoTask_properties._id == null ? item.id : autoTask_properties._id
|
||||
autoTask_properties._name = item.text.value
|
||||
autoTask_properties._g = '72,469,88,48'
|
||||
autoTask_properties.action = {
|
||||
_type: 'java',
|
||||
actionHandle: {
|
||||
_clazz: item.properties.clazz,
|
||||
_method:'run',
|
||||
var:[
|
||||
{
|
||||
_name: "request",
|
||||
_description: "入参",
|
||||
_dataType: "com.slf.polaris.entity.request.BpmRequestInfo",
|
||||
_contextVarName: "request",
|
||||
_inOutType: "param"
|
||||
},
|
||||
{
|
||||
_name: "response",
|
||||
_description: "出参",
|
||||
_dataType: "com.slf.polaris.entity.response.BpmResponseInfo",
|
||||
_contextVarName: "response",
|
||||
_inOutType: "param"
|
||||
},
|
||||
{
|
||||
_name: "appInfo",
|
||||
_description: "上下文",
|
||||
_dataType: "com.slf.polaris.entity.AppInfo",
|
||||
_contextVarName: "appInfo",
|
||||
_inOutType: "param"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
result_autoTask.push(autoTask_properties)
|
||||
})
|
||||
let { height, width, ...start_properties } = start_node[0].properties
|
||||
if (end_node.length > 0) {
|
||||
delete end_node[0].properties.width
|
||||
delete end_node[0].properties.height
|
||||
}
|
||||
const default_end_node = {
|
||||
_id: node_id,
|
||||
_name: "结束",
|
||||
_g: "101,549,30,30"
|
||||
}
|
||||
const result_json = {
|
||||
bpm: {
|
||||
var: [
|
||||
{
|
||||
_name: "request",
|
||||
_description: "入参",
|
||||
_dataType: "com.slf.polaris.entity.request.BpmRequestInfo",
|
||||
_inOutType: "param"
|
||||
},
|
||||
{
|
||||
_name: "response",
|
||||
_description: "出参",
|
||||
_dataType: "com.slf.polaris.entity.response.BpmResponseInfo",
|
||||
_inOutType: "param"
|
||||
},
|
||||
{
|
||||
_name: "appInfo",
|
||||
_description: "上下文",
|
||||
_dataType: "com.slf.polaris.entity.AppInfo",
|
||||
_inOutType: "param"
|
||||
}
|
||||
],
|
||||
start: {
|
||||
_id: 1,
|
||||
_name: "开始",
|
||||
_g: "105,17,30,30",
|
||||
...start_properties
|
||||
},
|
||||
autoTask: result_autoTask,
|
||||
end: end_node.length > 0 ? end_node[0].properties : default_end_node,
|
||||
_code: "dsp.pay",
|
||||
_name: "dsp_pay",
|
||||
_type: "process",
|
||||
_description: result_description
|
||||
}
|
||||
}
|
||||
let xml_result = '<?xml version="1.0" encoding="UTF-8" ?>' + x2js.js2xml(result_json)
|
||||
xml_result = vkbeautify.xml(xml_result)
|
||||
const blob = new Blob([xml_result], { type: 'text/plain;charset=utf-8' })
|
||||
saveAs(blob, descriptionForm.fileName + '.bpm')
|
||||
}
|
||||
|
||||
const onClassFormClick = () => {
|
||||
const node = state.logicFlowObj.getNodeModelById(state.operateNodeId);
|
||||
node.properties.clazz = classForm.clazz
|
||||
state.setClassFormVisible = false
|
||||
}
|
||||
const onLoadXML = () => {
|
||||
state.logicFlowObj.render();
|
||||
if (xmlForm.xmlStr && xmlForm.xmlStr.length > 0) {
|
||||
handleXmlStr(xmlForm.xmlStr)
|
||||
} else if (xmlForm.xmlFile) {
|
||||
const reader = new FileReader()
|
||||
reader.onload = (event) => {
|
||||
handleXmlStr(event.target.result)
|
||||
}
|
||||
reader.readAsText(xmlForm.xmlFile.raw)
|
||||
}
|
||||
}
|
||||
|
||||
const handleXmlStr = (xmlStr) => {
|
||||
const json = x2js.xml2js(xmlStr)
|
||||
if (json.bpm == null) {
|
||||
ElMessage.error('你这啥xml啊?')
|
||||
return;
|
||||
}
|
||||
let start_node_id = json.bpm.start._id;
|
||||
let x = 160;
|
||||
const y = 280;
|
||||
const length = 160;
|
||||
state.logicFlowObj.addNode({
|
||||
type: 'circle',
|
||||
x: x,
|
||||
y: y,
|
||||
id: json.bpm.start._id,
|
||||
text:{
|
||||
value: json.bpm.start._name,
|
||||
x: x,
|
||||
y: y,
|
||||
},
|
||||
properties: {
|
||||
transition: json.bpm.start.transition
|
||||
}
|
||||
})
|
||||
x += length
|
||||
json.bpm.autoTask.forEach((item) => {
|
||||
state.logicFlowObj.addNode({
|
||||
type: 'rect',
|
||||
x: x,
|
||||
y: y,
|
||||
id: item._id,
|
||||
text:{
|
||||
value: item._name,
|
||||
x: x,
|
||||
y: y,
|
||||
},
|
||||
properties: {
|
||||
clazz: item.action.actionHandle._clazz,
|
||||
transition: {
|
||||
...item.transition,
|
||||
}
|
||||
}
|
||||
})
|
||||
state.logicFlowObj.addEdge({
|
||||
sourceNodeId: start_node_id,
|
||||
targetNodeId: item._id
|
||||
});
|
||||
start_node_id = item._id
|
||||
x += length
|
||||
})
|
||||
state.logicFlowObj.addNode({
|
||||
type: 'circle',
|
||||
x: x,
|
||||
y: y,
|
||||
id: json.bpm.end._id,
|
||||
text:{
|
||||
value: 'end',
|
||||
x: x,
|
||||
y: y,
|
||||
},
|
||||
properties: json.bpm.end
|
||||
})
|
||||
state.logicFlowObj.addEdge({
|
||||
sourceNodeId: start_node_id,
|
||||
targetNodeId: json.bpm.end._id
|
||||
});
|
||||
state.loadXMLFormVisible = false
|
||||
xmlForm.xmlStr = ""
|
||||
xmlForm.xmlFile = null
|
||||
}
|
||||
|
||||
const handleExceed = (files) => {
|
||||
upload.value.clearFiles()
|
||||
upload.value.handleStart(files[0])
|
||||
}
|
||||
|
||||
const handleUploadChange = (files) => {
|
||||
xmlForm.xmlFile = files
|
||||
}
|
||||
|
||||
const handleUploadRemove = () => {
|
||||
xmlForm.xmlFile = null
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container"></div>
|
||||
<div>
|
||||
<ElButton type="primary" @click="onButtonClick">生成xml</ElButton>
|
||||
<ElButton @click="state.loadXMLFormVisible = true">读取xml</ElButton>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="state.descriptionDialogFormVisible" width="800" align-center>
|
||||
<template #header>
|
||||
<div class="dialog_title">配置<el-tag>_description</el-tag>参数</div>
|
||||
</template>
|
||||
<el-form :model="descriptionForm">
|
||||
<el-form-item label="_description:" label-width="150">
|
||||
<el-input v-model="descriptionForm.description" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="导出bpm文件名称:" label-width="150">
|
||||
<el-input v-model="descriptionForm.fileName" autocomplete="off" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="descriptionForm.description.trim().length === 0 || descriptionForm.fileName.trim().length === 0"
|
||||
@click="onDialogButtonClick">
|
||||
导出
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="state.setClassFormVisible" width="800" align-center>
|
||||
<template #header>
|
||||
<div class="dialog_title">配置<el-tag>clazz</el-tag>参数</div>
|
||||
</template>
|
||||
<el-form :model="classForm">
|
||||
<el-form-item label="clazz:" >
|
||||
<el-input v-model="classForm.clazz" autocomplete="off" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button
|
||||
:disabled="classForm.clazz.trim().length === 0 || classForm.clazz.trim().length === 0"
|
||||
type="primary"
|
||||
@click="onClassFormClick">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="state.loadXMLFormVisible" title="读取xml" width="800" align-center>
|
||||
<el-form :model="xmlForm">
|
||||
<el-form-item label="xml:" label-width="120">
|
||||
<el-input :disabled="xmlForm.xmlFile != null" v-model="xmlForm.xmlStr" type="textarea" :rows="12" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="xml/bpm文件:" label-width="120">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-xml"
|
||||
drag
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="handleUploadChange"
|
||||
:on-remove="handleUploadRemove"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
:disabled="xmlForm.xmlStr.trim().length !== 0"
|
||||
>
|
||||
<div class="el-upload__text">
|
||||
Drop file here or <em>click to upload</em>
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onLoadXML">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
height: 80vh;
|
||||
width: 100%;
|
||||
}
|
||||
.dialog_title {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.upload-xml {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
1
src/assets/vue.svg
Normal file
1
src/assets/vue.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
After Width: | Height: | Size: 496 B |
43
src/components/HelloWorld.vue
Normal file
43
src/components/HelloWorld.vue
Normal file
@ -0,0 +1,43 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
defineProps({
|
||||
msg: String,
|
||||
})
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<div class="card">
|
||||
<button type="button" @click="count++">count is {{ count }}</button>
|
||||
<p>
|
||||
Edit
|
||||
<code>components/HelloWorld.vue</code> to test HMR
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Check out
|
||||
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
||||
>create-vue</a
|
||||
>, the official Vue + Vite starter
|
||||
</p>
|
||||
<p>
|
||||
Learn more about IDE Support for Vue in the
|
||||
<a
|
||||
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
||||
target="_blank"
|
||||
>Vue Docs Scaling up Guide</a
|
||||
>.
|
||||
</p>
|
||||
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
</style>
|
10
src/main.js
Normal file
10
src/main.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import "@logicflow/core/dist/index.css";
|
||||
|
||||
createApp(App)
|
||||
.use(ElementPlus)
|
||||
.mount('#app')
|
70
src/style.css
Normal file
70
src/style.css
Normal file
@ -0,0 +1,70 @@
|
||||
:root {
|
||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
/*display: flex;*/
|
||||
/*place-items: center;*/
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/*button {*/
|
||||
/* border-radius: 8px;*/
|
||||
/* border: 1px solid transparent;*/
|
||||
/* padding: 0.6em 1.2em;*/
|
||||
/* font-size: 1em;*/
|
||||
/* font-weight: 500;*/
|
||||
/* font-family: inherit;*/
|
||||
/* background-color: #1a1a1a;*/
|
||||
/* cursor: pointer;*/
|
||||
/* transition: border-color 0.25s;*/
|
||||
/*}*/
|
||||
/*button:hover {*/
|
||||
/* border-color: #646cff;*/
|
||||
/*}*/
|
||||
/*button:focus,*/
|
||||
/*button:focus-visible {*/
|
||||
/* outline: 4px auto -webkit-focus-ring-color;*/
|
||||
/*}*/
|
||||
|
||||
#app {
|
||||
/*max-width: 1280px;*/
|
||||
margin: 0 auto;
|
||||
padding: 1rem;
|
||||
/*text-align: center;*/
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.custom-clear-page {
|
||||
background-image: url("public/clear.svg");
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
7
vite.config.js
Normal file
7
vite.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
})
|
Loading…
Reference in New Issue
Block a user