Skip to content

Commit b2ac658

Browse files
committed
feat: 工作流编排应用记住节点的收起/展开状态 #1543
1 parent 22d9fdc commit b2ac658

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

ui/src/workflow/common/NodeContainer.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,13 @@
2626
<h4 v-else>{{ nodeModel.properties.stepName }}</h4>
2727
</div>
2828

29-
<div
30-
@mousemove.stop
31-
@mousedown.stop
32-
@keydown.stop
33-
@click.stop
34-
v-if="showOperate(nodeModel.type)"
35-
>
29+
<div @mousemove.stop @mousedown.stop @keydown.stop @click.stop>
3630
<el-button text @click="showNode = !showNode" class="mr-4">
3731
<el-icon class="arrow-icon" :class="showNode ? 'rotate-180' : ''"
3832
><ArrowDownBold />
3933
</el-icon>
4034
</el-button>
41-
<el-dropdown :teleported="false" trigger="click">
35+
<el-dropdown v-if="showOperate(nodeModel.type)" :teleported="false" trigger="click">
4236
<el-button text>
4337
<el-icon class="color-secondary"><MoreFilled /></el-icon>
4438
</el-button>
@@ -130,7 +124,19 @@ const height = ref<{
130124
})
131125
const showAnchor = ref<boolean>(false)
132126
const anchorData = ref<any>()
133-
const showNode = ref<boolean>(true)
127+
// const showNode = ref<boolean>(true)
128+
const showNode = computed({
129+
set: (v) => {
130+
set(props.nodeModel.properties, 'showNode', v)
131+
},
132+
get: () => {
133+
if (props.nodeModel.properties.showNode !== undefined) {
134+
return props.nodeModel.properties.showNode
135+
}
136+
set(props.nodeModel.properties, 'showNode', true)
137+
return true
138+
}
139+
})
134140
const node_status = computed(() => {
135141
if (props.nodeModel.properties.status) {
136142
return props.nodeModel.properties.status

ui/src/workflow/common/app-node.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,22 @@ class AppNodeModel extends HtmlResize.model {
234234
}
235235
getDefaultAnchor() {
236236
const { id, x, y, width } = this
237+
const showNode = this.properties.showNode === undefined ? true : this.properties.showNode
237238
const anchors: any = []
238239

239240
if (this.type !== WorkflowType.Base) {
240241
if (this.type !== WorkflowType.Start) {
241242
anchors.push({
242243
x: x - width / 2 + 10,
243-
y: y,
244+
y: showNode ? y : y - 15,
244245
id: `${id}_left`,
245246
edgeAddable: false,
246247
type: 'left'
247248
})
248249
}
249250
anchors.push({
250251
x: x + width / 2 - 10,
251-
y: y,
252+
y: showNode ? y : y - 15,
252253
id: `${id}_right`,
253254
type: 'right'
254255
})

ui/src/workflow/nodes/condition-node/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class ConditionModel extends AppNodeModel {
3535
if (this.height === undefined) {
3636
this.height = 200
3737
}
38+
const showNode = this.properties.showNode === undefined ? true : this.properties.showNode
3839
const anchors: any = []
3940
anchors.push({
4041
x: x - width / 2 + 10,
41-
y: y,
42+
y: showNode ? y : y - 15,
4243
id: `${id}_left`,
4344
edgeAddable: false,
4445
type: 'left'
@@ -50,7 +51,7 @@ class ConditionModel extends AppNodeModel {
5051
const h = get_up_index_height(branch_condition_list, index)
5152
anchors.push({
5253
x: x + width / 2 - 10,
53-
y: y - height / 2 + 75 + h + element.height / 2,
54+
y: showNode ? y - height / 2 + 75 + h + element.height / 2 : y - 15,
5455
id: `${id}_${element.id}_right`,
5556
type: 'right'
5657
})

0 commit comments

Comments
 (0)