Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ce0020ab
authored
Feb 25, 2025
by
Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用 Lodash 的 cloneDeep 方法来进行深拷贝
parent
c7b135e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue
+5
-4
No files found.
src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue
View file @
ce0020ab
...
@@ -47,6 +47,7 @@ import { SimpleFlowNode, ConditionType } from '../consts'
...
@@ -47,6 +47,7 @@ import { SimpleFlowNode, ConditionType } from '../consts'
import
{
getDefaultConditionNodeName
}
from
'../utils'
import
{
getDefaultConditionNodeName
}
from
'../utils'
import
{
useFormFieldsAndStartUser
,
getConditionShowText
}
from
'../node'
import
{
useFormFieldsAndStartUser
,
getConditionShowText
}
from
'../node'
import
Condition
from
'./components/Condition.vue'
import
Condition
from
'./components/Condition.vue'
import
{
cloneDeep
}
from
'lodash-es'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
defineOptions
({
defineOptions
({
name
:
'ConditionNodeConfig'
name
:
'ConditionNodeConfig'
...
@@ -81,7 +82,7 @@ const condition = ref<any>({
...
@@ -81,7 +82,7 @@ const condition = ref<any>({
const
open
=
()
=>
{
const
open
=
()
=>
{
// 如果有已存在的配置则使用,否则使用默认值
// 如果有已存在的配置则使用,否则使用默认值
if
(
currentNode
.
value
.
conditionSetting
)
{
if
(
currentNode
.
value
.
conditionSetting
)
{
condition
.
value
=
JSON
.
parse
(
JSON
.
stringify
(
currentNode
.
value
.
conditionSetting
)
)
condition
.
value
=
cloneDeep
(
currentNode
.
value
.
conditionSetting
)
}
else
{
}
else
{
// 重置为默认值
// 重置为默认值
condition
.
value
=
{
condition
.
value
=
{
...
@@ -157,13 +158,13 @@ const saveConfig = async () => {
...
@@ -157,13 +158,13 @@ const saveConfig = async () => {
return
false
return
false
}
}
currentNode
.
value
.
showText
=
showText
currentNode
.
value
.
showText
=
showText
//
深拷贝保存的条件设置,避免引用问题
//
使用 cloneDeep 进行深拷贝
currentNode
.
value
.
conditionSetting
=
JSON
.
parse
(
JSON
.
stringify
({
currentNode
.
value
.
conditionSetting
=
cloneDeep
({
...
currentNode
.
value
.
conditionSetting
,
...
currentNode
.
value
.
conditionSetting
,
conditionType
:
condition
.
value
?.
conditionType
,
conditionType
:
condition
.
value
?.
conditionType
,
conditionExpression
:
condition
.
value
?.
conditionType
===
ConditionType
.
EXPRESSION
?
condition
.
value
?.
conditionExpression
:
undefined
,
conditionExpression
:
condition
.
value
?.
conditionType
===
ConditionType
.
EXPRESSION
?
condition
.
value
?.
conditionExpression
:
undefined
,
conditionGroups
:
condition
.
value
?.
conditionType
===
ConditionType
.
RULE
?
condition
.
value
?.
conditionGroups
:
undefined
conditionGroups
:
condition
.
value
?.
conditionType
===
ConditionType
.
RULE
?
condition
.
value
?.
conditionGroups
:
undefined
})
)
})
}
}
settingVisible
.
value
=
false
settingVisible
.
value
=
false
return
true
return
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment