diff --git a/package.json b/package.json index 105d24198ce3b44c1d20c3f5ce697e0c6aace509..6d62756fd603568553a6dd7117d2ed796f449557 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,8 @@ }, "dependencies": { "@iconify/iconify": "^2.0.0-rc.6", + "@logicflow/core": "^0.3.0", + "@logicflow/extension": "^0.3.0", "@vueuse/core": "^4.8.1", "@zxcvbn-ts/core": "^0.3.0", "ant-design-vue": "^2.1.2", @@ -52,6 +54,7 @@ "vditor": "^3.8.4", "vue": "3.0.11", "vue-i18n": "9.0.0", + "vue-json-pretty": "^2.0.2", "vue-router": "^4.0.6", "vue-types": "^3.0.2", "xlsx": "^0.16.9" diff --git a/src/components/FlowChart/index.ts b/src/components/FlowChart/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..61f1cb6b4a1a07095029ca27f7326c320251c782 --- /dev/null +++ b/src/components/FlowChart/index.ts @@ -0,0 +1,22 @@ +import { App } from 'vue'; +import control from './src/Control.vue'; +import nodePanel from './src/NodePanel.vue'; +import dataDialog from './src/DataDialog.vue'; + +export const Control = Object.assign(control, { + install(app: App) { + app.component(control.name, control); + }, +}); + +export const NodePanel = Object.assign(nodePanel, { + install(app: App) { + app.component(nodePanel.name, nodePanel); + }, +}); + +export const DataDialog = Object.assign(dataDialog, { + install(app: App) { + app.component(dataDialog.name, dataDialog); + }, +}); diff --git a/src/components/FlowChart/src/Control.vue b/src/components/FlowChart/src/Control.vue new file mode 100644 index 0000000000000000000000000000000000000000..a908431550c209d494d0a0059b9d0856903f482b --- /dev/null +++ b/src/components/FlowChart/src/Control.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/components/FlowChart/src/DataDialog.vue b/src/components/FlowChart/src/DataDialog.vue new file mode 100644 index 0000000000000000000000000000000000000000..a8272e3f68ca01f62eb857f6092da53307a815c8 --- /dev/null +++ b/src/components/FlowChart/src/DataDialog.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/components/FlowChart/src/NodePanel.vue b/src/components/FlowChart/src/NodePanel.vue new file mode 100644 index 0000000000000000000000000000000000000000..2945b7b48485399d3be712e80763353da325054c --- /dev/null +++ b/src/components/FlowChart/src/NodePanel.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/src/components/FlowChart/src/adpterForTurbo.ts b/src/components/FlowChart/src/adpterForTurbo.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c0e0411dbe42acf14fce9dd0cca4d6a9eb35988 --- /dev/null +++ b/src/components/FlowChart/src/adpterForTurbo.ts @@ -0,0 +1,160 @@ +const TurboType = { + SEQUENCE_FLOW: 1, + START_EVENT: 2, + END_EVENT: 3, + USER_TASK: 4, + SERVICE_TASK: 5, + EXCLUSIVE_GATEWAY: 6, +}; + +function getTurboType(type) { + switch (type) { + case 'bpmn:sequenceFlow': + return TurboType.SEQUENCE_FLOW; + case 'bpmn:startEvent': + return TurboType.START_EVENT; + case 'bpmn:endEvent': + return TurboType.END_EVENT; + case 'bpmn:userTask': + return TurboType.USER_TASK; + case 'bpmn:serviceTask': + return TurboType.SERVICE_TASK; + case 'bpmn:exclusiveGateway': + return TurboType.EXCLUSIVE_GATEWAY; + default: + return type; + } +} + +function convertNodeToTurboElement(node) { + const { id, type, x, y, text = '', properties } = node; + return { + incoming: [], + outgoing: [], + dockers: [], + type: getTurboType(node.type), + properties: { + ...properties, + name: (text && text.value) || '', + x: x, + y: y, + text, + logicFlowType: type, + }, + key: id, + }; +} + +function convertEdgeToTurboElement(edge) { + const { + id, + type, + sourceNodeId, + targetNodeId, + startPoint, + endPoint, + pointsList, + text = '', + properties, + } = edge; + return { + incoming: [sourceNodeId], + outgoing: [targetNodeId], + type: getTurboType(type), + dockers: [], + properties: { + ...properties, + name: (text && text.value) || '', + text, + startPoint, + endPoint, + pointsList, + logicFlowType: type, + }, + key: id, + }; +} + +export function toTurboData(data) { + const nodeMap = new Map(); + const turboData = { + flowElementList: [], + }; + data.nodes.forEach((node) => { + const flowElement = convertNodeToTurboElement(node); + turboData.flowElementList.push(flowElement); + nodeMap.set(node.id, flowElement); + }); + data.edges.forEach((edge) => { + const flowElement = convertEdgeToTurboElement(edge); + const sourceElement = nodeMap.get(edge.sourceNodeId); + sourceElement.outgoing.push(flowElement.key); + const targetElement = nodeMap.get(edge.targetNodeId); + targetElement.incoming.push(flowElement.key); + turboData.flowElementList.push(flowElement); + }); + return turboData; +} + +function convertFlowElementToEdge(element) { + const { incoming, outgoing, properties, key } = element; + const { text, startPoint, endPoint, pointsList, logicFlowType } = properties; + const edge = { + id: key, + type: logicFlowType, + sourceNodeId: incoming[0], + targetNodeId: outgoing[0], + text, + startPoint, + endPoint, + pointsList, + properties: {}, + }; + const excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text', 'logicFlowType']; + Object.keys(element.properties).forEach((property) => { + if (excludeProperties.indexOf(property) === -1) { + edge.properties[property] = element.properties[property]; + } + }); + return edge; +} + +function convertFlowElementToNode(element) { + const { properties, key } = element; + const { x, y, text, logicFlowType } = properties; + const node = { + id: key, + type: logicFlowType, + x, + y, + text, + properties: {}, + }; + const excludeProperties = ['x', 'y', 'text', 'logicFlowType']; + Object.keys(element.properties).forEach((property) => { + if (excludeProperties.indexOf(property) === -1) { + node.properties[property] = element.properties[property]; + } + }); + return node; +} + +export function toLogicflowData(data) { + const lfData = { + nodes: [], + edges: [], + }; + const list = data.flowElementList; + list && + list.length > 0 && + list.forEach((element) => { + if (element.type === TurboType.SEQUENCE_FLOW) { + const edge = convertFlowElementToEdge(element); + lfData.edges.push(edge); + } else { + const node = convertFlowElementToNode(element); + lfData.nodes.push(node); + } + }); + return lfData; +} diff --git a/src/components/FlowChart/src/assets/background/bpmn-end.png b/src/components/FlowChart/src/assets/background/bpmn-end.png new file mode 100644 index 0000000000000000000000000000000000000000..2263e16c788f7ea4b2e981aa9c6eb85163acbd6c Binary files /dev/null and b/src/components/FlowChart/src/assets/background/bpmn-end.png differ diff --git a/src/components/FlowChart/src/assets/background/bpmn-exclusiveGateway.png b/src/components/FlowChart/src/assets/background/bpmn-exclusiveGateway.png new file mode 100644 index 0000000000000000000000000000000000000000..e771da1998b1c7344cc81c6b49a6949f8cf06099 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/bpmn-exclusiveGateway.png differ diff --git a/src/components/FlowChart/src/assets/background/bpmn-start.png b/src/components/FlowChart/src/assets/background/bpmn-start.png new file mode 100644 index 0000000000000000000000000000000000000000..d6da20bec6cacc0c9a7163e663c73601cdd6187d Binary files /dev/null and b/src/components/FlowChart/src/assets/background/bpmn-start.png differ diff --git a/src/components/FlowChart/src/assets/background/bpmn-user.png b/src/components/FlowChart/src/assets/background/bpmn-user.png new file mode 100644 index 0000000000000000000000000000000000000000..4d8b2ab2d5d954c74c90440b95d439891f16c398 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/bpmn-user.png differ diff --git a/src/components/FlowChart/src/assets/background/click.png b/src/components/FlowChart/src/assets/background/click.png new file mode 100644 index 0000000000000000000000000000000000000000..9679fb5e798a9d1f8ca0882d5005fb1f427f5078 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/click.png differ diff --git a/src/components/FlowChart/src/assets/background/download.png b/src/components/FlowChart/src/assets/background/download.png new file mode 100644 index 0000000000000000000000000000000000000000..d28cf951e5b623c31a351b80e5004a7db9e86295 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/download.png differ diff --git a/src/components/FlowChart/src/assets/background/end.png b/src/components/FlowChart/src/assets/background/end.png new file mode 100644 index 0000000000000000000000000000000000000000..09899692f9ff4fb4bcd61d4d8ca7c9e0adc5ed8a Binary files /dev/null and b/src/components/FlowChart/src/assets/background/end.png differ diff --git a/src/components/FlowChart/src/assets/background/push.png b/src/components/FlowChart/src/assets/background/push.png new file mode 100644 index 0000000000000000000000000000000000000000..be493f4d12a25039a26f37682c6ab5199cf61044 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/push.png differ diff --git a/src/components/FlowChart/src/assets/background/start.png b/src/components/FlowChart/src/assets/background/start.png new file mode 100644 index 0000000000000000000000000000000000000000..b1c3a5014f40ee0d63deead370faa7f3d965745a Binary files /dev/null and b/src/components/FlowChart/src/assets/background/start.png differ diff --git a/src/components/FlowChart/src/assets/background/time.png b/src/components/FlowChart/src/assets/background/time.png new file mode 100644 index 0000000000000000000000000000000000000000..a883504398e7b3de251d5d92bad4233a7f19b554 Binary files /dev/null and b/src/components/FlowChart/src/assets/background/time.png differ diff --git a/src/components/FlowChart/src/assets/background/user.png b/src/components/FlowChart/src/assets/background/user.png new file mode 100644 index 0000000000000000000000000000000000000000..061b8efbc7e54550de51637817e493a2e70d74eb Binary files /dev/null and b/src/components/FlowChart/src/assets/background/user.png differ diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.css b/src/components/FlowChart/src/assets/iconfont/iconfont.css new file mode 100644 index 0000000000000000000000000000000000000000..3fb1441003e0ebf8aa69e4dcd03b558512dae95a --- /dev/null +++ b/src/components/FlowChart/src/assets/iconfont/iconfont.css @@ -0,0 +1,48 @@ +@font-face { + font-family: 'iconfont'; + src: url('iconfont.eot?t=1618544337340'); /* IE9 */ + src: url('iconfont.eot?t=1618544337340#iefix') format('embedded-opentype'), + /* IE6-IE8 */ + url('data:application/x-font-woff2;charset=utf-8;base64,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') + format('woff2'), + url('iconfont.woff?t=1618544337340') format('woff'), + url('iconfont.ttf?t=1618544337340') format('truetype'), + /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ + url('iconfont.svg?t=1618544337340#iconfont') format('svg'); /* iOS 4.1- */ +} + +.iconfont { + font-family: 'iconfont' !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-full-screen-hs:before { + content: '\e656'; +} + +.icon-watch-hs:before { + content: '\e766'; +} + +.icon-download-hs:before { + content: '\e6af'; +} + +.icon-enlarge-hs:before { + content: '\e765'; +} + +.icon-previous-hs:before { + content: '\e84c'; +} + +.icon-zoom-out-hs:before { + content: '\e744'; +} + +.icon-next-step-hs:before { + content: '\e84b'; +} diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.eot b/src/components/FlowChart/src/assets/iconfont/iconfont.eot new file mode 100644 index 0000000000000000000000000000000000000000..c77503fb24dace951637bda878f4ddb30d4d8881 Binary files /dev/null and b/src/components/FlowChart/src/assets/iconfont/iconfont.eot differ diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.js b/src/components/FlowChart/src/assets/iconfont/iconfont.js new file mode 100644 index 0000000000000000000000000000000000000000..267df38284240f9fbc1d8f7351906c82ea189529 --- /dev/null +++ b/src/components/FlowChart/src/assets/iconfont/iconfont.js @@ -0,0 +1,61 @@ +!(function (c) { + var t, + e, + o, + a, + n, + l, + i = + '', + s = (s = document.getElementsByTagName('script'))[s.length - 1].getAttribute('data-injectcss'); + if (s && !c.__iconfont__svg__cssinject__) { + c.__iconfont__svg__cssinject__ = !0; + try { + document.write( + '' + ); + } catch (c) { + console && console.log(c); + } + } + function h() { + n || ((n = !0), o()); + } + (t = function () { + var c, t, e, o; + ((o = document.createElement('div')).innerHTML = i), + (i = null), + (e = o.getElementsByTagName('svg')[0]) && + (e.setAttribute('aria-hidden', 'true'), + (e.style.position = 'absolute'), + (e.style.width = 0), + (e.style.height = 0), + (e.style.overflow = 'hidden'), + (c = e), + (t = document.body).firstChild + ? ((o = c), (e = t.firstChild).parentNode.insertBefore(o, e)) + : t.appendChild(c)); + }), + document.addEventListener + ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) + ? setTimeout(t, 0) + : ((e = function () { + document.removeEventListener('DOMContentLoaded', e, !1), t(); + }), + document.addEventListener('DOMContentLoaded', e, !1)) + : document.attachEvent && + ((o = t), + (a = c.document), + (n = !1), + (l = function () { + try { + a.documentElement.doScroll('left'); + } catch (c) { + return void setTimeout(l, 50); + } + h(); + })(), + (a.onreadystatechange = function () { + 'complete' == a.readyState && ((a.onreadystatechange = null), h()); + })); +})(window); diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.json b/src/components/FlowChart/src/assets/iconfont/iconfont.json new file mode 100644 index 0000000000000000000000000000000000000000..6f91abb60af67691eb5026ed10af02a8af4e8196 --- /dev/null +++ b/src/components/FlowChart/src/assets/iconfont/iconfont.json @@ -0,0 +1,58 @@ +{ + "id": "2491438", + "name": "liu'c'tu", + "font_family": "iconfont", + "css_prefix_text": "icon-", + "description": "", + "glyphs": [ + { + "icon_id": "755619", + "name": "自适应图标", + "font_class": "full-screen-hs", + "unicode": "e656", + "unicode_decimal": 58966 + }, + { + "icon_id": "14445801", + "name": "查看", + "font_class": "watch-hs", + "unicode": "e766", + "unicode_decimal": 59238 + }, + { + "icon_id": "9712640", + "name": "下载", + "font_class": "download-hs", + "unicode": "e6af", + "unicode_decimal": 59055 + }, + { + "icon_id": "1029099", + "name": "放大", + "font_class": "enlarge-hs", + "unicode": "e765", + "unicode_decimal": 59237 + }, + { + "icon_id": "20017362", + "name": "上一步", + "font_class": "previous-hs", + "unicode": "e84c", + "unicode_decimal": 59468 + }, + { + "icon_id": "1010015", + "name": "缩小", + "font_class": "zoom-out-hs", + "unicode": "e744", + "unicode_decimal": 59204 + }, + { + "icon_id": "20017363", + "name": "下一步", + "font_class": "next-step-hs", + "unicode": "e84b", + "unicode_decimal": 59467 + } + ] +} diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.svg b/src/components/FlowChart/src/assets/iconfont/iconfont.svg new file mode 100644 index 0000000000000000000000000000000000000000..657d7c73fd37f766f7ffdf891841a5642e9b6fea --- /dev/null +++ b/src/components/FlowChart/src/assets/iconfont/iconfont.svg @@ -0,0 +1,47 @@ + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.ttf b/src/components/FlowChart/src/assets/iconfont/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b332ae7da76f676ca4423391844bbe32f343007b Binary files /dev/null and b/src/components/FlowChart/src/assets/iconfont/iconfont.ttf differ diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.woff b/src/components/FlowChart/src/assets/iconfont/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..0743a93816f708988df8c4ff487921c4c29b1957 Binary files /dev/null and b/src/components/FlowChart/src/assets/iconfont/iconfont.woff differ diff --git a/src/components/FlowChart/src/assets/iconfont/iconfont.woff2 b/src/components/FlowChart/src/assets/iconfont/iconfont.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..98f6f354f9fd069b238834f62a926305d6d5feba Binary files /dev/null and b/src/components/FlowChart/src/assets/iconfont/iconfont.woff2 differ diff --git a/src/components/FlowChart/src/config.ts b/src/components/FlowChart/src/config.ts new file mode 100644 index 0000000000000000000000000000000000000000..d98bf3f5d4c0111da2419ef21e9f840cd19a0035 --- /dev/null +++ b/src/components/FlowChart/src/config.ts @@ -0,0 +1,55 @@ +export const nodeList = [ + { + text: '开始', + type: 'start', + class: 'node-start', + }, + { + text: '矩形', + type: 'rect', + class: 'node-rect', + }, + { + type: 'user', + text: '用户', + class: 'node-user', + }, + { + type: 'push', + text: '推送', + class: 'node-push', + }, + { + type: 'download', + text: '位置', + class: 'node-download', + }, + { + type: 'end', + text: '结束', + class: 'node-end', + }, +]; + +export const BpmnNode = [ + { + type: 'bpmn:startEvent', + text: '开始', + class: 'bpmn-start', + }, + { + type: 'bpmn:endEvent', + text: '结束', + class: 'bpmn-end', + }, + { + type: 'bpmn:exclusiveGateway', + text: '网关', + class: 'bpmn-exclusiveGateway', + }, + { + type: 'bpmn:userTask', + text: '用户', + class: 'bpmn-user', + }, +]; diff --git a/src/locales/lang/en/routes/demo/comp.ts b/src/locales/lang/en/routes/demo/comp.ts index c68ea5cd94355c6a07174acc68d70795852003c6..11bbfc8e996204f6424993356d509ca88f3e0ef6 100644 --- a/src/locales/lang/en/routes/demo/comp.ts +++ b/src/locales/lang/en/routes/demo/comp.ts @@ -35,4 +35,5 @@ export default { time: 'Relative Time', cropperImage: 'Cropper Image', + flowChart: 'Flow Chart', }; diff --git a/src/locales/lang/zh_CN/routes/demo/comp.ts b/src/locales/lang/zh_CN/routes/demo/comp.ts index 2bd3614a1bbfce4af9dc765321a65ea3a274216d..291c8c4159136f32525c53e5d662e86df922ad9e 100644 --- a/src/locales/lang/zh_CN/routes/demo/comp.ts +++ b/src/locales/lang/zh_CN/routes/demo/comp.ts @@ -34,4 +34,5 @@ export default { time: '相对时间', cropperImage: '图片裁剪', + flowChart: '流程图', }; diff --git a/src/router/menus/modules/demo/comp.ts b/src/router/menus/modules/demo/comp.ts index 15e91f434b2a1c62c85669c60a9015503fb8f0a8..c9909ea60e71da925de85f614fb69d542d50fe89 100644 --- a/src/router/menus/modules/demo/comp.ts +++ b/src/router/menus/modules/demo/comp.ts @@ -123,6 +123,13 @@ const menu: MenuModule = { content: 'new', }, }, + { + path: 'flowChart', + name: t('routes.demo.comp.flowChart'), + tag: { + content: 'new', + }, + }, { path: 'countTo', name: t('routes.demo.comp.countTo'), diff --git a/src/router/routes/modules/demo/comp.ts b/src/router/routes/modules/demo/comp.ts index c6597ab667c5ad7ddbe0f385fc6a7735a013aeef..47c70eaaaae52b7a4f86e7aa1b13a9bbe6aa5399 100644 --- a/src/router/routes/modules/demo/comp.ts +++ b/src/router/routes/modules/demo/comp.ts @@ -240,6 +240,14 @@ const comp: AppRouteModule = { title: t('routes.demo.comp.cropperImage'), }, }, + { + path: 'flowChart', + name: 'flowChartDemo', + component: () => import('/@/views/demo/comp/flow-chart/index.vue'), + meta: { + title: t('routes.demo.comp.flowChart'), + }, + }, { path: 'timestamp', name: 'TimeDemo', diff --git a/src/views/demo/comp/flow-chart/dataTurbo.json b/src/views/demo/comp/flow-chart/dataTurbo.json new file mode 100644 index 0000000000000000000000000000000000000000..f6432c4e08cb1b9fca22eb9e523a0d6fd1ee25b0 --- /dev/null +++ b/src/views/demo/comp/flow-chart/dataTurbo.json @@ -0,0 +1,240 @@ +{ + "flowElementList": [ + { + "incoming": [], + "outgoing": ["Flow_33inf2k"], + "dockers": [], + "type": 2, + "properties": { + "a": "efrwe", + "b": "wewe", + "name": "开始", + "x": 280, + "y": 200, + "text": { + "x": 280, + "y": 200, + "value": "开始" + }, + "logicFlowType": "bpmn:startEvent" + }, + "key": "Event_1d42u4p" + }, + { + "incoming": ["Flow_379e0o9"], + "outgoing": [], + "dockers": [], + "type": 3, + "properties": { + "a": "efrwe", + "b": "wewe", + "name": "结束", + "x": 920, + "y": 200, + "text": { + "x": 920, + "y": 200, + "value": "结束" + }, + "logicFlowType": "bpmn:endEvent" + }, + "key": "Event_08p8i6q" + }, + { + "incoming": ["Flow_0pfouf0"], + "outgoing": ["Flow_3918lhh"], + "dockers": [], + "type": 6, + "properties": { + "a": "efrwe", + "b": "wewe", + "name": "网关", + "x": 580, + "y": 200, + "text": { + "x": 580, + "y": 200, + "value": "网关" + }, + "logicFlowType": "bpmn:exclusiveGateway" + }, + "key": "Gateway_1fngqgj" + }, + { + "incoming": ["Flow_33inf2k"], + "outgoing": ["Flow_0pfouf0"], + "dockers": [], + "type": 4, + "properties": { + "a": "efrwe", + "b": "wewe", + "name": "用户", + "x": 420, + "y": 200, + "text": { + "x": 420, + "y": 200, + "value": "用户" + }, + "logicFlowType": "bpmn:userTask" + }, + "key": "Activity_2mgtaia" + }, + { + "incoming": ["Flow_3918lhh"], + "outgoing": ["Flow_379e0o9"], + "dockers": [], + "type": 5, + "properties": { + "a": "efrwe", + "b": "wewe", + "name": "服务", + "x": 760, + "y": 200, + "text": { + "x": 760, + "y": 200, + "value": "服务" + }, + "logicFlowType": "bpmn:serviceTask" + }, + "key": "Activity_1sp8qc8" + }, + { + "incoming": ["Event_1d42u4p"], + "outgoing": ["Activity_2mgtaia"], + "type": 1, + "dockers": [], + "properties": { + "name": "边", + "text": { + "x": 331, + "y": 200, + "value": "边" + }, + "startPoint": { + "x": 298, + "y": 200 + }, + "endPoint": { + "x": 370, + "y": 200 + }, + "pointsList": [ + { + "x": 298, + "y": 200 + }, + { + "x": 370, + "y": 200 + } + ], + "logicFlowType": "bpmn:sequenceFlow" + }, + "key": "Flow_33inf2k" + }, + { + "incoming": ["Activity_2mgtaia"], + "outgoing": ["Gateway_1fngqgj"], + "type": 1, + "dockers": [], + "properties": { + "name": "边2", + "text": { + "x": 507, + "y": 200, + "value": "边2" + }, + "startPoint": { + "x": 470, + "y": 200 + }, + "endPoint": { + "x": 555, + "y": 200 + }, + "pointsList": [ + { + "x": 470, + "y": 200 + }, + { + "x": 555, + "y": 200 + } + ], + "logicFlowType": "bpmn:sequenceFlow" + }, + "key": "Flow_0pfouf0" + }, + { + "incoming": ["Gateway_1fngqgj"], + "outgoing": ["Activity_1sp8qc8"], + "type": 1, + "dockers": [], + "properties": { + "name": "边3", + "text": { + "x": 664, + "y": 200, + "value": "边3" + }, + "startPoint": { + "x": 605, + "y": 200 + }, + "endPoint": { + "x": 710, + "y": 200 + }, + "pointsList": [ + { + "x": 605, + "y": 200 + }, + { + "x": 710, + "y": 200 + } + ], + "logicFlowType": "bpmn:sequenceFlow" + }, + "key": "Flow_3918lhh" + }, + { + "incoming": ["Activity_1sp8qc8"], + "outgoing": ["Event_08p8i6q"], + "type": 1, + "dockers": [], + "properties": { + "name": "边4", + "text": { + "x": 871, + "y": 200, + "value": "边4" + }, + "startPoint": { + "x": 810, + "y": 200 + }, + "endPoint": { + "x": 902, + "y": 200 + }, + "pointsList": [ + { + "x": 810, + "y": 200 + }, + { + "x": 902, + "y": 200 + } + ], + "logicFlowType": "bpmn:sequenceFlow" + }, + "key": "Flow_379e0o9" + } + ] +} diff --git a/src/views/demo/comp/flow-chart/index.vue b/src/views/demo/comp/flow-chart/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..273d95d9fd20d6d4814f53aca09edc599d03a335 --- /dev/null +++ b/src/views/demo/comp/flow-chart/index.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/yarn.lock b/yarn.lock index 29004d1fcf6b1c9438a7c032e714eb7f90592502..96f956fc3be40cac15451b16b3c5bd9371fd92dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1151,6 +1151,19 @@ resolved "https://registry.npmjs.org/@intlify/shared/-/shared-9.0.0.tgz#d85b3b5f9033f377c5cf2202cf2459aa49948f36" integrity sha512-0r4v7dnY8g/Jfx2swUWy2GyfH/WvIpWvkU4OIupvxDTWiE8RhcpbOCVvqpVh/xGi0proHQ/r2Dhc0QSItUsfDQ== +"@logicflow/core@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@logicflow/core/-/core-0.3.0.tgz#910ca7865487fbe6c45a450d13627875c6965bf4" + integrity sha512-FPRTuj0y6Yny+YDZ+faTzA8pZyouEWX1Vr6rH91wJR0J3NOHgb7pV/TJoHSosavFuyyw87nLw9UsyUUgHKVV+A== + +"@logicflow/extension@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@logicflow/extension/-/extension-0.3.0.tgz#cea4470de3a8e4b7da69b17d7507b2d8edd76b50" + integrity sha512-vMmYT8H53oFhOpNftCYQMbNYbTiXqQUxOOKlPcrKkZb0FsXSiEZ/MUKBF3mAarvFlzdMaB5xJjakMfy07/bdvw== + dependencies: + "@logicflow/core" "^0.3.0" + ids "^1.0.0" + "@nodelib/fs.scandir@2.1.4": version "2.1.4" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69" @@ -4895,6 +4908,11 @@ icss-utils@^5.0.0: resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== +ids@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ids/-/ids-1.0.0.tgz#df67f2d37b81d7c2effc87e03d17ebff95a58c05" + integrity sha512-Zvtq1xUto4LttpstyOlFum8lKx+i1OmRfg+6A9drFS9iSZsDPMHG4Sof/qwNR4kCU7jBeWFPrY2ocHxiz7cCRw== + ieee754@^1.1.13: version "1.2.1" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -9284,6 +9302,11 @@ vue-i18n@9.0.0: "@intlify/shared" "9.0.0" "@vue/devtools-api" "^6.0.0-beta.5" +vue-json-pretty@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/vue-json-pretty/-/vue-json-pretty-2.0.2.tgz#cb8f559af15ea3a2ee53b2742672c7791826d6a3" + integrity sha512-Vn7SX3XR9cfvGRNoTDNID89GmvVUMb7/fLUX3C3n0Qptga0N7hp7Zwspui1I1XN5pE+PeoVghCSYty+bi8KnjA== + vue-router@^4.0.6: version "4.0.6" resolved "https://registry.npmjs.org/vue-router/-/vue-router-4.0.6.tgz#91750db507d26642f225b0ec6064568e5fe448d6"