lw-cdp-ui 1.2.47 → 1.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/assets/images/empty.jpg +0 -0
- package/dist/assets/images/login.svg +0 -558
- package/dist/assets/images/logo.jpg +0 -0
- package/dist/assets/images/logo.svg +0 -78
- package/dist/assets/images/logo1.svg +0 -86
- package/dist/assets/images/register.svg +0 -351
- package/dist/components/lwCronSelect/index.vue +0 -218
- package/dist/components/lwFlow/components/lfControl.vue +0 -126
- package/dist/components/lwFlow/components/lfNodePanel.vue +0 -98
- package/dist/components/lwFlow/config/dagre.js +0 -279
- package/dist/components/lwFlow/config/nodesList.js +0 -243
- package/dist/components/lwFlow/index.vue +0 -781
- package/dist/components/lwFlow/nodeEdit/audienceReceive.vue +0 -262
- package/dist/components/lwFlow/nodeEdit/basicSettings.vue +0 -88
- package/dist/components/lwFlow/nodeEdit/eventReceive.vue +0 -145
- package/dist/components/lwFlow/nodeEdit/index.vue +0 -306
- package/dist/components/lwFlow/nodeEdit/sms.vue +0 -107
- package/dist/components/lwFlow/nodeEdit/styleSettings.vue +0 -236
- package/dist/components/lwFlow/nodes/basisEnd.js +0 -56
- package/dist/components/lwFlow/nodes/basisStart.js +0 -56
- package/dist/components/lwFlow/nodes/custom.js +0 -129
- package/dist/components/lwFlow/nodes/et2lTable.js +0 -132
- package/dist/components/lwFlow/nodesData/datas/audienceReceive.js +0 -137
- package/dist/components/lwFlow/nodesData/datas/base.js +0 -190
- package/dist/components/lwFlow/nodesData/datas/collap.js +0 -95
- package/dist/components/lwFlow/nodesData/datas/eventReceive.js +0 -106
- package/dist/components/lwFlow/nodesData/datas/expand.js +0 -85
- package/dist/components/lwFlow/nodesData/datas/filter.js +0 -85
- package/dist/components/lwFlow/nodesData/datas/joiner.js +0 -96
- package/dist/components/lwFlow/nodesData/datas/mapper.js +0 -111
- package/dist/components/lwFlow/nodesData/datas/reduce.js +0 -69
- package/dist/components/lwFlow/nodesData/datas/sms.js +0 -69
- package/dist/components/lwFlow/nodesData/datas/source.js +0 -142
- package/dist/components/lwFlow/nodesData/datas/target.js +0 -95
- package/dist/components/lwFlow/nodesData/datas/timer.js +0 -180
- package/dist/components/lwFlow/nodesData/index.js +0 -41
- package/dist/components/lwForm/index.vue +0 -631
- package/dist/components/lwFormJson/JsonItem.vue +0 -302
- package/dist/components/lwFormJson/StatsConfig.vue +0 -544
- package/dist/components/lwFormJson/TreeItem.vue +0 -149
- package/dist/components/lwFormJson/index.vue +0 -362
- package/dist/components/lwFormJson/menuList.js +0 -324
- package/dist/components/lwFormMini/FormItem.vue +0 -466
- package/dist/components/lwFormMini/ViewItem.vue +0 -391
- package/dist/components/lwFormMini/index.vue +0 -421
- package/dist/components/lwFormMini/textToPassword.vue +0 -61
- package/dist/components/lwFormView/index.vue +0 -390
- package/dist/components/lwFormView/textToPassword.vue +0 -59
- package/dist/components/lwIconSelect/iconSelect.js +0 -289
- package/dist/components/lwIconSelect/index.vue +0 -142
- package/dist/components/lwLayout/components/NavMenu.vue +0 -36
- package/dist/components/lwLayout/components/aside.vue +0 -295
- package/dist/components/lwLayout/components/bu.vue +0 -88
- package/dist/components/lwLayout/components/iframeView.vue +0 -57
- package/dist/components/lwLayout/components/lang.vue +0 -77
- package/dist/components/lwLayout/components/setting.vue +0 -102
- package/dist/components/lwLayout/components/sideM.vue +0 -135
- package/dist/components/lwLayout/components/tags.vue +0 -388
- package/dist/components/lwLayout/components/topbar.vue +0 -69
- package/dist/components/lwLayout/components/userbar.vue +0 -214
- package/dist/components/lwLayout/index.vue +0 -460
- package/dist/components/lwLogin/index.vue +0 -506
- package/dist/components/lwLogin/locale/en-us.js +0 -37
- package/dist/components/lwLogin/locale/zh-cn.js +0 -37
- package/dist/components/lwSearch/date/date.vue +0 -113
- package/dist/components/lwSearch/dateRange/dateRange.vue +0 -118
- package/dist/components/lwSearch/dates/dates.vue +0 -366
- package/dist/components/lwSearch/index.vue +0 -628
- package/dist/components/lwSearch/input/input.vue +0 -55
- package/dist/components/lwSearch/locale/en-us.js +0 -15
- package/dist/components/lwSearch/locale/zh-cn.js +0 -15
- package/dist/components/lwSearch/select/select.vue +0 -58
- package/dist/components/lwSvgIcon/index.vue +0 -29
- package/dist/components/lwTable/index.js +0 -286
- package/dist/components/lwTable/index.scss +0 -238
- package/dist/components/lwTable/index.vue +0 -344
- package/dist/components/lwTable/locale/en-US.js +0 -26
- package/dist/components/lwTable/locale/zh-CN.js +0 -26
- package/dist/components/lwTable/useFullscreen.js +0 -73
- package/dist/components/lwTableForm/index.vue +0 -662
- package/dist/components/lwTableSelect/index.vue +0 -266
- package/dist/components/lwTableSelect/tableSelect.js +0 -23
- package/dist/components/lwUpload/index.vue +0 -564
- package/dist/lw-cdp-ui.esm.js +0 -19893
- package/dist/lw-cdp-ui.umd.js +0 -22
- package/dist/style.css +0 -1
- package/dist/vite.svg +0 -1
|
@@ -1,781 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="logic-flow">
|
|
3
|
-
<!-- 画布 -->
|
|
4
|
-
<div ref="container"
|
|
5
|
-
class="logic-flow-body"></div>
|
|
6
|
-
|
|
7
|
-
<!-- 工具栏 -->
|
|
8
|
-
<lfControl class="logic-flow-control"
|
|
9
|
-
v-if="logicFlow"
|
|
10
|
-
:lf="logicFlow" />
|
|
11
|
-
|
|
12
|
-
<template v-if="!isView">
|
|
13
|
-
<!-- 节点 -->
|
|
14
|
-
<lfNodePanel class="logic-flow-node"
|
|
15
|
-
v-if="logicFlow"
|
|
16
|
-
:lf="logicFlow"
|
|
17
|
-
:nodeList="nodeList" />
|
|
18
|
-
|
|
19
|
-
<!-- 属性编辑 -->
|
|
20
|
-
<nodeEdit :lf="logicFlow"
|
|
21
|
-
:drawerShow="drawerShow"
|
|
22
|
-
:nodeData="clickNode"
|
|
23
|
-
:nodesDataConfig="nodesDataConfig"
|
|
24
|
-
:soltList="soltList"
|
|
25
|
-
@onClose="nodeEditClose">
|
|
26
|
-
<template v-slot:[soltName]="{itemCur, formCur}"
|
|
27
|
-
v-for="soltName in soltList">
|
|
28
|
-
<slot :name="soltName"
|
|
29
|
-
:itemCur="itemCur"
|
|
30
|
-
:formCur="formCur">
|
|
31
|
-
<el-tag type="danger">[{{ soltName }}]
|
|
32
|
-
没有这个默认组件也未自定义插槽内容</el-tag>
|
|
33
|
-
</slot>
|
|
34
|
-
</template>
|
|
35
|
-
<template #mySolt>
|
|
36
|
-
sssssssssssssssss
|
|
37
|
-
</template>
|
|
38
|
-
</nodeEdit>
|
|
39
|
-
</template>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script>
|
|
44
|
-
import LogicFlow from '@logicflow/core'
|
|
45
|
-
import '@logicflow/core/dist/index.css';
|
|
46
|
-
import { Menu, MiniMap } from "@logicflow/extension";
|
|
47
|
-
import Dagre from './config/dagre'
|
|
48
|
-
import '@logicflow/extension/lib/style/index.css';
|
|
49
|
-
|
|
50
|
-
// 注册组件
|
|
51
|
-
import lfControl from './components/lfControl.vue'
|
|
52
|
-
import lfNodePanel from './components/lfNodePanel.vue'
|
|
53
|
-
|
|
54
|
-
// 自定义节点
|
|
55
|
-
import basisStart from './nodes/basisStart'
|
|
56
|
-
import basisEnd from './nodes/basisEnd'
|
|
57
|
-
import et2lTable from './nodes/et2lTable'
|
|
58
|
-
import nodeCustom from './nodes/custom'
|
|
59
|
-
|
|
60
|
-
// 节点编辑
|
|
61
|
-
import nodeEdit from './nodeEdit/index.vue'
|
|
62
|
-
|
|
63
|
-
// 参数配置
|
|
64
|
-
import configNodesList from './config/nodesList'
|
|
65
|
-
import nodeDatas from './nodesData/index.js'
|
|
66
|
-
export default {
|
|
67
|
-
components: {
|
|
68
|
-
lfControl,
|
|
69
|
-
lfNodePanel,
|
|
70
|
-
nodeEdit
|
|
71
|
-
},
|
|
72
|
-
props: {
|
|
73
|
-
/**
|
|
74
|
-
* 流程图的数据,包括节点和边的配置。
|
|
75
|
-
* - `nodes`:一个数组,包含流程图中的所有节点。每个节点都有唯一的`id`、类型(`type`)以及位置(`x`, `y`)。
|
|
76
|
-
* - `edges`:一个数组,描述了节点之间的连接关系。每条边都有类型(`type`)以及源节点(`sourceNodeId`)和目标节点(`targetNodeId`)的标识。
|
|
77
|
-
* - `nodes.properties` 节点数据配置
|
|
78
|
-
* - `nodes.properties.data` 节点自定义数据配置 默认: data: {name:'节点名称'}
|
|
79
|
-
* - `nodes.properties.style` 节点自定义样式,具体参数看\nodeEdit\basicSettings.vue
|
|
80
|
-
* @example
|
|
81
|
-
* ```javascript
|
|
82
|
-
* {
|
|
83
|
-
* nodes: [
|
|
84
|
-
* { id: '21', type: 'end', x: 100, y: 200, properties: { data: name: '结束' } },
|
|
85
|
-
* { id: '50', type: 'start', x: 300, y: 400 }
|
|
86
|
-
* ],
|
|
87
|
-
* edges: [
|
|
88
|
-
* { type: 'polyline', sourceNodeId: '50', targetNodeId: '21' }
|
|
89
|
-
* ]
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
modelValue: {
|
|
94
|
-
type: Object,
|
|
95
|
-
default: () => {
|
|
96
|
-
return {}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
// 节点数据 在没有 modelValue时 用以自动创建节点 默认使用modelValue
|
|
100
|
-
nodes: {
|
|
101
|
-
type: Array,
|
|
102
|
-
default: () => {
|
|
103
|
-
return []
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
// 节点插槽列表
|
|
107
|
-
soltList: {
|
|
108
|
-
type: Array,
|
|
109
|
-
default: () => {
|
|
110
|
-
return []
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
// 是否显示默认节点
|
|
114
|
-
showDefaultNode: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: true
|
|
117
|
-
},
|
|
118
|
-
// 是否仅查看
|
|
119
|
-
isView: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
default: false
|
|
122
|
-
},
|
|
123
|
-
// 需要展示的节点分组 不传默认展示所有内置节点
|
|
124
|
-
showNodeGroup: {
|
|
125
|
-
type: Array,
|
|
126
|
-
default: []
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* 节点数据配置
|
|
130
|
-
* 对应的就是nodeDatas目录下的数据结构
|
|
131
|
-
* source: { // 节点名
|
|
132
|
-
formConfig: { // 表单配置
|
|
133
|
-
formItems: [{ // 表单项配置,写你要覆盖的参数
|
|
134
|
-
name: 'from', // name 指定你要覆盖的名称
|
|
135
|
-
component: 'select',
|
|
136
|
-
options: {
|
|
137
|
-
items: [{ label: '订单', value: 'order' }, { label: '会员', value: 'member' }],
|
|
138
|
-
placeholder: '请输入节点名称'
|
|
139
|
-
},
|
|
140
|
-
}]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
*/
|
|
144
|
-
nodesDataConfig: {
|
|
145
|
-
type: Object,
|
|
146
|
-
default: {}
|
|
147
|
-
},
|
|
148
|
-
/**
|
|
149
|
-
* apiNodes - 接口返回的节点数组,用于与内容节点合并。
|
|
150
|
-
* @type {Array<Object>}
|
|
151
|
-
* @default []
|
|
152
|
-
* @property {string} name - 节点名称
|
|
153
|
-
* @property {string} category - 节点类别
|
|
154
|
-
* @property {number} index - 节点索引
|
|
155
|
-
* @property {number} groupIndex - 节点组索引
|
|
156
|
-
* @property {string} groupId - 节点组ID
|
|
157
|
-
* @property {string} groupName - 节点组名称
|
|
158
|
-
* @property {string} type - 节点类型
|
|
159
|
-
* @property {boolean} enabled - 节点是否启用
|
|
160
|
-
* @property {string} icon - 节点图标
|
|
161
|
-
* @property {string} themeColor - 节点主题颜色
|
|
162
|
-
* @property {string} background - 节点背景色
|
|
163
|
-
*/
|
|
164
|
-
apiNodes: {
|
|
165
|
-
type: Array,
|
|
166
|
-
default: []
|
|
167
|
-
},
|
|
168
|
-
/**
|
|
169
|
-
* 流程图初始化属性配置。
|
|
170
|
-
* @property {Object} grid - 网格配置对象,包含网格大小、是否显示、类型及详细配置。
|
|
171
|
-
* @property {HTMLElement} container - 图的DOM容器。
|
|
172
|
-
* @property {number} [width] - 画布宽度,默认使用容器宽度。
|
|
173
|
-
* @property {number} [height] - 画布高度,默认使用容器高度。
|
|
174
|
-
* @property {boolean|BackgroundConfig} [background=false] - 背景配置,默认无背景。
|
|
175
|
-
* @property {number|boolean|GridOptions} [grid=false] - 网格配置,false表示不开启网格。
|
|
176
|
-
* @property {boolean} [partial=false] - 是否开启局部渲染功能。
|
|
177
|
-
* @property {Keyboard.KeyboardDef} [keyboard] - 自定义键盘配置。
|
|
178
|
-
* @property {Partial<LogicFlow.Theme>} [style] - 样式配置。
|
|
179
|
-
* @property {EdgeType} [edgeType='polyline'] - 边的类型,默认为'polyline'。
|
|
180
|
-
* @property {boolean} [isSilentMode=false] - 是否仅浏览不可编辑模式。
|
|
181
|
-
* @property {boolean} [stopScrollGraph=false] - 是否禁止鼠标滚动移动画布。
|
|
182
|
-
* @property {boolean} [stopZoomGraph=false] - 是否禁止缩放画布。
|
|
183
|
-
* @property {boolean|string|[number, number, number, number]} [stopMoveGraph=false] - 是否禁止拖动画布。
|
|
184
|
-
* @property {boolean|Partial<AnimationConfig>} [animation] - 动画配置。
|
|
185
|
-
* @property {boolean} [history=true] - 是否开启历史记录功能。
|
|
186
|
-
* @property {string[]} [disabledPlugins] - 禁用加载的插件。
|
|
187
|
-
* @property {boolean} [snapline=true] - 是否启用节点辅助对齐线。
|
|
188
|
-
* @property {GuardsConfig} [guards] - 守卫函数配置。
|
|
189
|
-
* @property {string[]} [disabledTools] - 禁止启用的内置工具。
|
|
190
|
-
* @property {boolean} [adjustEdge=true] - 是否允许调整边。
|
|
191
|
-
* @property {boolean} [adjustEdgeStartAndEnd=false] - 是否允许拖动边的端点来调整连线。
|
|
192
|
-
* @property {boolean} [adjustNodePosition=true] - 是否允许拖动节点。
|
|
193
|
-
* @property {boolean} [hideAnchors=false] - 是否隐藏节点的锚点。
|
|
194
|
-
* @property {boolean} [outline=false] - 节点选择状态下外侧的选框是否展示。
|
|
195
|
-
* @property {boolean} [hoverOutline=true] - 鼠标hover时是否显示节点的外框。
|
|
196
|
-
* @property {boolean} [nodeSelectedOutline=true] - 节点被选中时是否显示节点的外框。
|
|
197
|
-
* @property {boolean} [edgeSelectedOutline=true] - 边被选中时是否显示边的外框。
|
|
198
|
-
* @property {boolean} [nodeTextEdit=true] - 允许节点文本编辑。
|
|
199
|
-
* @property {boolean} [edgeTextEdit=true] - 允许边文本编辑。
|
|
200
|
-
* @property {boolean} [textEdit=true] - 是否开启文本编辑。
|
|
201
|
-
* @property {boolean} [nodeTextDraggable=false] - 允许节点文本拖拽。
|
|
202
|
-
* @property {boolean} [edgeTextDraggable=false] - 允许边文本拖拽。
|
|
203
|
-
* @property {string} [multipleSelectKey] - 多选按键配置。
|
|
204
|
-
* @property {function} [idGenerator] - 自定义创建节点、连线时生成id规则。
|
|
205
|
-
* @property {EdgeGeneratorType} [edgeGenerator] - 连接节点及移动边时边的生成规则。
|
|
206
|
-
* @property {ExtensionConstructor[]} [plugins] - 加载的插件。
|
|
207
|
-
* @property {boolean} [autoExpand=true] - 节点拖动靠近画布边缘时是否自动扩充画布。
|
|
208
|
-
* @property {OverlapMode} [overlapMode] - 元素重合的堆叠模式。
|
|
209
|
-
* @property {function} [customTrajectory] - 自定义连线轨迹。
|
|
210
|
-
* @property {any} [pluginsOptions] - 插件初始化选项。
|
|
211
|
-
*/
|
|
212
|
-
options: {
|
|
213
|
-
type: Object,
|
|
214
|
-
default: () => {
|
|
215
|
-
return {
|
|
216
|
-
grid: {
|
|
217
|
-
size: 10,
|
|
218
|
-
visible: true,
|
|
219
|
-
type: 'mesh',
|
|
220
|
-
config: {
|
|
221
|
-
color: '#f0f0f0',
|
|
222
|
-
thickness: 0.5
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
watch: {
|
|
230
|
-
modelValue: {
|
|
231
|
-
handler(val, old) {
|
|
232
|
-
// 第一次初始化
|
|
233
|
-
if (!old && !this.logicFlow) {
|
|
234
|
-
this.init()
|
|
235
|
-
// this.logicFlow.renderRawData(val)
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
deep: true
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
data() {
|
|
242
|
-
return {
|
|
243
|
-
logicFlow: null,
|
|
244
|
-
drawerShow: false,
|
|
245
|
-
clickNode: null,
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
computed: {
|
|
249
|
-
nodeList() {
|
|
250
|
-
// 基础节点
|
|
251
|
-
let baseList = configNodesList
|
|
252
|
-
|
|
253
|
-
let list = {}
|
|
254
|
-
this.apiNodes.forEach(item => {
|
|
255
|
-
if (!list[item.groupName]) {
|
|
256
|
-
list[item.groupName] = {
|
|
257
|
-
title: item.groupName,
|
|
258
|
-
list: []
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
list[item.groupName].list.push(item)
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
if (this.showDefaultNode) {
|
|
265
|
-
baseList = [...baseList, ...Object.values(list)]
|
|
266
|
-
} else {
|
|
267
|
-
baseList = Object.values(list)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (this.showNodeGroup.length > 0) {
|
|
271
|
-
baseList = baseList.filter(item => {
|
|
272
|
-
return this.showNodeGroup.includes(item.title)
|
|
273
|
-
})
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return baseList
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
mounted() {
|
|
280
|
-
this.init()
|
|
281
|
-
},
|
|
282
|
-
methods: {
|
|
283
|
-
/**
|
|
284
|
-
* 初始化
|
|
285
|
-
* 传入数据初始化、右键菜单初始化
|
|
286
|
-
*/
|
|
287
|
-
async init() {
|
|
288
|
-
this.logicFlow = new LogicFlow({
|
|
289
|
-
container: this.$refs.container,
|
|
290
|
-
// 注册组件
|
|
291
|
-
plugins: [Menu, MiniMap, Dagre],
|
|
292
|
-
// 不可编辑
|
|
293
|
-
isSilentMode: this.isView,
|
|
294
|
-
hoverOutline: !this.isView,
|
|
295
|
-
nodeSelectedOutline: !this.isView,
|
|
296
|
-
edgeSelectedOutline: !this.isView,
|
|
297
|
-
...this.options
|
|
298
|
-
})
|
|
299
|
-
this.initMenu()
|
|
300
|
-
await this.initNode()
|
|
301
|
-
if (this.modelValue && this.modelValue?.nodes?.length > 0) {
|
|
302
|
-
this.logicFlow.render(this.modelValue)
|
|
303
|
-
} else {
|
|
304
|
-
// 根据节点数据初始化节点
|
|
305
|
-
this.initNodeData()
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
this.bindEvent()
|
|
309
|
-
// 内容移动到中心
|
|
310
|
-
this.logicFlow.translateCenter()
|
|
311
|
-
},
|
|
312
|
-
/**
|
|
313
|
-
* 根据node 初始化数据
|
|
314
|
-
*/
|
|
315
|
-
async initNodeData() {
|
|
316
|
-
function getUUID() {
|
|
317
|
-
return 'xxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
318
|
-
const r = (Math.random() * 16) | 0; // 生成 0-15 的随机数
|
|
319
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8; // 如果是 'x' 使用随机数,否则按规则生成
|
|
320
|
-
return v.toString(16); // 转换为16进制字符串
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function generateNode(data) {
|
|
324
|
-
return {
|
|
325
|
-
id: getUUID(),
|
|
326
|
-
type: data.type || "",
|
|
327
|
-
x: 0, // 可根据实际需要动态调整
|
|
328
|
-
y: 0, // 可根据实际需要动态调整
|
|
329
|
-
properties: {
|
|
330
|
-
data
|
|
331
|
-
},
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function generateEdge(sourceNode, targetNode) {
|
|
336
|
-
return {
|
|
337
|
-
id: getUUID(),
|
|
338
|
-
type: "polyline",
|
|
339
|
-
sourceNodeId: sourceNode.id,
|
|
340
|
-
targetNodeId: targetNode.id,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
const nodes = [];
|
|
344
|
-
const edges = [];
|
|
345
|
-
const nodeMap = {};
|
|
346
|
-
|
|
347
|
-
// 创建节点
|
|
348
|
-
this.nodes.forEach(item => {
|
|
349
|
-
const node = generateNode(item);
|
|
350
|
-
nodes.push(node);
|
|
351
|
-
nodeMap[item.into] = node;
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
// 创建边
|
|
355
|
-
this.nodes.forEach(item => {
|
|
356
|
-
let sourceKeys = Array.isArray(item.from)
|
|
357
|
-
? item.from.map(subItem => subItem.name) // 如果是数组,提取每个 name
|
|
358
|
-
: [item.from]; // 如果是字符串,直接作为 sourceKey
|
|
359
|
-
|
|
360
|
-
const targetKey = item.into;
|
|
361
|
-
|
|
362
|
-
sourceKeys.forEach(sourceKey => {
|
|
363
|
-
if (nodeMap[sourceKey] && nodeMap[targetKey]) {
|
|
364
|
-
edges.push(generateEdge(nodeMap[sourceKey], nodeMap[targetKey]));
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
this.logicFlow.renderRawData({
|
|
370
|
-
nodes,
|
|
371
|
-
edges
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
this.logicFlow.extension.dagre.layout({
|
|
375
|
-
nodesep: 60,
|
|
376
|
-
ranksep: 140,
|
|
377
|
-
})
|
|
378
|
-
|
|
379
|
-
},
|
|
380
|
-
/**
|
|
381
|
-
* 初始化右键菜单
|
|
382
|
-
*/
|
|
383
|
-
initMenu() {
|
|
384
|
-
let _this = this
|
|
385
|
-
this.logicFlow.extension.menu.setMenuConfig({
|
|
386
|
-
// 节点
|
|
387
|
-
nodeMenu: [
|
|
388
|
-
{
|
|
389
|
-
text: "删除",
|
|
390
|
-
callback(node) {
|
|
391
|
-
_this.logicFlow.deleteNode(node.id);
|
|
392
|
-
},
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
text: '编辑',
|
|
396
|
-
callback(node) {
|
|
397
|
-
_this.nodeEditOpen(node)
|
|
398
|
-
_this.$emit('edit', node)
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
text: "复制",
|
|
403
|
-
callback: (node) => {
|
|
404
|
-
this.logicFlow.cloneNode(node.id);
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
],
|
|
408
|
-
// 连线菜单
|
|
409
|
-
edgeMenu: [
|
|
410
|
-
{
|
|
411
|
-
text: "删除",
|
|
412
|
-
callback(edge) {
|
|
413
|
-
_this.logicFlow.deleteEdge(edge.id);
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
text: '编辑',
|
|
418
|
-
callback(edge) {
|
|
419
|
-
_this.nodeEditOpen(edge)
|
|
420
|
-
_this.$emit('edit', edge)
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
text: '直线',
|
|
425
|
-
callback(edge) {
|
|
426
|
-
// 切换边类型
|
|
427
|
-
_this.logicFlow.changeEdgeType(edge.id, "line")
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
text: '曲线',
|
|
432
|
-
callback(edge) {
|
|
433
|
-
// 切换边类型
|
|
434
|
-
_this.logicFlow.changeEdgeType(edge.id, "bezier")
|
|
435
|
-
},
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
text: '折线',
|
|
439
|
-
callback(edge) {
|
|
440
|
-
_this.logicFlow.changeEdgeType(edge.id, "polyline")
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
text: '开启动画',
|
|
445
|
-
callback(edge) {
|
|
446
|
-
_this.logicFlow.openEdgeAnimation(edge.id)
|
|
447
|
-
},
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
text: '关闭动画',
|
|
451
|
-
callback(edge) {
|
|
452
|
-
_this.logicFlow.closeEdgeAnimation(edge.id)
|
|
453
|
-
},
|
|
454
|
-
},
|
|
455
|
-
], // 全局右键菜单
|
|
456
|
-
graphMenu: []
|
|
457
|
-
});
|
|
458
|
-
},
|
|
459
|
-
/**
|
|
460
|
-
* 初始化节点
|
|
461
|
-
* 该函数用于初始化基础节点,包括开始节点(basisStart)和结束节点(basisEnd)。
|
|
462
|
-
* @param {Object} logicFlow - 逻辑流对象,用于操作节点。
|
|
463
|
-
*/
|
|
464
|
-
async initNode() {
|
|
465
|
-
for (const x of this.nodeList) {
|
|
466
|
-
for (const node of x.list) {
|
|
467
|
-
switch (node.type) {
|
|
468
|
-
case 'start':
|
|
469
|
-
await basisStart(this.logicFlow);
|
|
470
|
-
break;
|
|
471
|
-
case 'end':
|
|
472
|
-
await basisEnd(this.logicFlow);
|
|
473
|
-
break;
|
|
474
|
-
case 'source':
|
|
475
|
-
case 'mapper':
|
|
476
|
-
case 'joiner':
|
|
477
|
-
case 'target':
|
|
478
|
-
case 'filter':
|
|
479
|
-
case 'collap':
|
|
480
|
-
case 'expand':
|
|
481
|
-
case 'reduce':
|
|
482
|
-
await et2lTable(this.logicFlow, node);
|
|
483
|
-
break;
|
|
484
|
-
case 'event_receive':
|
|
485
|
-
await nodeCustom(this.logicFlow, node, this.$store.state);
|
|
486
|
-
break;
|
|
487
|
-
default:
|
|
488
|
-
await nodeCustom(this.logicFlow, node, this.$store.state);
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
/**
|
|
495
|
-
* 处理流程图数据 返回纯节点
|
|
496
|
-
*/
|
|
497
|
-
getNodes(nodes) {
|
|
498
|
-
let list = []
|
|
499
|
-
nodes.forEach((node) => {
|
|
500
|
-
list.push({ ...node.properties.data, type: node.type })
|
|
501
|
-
})
|
|
502
|
-
return list
|
|
503
|
-
},
|
|
504
|
-
/**
|
|
505
|
-
* 节点绑定事件
|
|
506
|
-
*/
|
|
507
|
-
bindEvent() {
|
|
508
|
-
this.logicFlow.on('node:dbclick', ({ data }) => {
|
|
509
|
-
this.nodeEditOpen(data)
|
|
510
|
-
})
|
|
511
|
-
this.logicFlow.on('edge:dbclick', ({ data }) => {
|
|
512
|
-
this.nodeEditOpen(data)
|
|
513
|
-
})
|
|
514
|
-
this.logicFlow.on('blank:click', () => {
|
|
515
|
-
this.drawerShow = false
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
// 数据变更监听
|
|
519
|
-
this.logicFlow.on('history:change', ({ data }) => {
|
|
520
|
-
let { undos } = data
|
|
521
|
-
// 返回所有历史数据
|
|
522
|
-
this.$emit('change', undos)
|
|
523
|
-
// 同步最后数据 原始流程数据
|
|
524
|
-
this.$emit('update:modelValue', undos[undos.length - 1])
|
|
525
|
-
|
|
526
|
-
// 处理后的nodes 数据
|
|
527
|
-
this.$emit("update:nodes", this.getNodes(undos[undos.length - 1].nodes, undos[undos.length - 1].edges))
|
|
528
|
-
})
|
|
529
|
-
|
|
530
|
-
// 错误提示
|
|
531
|
-
this.logicFlow.on('connection:not-allowed', (data) => {
|
|
532
|
-
this.$message({
|
|
533
|
-
type: 'error',
|
|
534
|
-
message: data.msg
|
|
535
|
-
})
|
|
536
|
-
})
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
this.changeEdge()
|
|
540
|
-
},
|
|
541
|
-
/**
|
|
542
|
-
* 改变连线时处理上下级节点数据
|
|
543
|
-
* 本扩展暂无使用 本意是直接提供接口说要的数据结构
|
|
544
|
-
* 但是存在触发限制(可能存在连线后用户有修改了数据导致关联指向数据不完整) 暂停开发
|
|
545
|
-
* 所以本组件只提供原始的流程图数据输出 结构数据开发人员自行处理
|
|
546
|
-
*/
|
|
547
|
-
changeEdge() {
|
|
548
|
-
this.logicFlow.on('edge:add', ({ data: edge }) => {
|
|
549
|
-
})
|
|
550
|
-
this.logicFlow.on('edge:delete', ({ data: edge }) => {
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
},
|
|
554
|
-
// 关闭属性抽屉
|
|
555
|
-
nodeEditClose() {
|
|
556
|
-
this.drawerShow = false
|
|
557
|
-
},
|
|
558
|
-
// 打开属性抽屉
|
|
559
|
-
nodeEditOpen(data) {
|
|
560
|
-
// 去除为空校验结果
|
|
561
|
-
delete data.properties.error
|
|
562
|
-
this.logicFlow.setProperties(data.id, {
|
|
563
|
-
error: false
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
this.clickNode = data
|
|
567
|
-
this.drawerShow = true
|
|
568
|
-
|
|
569
|
-
},
|
|
570
|
-
/**
|
|
571
|
-
* 节点必传字段校验
|
|
572
|
-
* 用于父组件校验使用
|
|
573
|
-
* @returns {Promise<boolean>} 验证是否通过 true 通过
|
|
574
|
-
*/
|
|
575
|
-
async validate() {
|
|
576
|
-
let { nodes } = this.logicFlow.getGraphData();
|
|
577
|
-
let errorNodes = {};
|
|
578
|
-
|
|
579
|
-
for (const node of nodes) {
|
|
580
|
-
let { formConfig } = nodeDatas[node.type];
|
|
581
|
-
let { formItems } = formConfig;
|
|
582
|
-
let { data } = node.properties;
|
|
583
|
-
|
|
584
|
-
if (formItems?.length > 0) {
|
|
585
|
-
for (const item of formItems) {
|
|
586
|
-
let value = data ? data[item?.name] : data;
|
|
587
|
-
let isHideHandle = false;
|
|
588
|
-
|
|
589
|
-
// 处理 hideHandle 字段逻辑
|
|
590
|
-
if (data && typeof item?.hideHandle === 'string') {
|
|
591
|
-
try {
|
|
592
|
-
const hideHandleFunc = new Function("data", `return ${item.hideHandle.replace(/\$/g, "data")}`);
|
|
593
|
-
isHideHandle = hideHandleFunc(data);
|
|
594
|
-
} catch (error) {
|
|
595
|
-
console.error('遇到错误时返回默认值:', error)
|
|
596
|
-
isHideHandle = false; // 遇到错误时默认值
|
|
597
|
-
}
|
|
598
|
-
} else if (data && typeof item?.hideHandle === 'boolean') {
|
|
599
|
-
isHideHandle = item.hideHandle;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// 校验规则,如果不符合则记录错误
|
|
603
|
-
if (!isHideHandle && item?.rules && (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0))) {
|
|
604
|
-
this.logicFlow.setProperties(node.id, {
|
|
605
|
-
data: data,
|
|
606
|
-
error: true,
|
|
607
|
-
});
|
|
608
|
-
errorNodes[node.id] = true;
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
// 如果节点没有错误,清除错误状态
|
|
615
|
-
if (!errorNodes[node.id]) {
|
|
616
|
-
this.logicFlow.setProperties(node.id, {
|
|
617
|
-
data: data,
|
|
618
|
-
error: false,
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return Object.keys(errorNodes).length === 0;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
},
|
|
626
|
-
}
|
|
627
|
-
</script>
|
|
628
|
-
|
|
629
|
-
<style lang="scss" scoped>
|
|
630
|
-
.logic-flow {
|
|
631
|
-
width: 100%;
|
|
632
|
-
height: calc(100% - 3px);
|
|
633
|
-
position: relative;
|
|
634
|
-
user-select: none;
|
|
635
|
-
.logic-flow-body {
|
|
636
|
-
width: 100%;
|
|
637
|
-
height: 100%;
|
|
638
|
-
}
|
|
639
|
-
.logic-flow-control {
|
|
640
|
-
position: absolute;
|
|
641
|
-
top: 10px;
|
|
642
|
-
right: 10px;
|
|
643
|
-
z-index: 88;
|
|
644
|
-
}
|
|
645
|
-
:deep(.lf-menu) {
|
|
646
|
-
width: 85px;
|
|
647
|
-
border-radius: var(--el-popover-border-radius);
|
|
648
|
-
padding: var(--el-popover-padding);
|
|
649
|
-
z-index: var(--el-index-popper);
|
|
650
|
-
color: var(--el-text-color-regular);
|
|
651
|
-
line-height: 20px;
|
|
652
|
-
font-size: var(--el-popover-font-size);
|
|
653
|
-
box-shadow: var(--el-box-shadow-light);
|
|
654
|
-
overflow-wrap: break-word;
|
|
655
|
-
box-sizing: border-box;
|
|
656
|
-
background: var(--el-bg-color-overlay);
|
|
657
|
-
border: 1px solid var(--el-border-color-light);
|
|
658
|
-
position: relative;
|
|
659
|
-
&::before {
|
|
660
|
-
content: "";
|
|
661
|
-
border: 1px solid var(--el-border-color-light);
|
|
662
|
-
background: var(--el-bg-color-overlay);
|
|
663
|
-
right: 0;
|
|
664
|
-
border-bottom-left-radius: 2px;
|
|
665
|
-
border-right-color: transparent !important;
|
|
666
|
-
border-top-color: transparent !important;
|
|
667
|
-
transform: rotate(45deg);
|
|
668
|
-
box-sizing: border-box;
|
|
669
|
-
position: absolute;
|
|
670
|
-
width: 10px;
|
|
671
|
-
height: 10px;
|
|
672
|
-
top: 5px;
|
|
673
|
-
left: -5px;
|
|
674
|
-
}
|
|
675
|
-
& > li {
|
|
676
|
-
line-height: 24px;
|
|
677
|
-
letter-spacing: 2px;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
// 开始节点样式
|
|
682
|
-
:deep(.lw-flow-node-start) {
|
|
683
|
-
width: 100%;
|
|
684
|
-
height: 100%;
|
|
685
|
-
border: 2px solid #39bcc5;
|
|
686
|
-
border-radius: 100px;
|
|
687
|
-
font-size: 14px;
|
|
688
|
-
color: #39bcc5;
|
|
689
|
-
display: flex;
|
|
690
|
-
align-items: center;
|
|
691
|
-
justify-content: center;
|
|
692
|
-
}
|
|
693
|
-
// 结束节点样式
|
|
694
|
-
:deep(.lw-flow-node-end) {
|
|
695
|
-
width: 100%;
|
|
696
|
-
height: 100%;
|
|
697
|
-
border: 2px solid #e64210;
|
|
698
|
-
border-radius: 100px;
|
|
699
|
-
font-size: 14px;
|
|
700
|
-
color: #e64210;
|
|
701
|
-
display: flex;
|
|
702
|
-
align-items: center;
|
|
703
|
-
justify-content: center;
|
|
704
|
-
}
|
|
705
|
-
// et2l节点样式
|
|
706
|
-
:deep(.lw-flow-node-et2l) {
|
|
707
|
-
width: 100%;
|
|
708
|
-
height: 100%;
|
|
709
|
-
color: #ffffff;
|
|
710
|
-
line-height: 20px;
|
|
711
|
-
font-size: 12px;
|
|
712
|
-
display: flex;
|
|
713
|
-
justify-content: left;
|
|
714
|
-
align-items: center;
|
|
715
|
-
gap: 10px;
|
|
716
|
-
padding: 0 0 0 10px;
|
|
717
|
-
position: relative;
|
|
718
|
-
i {
|
|
719
|
-
font-size: 20px;
|
|
720
|
-
}
|
|
721
|
-
.text {
|
|
722
|
-
width: 100%;
|
|
723
|
-
white-space: nowrap;
|
|
724
|
-
overflow: hidden;
|
|
725
|
-
text-overflow: ellipsis;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
// 自定义节点样式
|
|
729
|
-
:deep(.lw-flow-node-custom) {
|
|
730
|
-
width: 100%;
|
|
731
|
-
height: 100%;
|
|
732
|
-
overflow: hidden;
|
|
733
|
-
background: #ffffff;
|
|
734
|
-
border-radius: 6px;
|
|
735
|
-
box-shadow: 0 0 8px rgba($color: #000000, $alpha: 0.2);
|
|
736
|
-
.top-name {
|
|
737
|
-
padding: 5px 10px;
|
|
738
|
-
display: flex;
|
|
739
|
-
align-items: center;
|
|
740
|
-
gap: 5px;
|
|
741
|
-
color: var(--el-text-color-regular);
|
|
742
|
-
line-height: 20px;
|
|
743
|
-
font-size: var(--el-popover-font-size);
|
|
744
|
-
border: 1px solid #39bcc5;
|
|
745
|
-
border-top: 10px solid #39bcc5;
|
|
746
|
-
border-bottom: 0;
|
|
747
|
-
}
|
|
748
|
-
.bottom-content {
|
|
749
|
-
height: calc(100% - 40px);
|
|
750
|
-
overflow: auto;
|
|
751
|
-
background-color: #ffffff;
|
|
752
|
-
border: 1px solid #39bcc5;
|
|
753
|
-
border-top: 0;
|
|
754
|
-
border-radius: 0 0 6px 6px;
|
|
755
|
-
padding: 10px;
|
|
756
|
-
font-size: 12px;
|
|
757
|
-
color: var(--el-text-color-regular);
|
|
758
|
-
display: flex;
|
|
759
|
-
flex-direction: column;
|
|
760
|
-
gap: 5px;
|
|
761
|
-
line-height: 14px;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
:deep(.lw-flow-node-error) {
|
|
765
|
-
&::after {
|
|
766
|
-
content: "必填字段不能为空";
|
|
767
|
-
position: absolute;
|
|
768
|
-
bottom: 0;
|
|
769
|
-
right: 0;
|
|
770
|
-
width: 100px;
|
|
771
|
-
height: 20px;
|
|
772
|
-
font-size: 10px;
|
|
773
|
-
color: #fff;
|
|
774
|
-
z-index: 9;
|
|
775
|
-
display: flex;
|
|
776
|
-
align-items: center;
|
|
777
|
-
justify-content: center;
|
|
778
|
-
background-color: rgba($color: #e61010, $alpha: 0.8);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
</style>
|