Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
7664f7eb
Commit
7664f7eb
authored
Nov 07, 2022
by
邓超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改线名称问题
parent
f45d17ab
Pipeline
#63279
passed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
19 deletions
+28
-19
FlowChart.jsx
...r/workOrder/workflowEdit/workFlowComponents/FlowChart.jsx
+28
-19
No files found.
src/pages/bsmanager/workOrder/workflowEdit/workFlowComponents/FlowChart.jsx
View file @
7664f7eb
...
@@ -36,7 +36,7 @@ const FlowChart = props => {
...
@@ -36,7 +36,7 @@ const FlowChart = props => {
const
[
editMsg
,
setEditMsg
]
=
useState
({});
// 编辑节点的信息
const
[
editMsg
,
setEditMsg
]
=
useState
({});
// 编辑节点的信息
const
[
lineMsg
,
setLineMsg
]
=
useState
({});
const
[
lineMsg
,
setLineMsg
]
=
useState
({});
const
[
modalType
,
setModalType
]
=
useState
(
''
);
// 存入弹窗是编辑还是新增
const
[
modalType
,
setModalType
]
=
useState
(
''
);
// 存入弹窗是编辑还是新增
const
[
Line
Id
,
setLineId
]
=
useState
(
''
);
// 存入编辑线id
const
[
Line
Key
,
setLineKey
]
=
useState
(
''
);
// 存入编辑线id
const
[
nodeKey
,
setNodeKey
]
=
useState
(
''
);
// 存入编辑节点的key
const
[
nodeKey
,
setNodeKey
]
=
useState
(
''
);
// 存入编辑节点的key
const
[
DeleteNodes
,
setDeleteNodes
]
=
useState
([]);
// 删除节点数组
const
[
DeleteNodes
,
setDeleteNodes
]
=
useState
([]);
// 删除节点数组
const
[
DeleteLines
,
setDeleteLines
]
=
useState
([]);
// 删除线数组
const
[
DeleteLines
,
setDeleteLines
]
=
useState
([]);
// 删除线数组
...
@@ -77,9 +77,9 @@ const FlowChart = props => {
...
@@ -77,9 +77,9 @@ const FlowChart = props => {
setDeleteNode
(
n
.
data
.
NodeId
);
setDeleteNode
(
n
.
data
.
NodeId
);
},
0
);
},
0
);
}
}
if
(
n
.
data
.
Line
Id
)
{
if
(
n
.
data
.
Line
Key
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
setDeleteLine
(
n
.
data
.
Line
Id
);
setDeleteLine
(
n
.
data
.
Line
Key
);
},
0
);
},
0
);
}
}
});
});
...
@@ -126,15 +126,16 @@ const FlowChart = props => {
...
@@ -126,15 +126,16 @@ const FlowChart = props => {
},
[
flowData
]);
},
[
flowData
]);
// 存入在树形流程中选择得流程数据
// 存入在树形流程中选择得流程数据
useEffect
(()
=>
{
useEffect
(()
=>
{
let
nodeDataArray
;
let
nodeDataArray
=
[];
if
(
currentFlowData
.
Nodes
.
length
===
0
)
{
let
linkDataArray
=
[];
nodeDataArray
=
[];
}
else
{
// 处理老数据,让老数据可以正常展示
// 处理老数据,让老数据可以正常展示
nodeDataArray
=
currentFlowData
.
Nodes
.
map
((
item
,
index
)
=>
{
nodeDataArray
=
currentFlowData
.
Nodes
.
map
((
item
,
index
)
=>
{
let
obj
;
let
obj
;
obj
=
item
;
obj
=
item
;
obj
.
key
=
item
.
NodeId
;
obj
.
key
=
item
.
NodeId
;
obj
.
nodeDetail
=
JSON
.
stringify
(
obj
);
if
(
obj
.
points
===
''
)
{
if
(
obj
.
points
===
''
)
{
if
(
obj
.
NodeType
===
'1'
)
{
if
(
obj
.
NodeType
===
'1'
)
{
obj
.
points
=
`
${(
index
*
200
).
toString
()}
" 100"`
;
obj
.
points
=
`
${(
index
*
200
).
toString
()}
" 100"`
;
...
@@ -144,13 +145,21 @@ const FlowChart = props => {
...
@@ -144,13 +145,21 @@ const FlowChart = props => {
}
}
return
obj
;
return
obj
;
});
});
}
linkDataArray
=
currentFlowData
.
Lines
.
map
(
item
=>
{
let
obj
;
obj
=
item
;
obj
.
LineKey
=
item
.
LineId
;
obj
.
lineDetail
=
JSON
.
stringify
(
obj
);
return
obj
;
});
console
.
log
(
linkDataArray
,
'linkDataArray'
);
// 保存初始数据
// 保存初始数据
setInitFlowData
(
setInitFlowData
(
JSON
.
parse
(
JSON
.
parse
(
JSON
.
stringify
({
JSON
.
stringify
({
Nodes
:
nodeDataArray
,
Nodes
:
nodeDataArray
,
Lines
:
currentFlowData
.
Lines
,
Lines
:
linkDataArray
,
}),
}),
),
),
);
);
...
@@ -158,7 +167,7 @@ const FlowChart = props => {
...
@@ -158,7 +167,7 @@ const FlowChart = props => {
linkFromPortIdProperty
:
'fromPort'
,
// 所需信息:
linkFromPortIdProperty
:
'fromPort'
,
// 所需信息:
linkToPortIdProperty
:
'toPort'
,
// 标识数据属性名称
linkToPortIdProperty
:
'toPort'
,
// 标识数据属性名称
nodeDataArray
,
nodeDataArray
,
linkDataArray
:
currentFlowData
.
Lines
,
linkDataArray
,
});
});
// 修改复制后节点内容
// 修改复制后节点内容
diagram
.
model
.
copyNodeDataFunction
=
(
obj
,
model
)
=>
{
diagram
.
model
.
copyNodeDataFunction
=
(
obj
,
model
)
=>
{
...
@@ -173,7 +182,7 @@ const FlowChart = props => {
...
@@ -173,7 +182,7 @@ const FlowChart = props => {
return
copyObj
;
return
copyObj
;
};
};
diagram
.
model
.
linkKeyProperty
=
'Line
Id
'
;
diagram
.
model
.
linkKeyProperty
=
'Line
Key
'
;
diagram
.
model
.
makeUniqueLinkKeyFunction
=
(
model
,
data
)
=>
{
diagram
.
model
.
makeUniqueLinkKeyFunction
=
(
model
,
data
)
=>
{
let
i
=
model
.
linkDataArray
.
length
*
2
+
2
;
let
i
=
model
.
linkDataArray
.
length
*
2
+
2
;
...
@@ -295,8 +304,8 @@ const FlowChart = props => {
...
@@ -295,8 +304,8 @@ const FlowChart = props => {
v
?.
length
>
0
?
new
go
.
Margin
(
10
,
10
,
0
,
10
)
:
0
,
v
?.
length
>
0
?
new
go
.
Margin
(
10
,
10
,
0
,
10
)
:
0
,
),
),
new
go
.
Binding
(
'text'
,
'nodeDetail'
,
v
=>
{
new
go
.
Binding
(
'text'
,
'nodeDetail'
,
v
=>
{
console
.
log
(
v
,
'nodenodenodne'
);
const
obj
=
JSON
.
parse
(
v
);
const
obj
=
JSON
.
parse
(
v
);
if
(
obj
.
NodeType
===
'20'
||
obj
.
NodeType
===
'21'
||
obj
.
NodeType
===
'22'
)
{
if
(
obj
.
NodeType
===
'20'
||
obj
.
NodeType
===
'21'
||
obj
.
NodeType
===
'22'
)
{
return
''
;
return
''
;
}
}
...
@@ -453,6 +462,7 @@ const FlowChart = props => {
...
@@ -453,6 +462,7 @@ const FlowChart = props => {
return
null
;
return
null
;
}
}
};
};
// 线上文案样式
const
lineTextStyle
=
v
=>
{
const
lineTextStyle
=
v
=>
{
let
obj
=
JSON
.
parse
(
v
);
let
obj
=
JSON
.
parse
(
v
);
...
@@ -466,6 +476,7 @@ const FlowChart = props => {
...
@@ -466,6 +476,7 @@ const FlowChart = props => {
}
}
return
'transparent'
;
return
'transparent'
;
};
};
// 线上的文案
const
lineText
=
v
=>
{
const
lineText
=
v
=>
{
console
.
log
(
'rfioehjgiouewrhgio'
);
console
.
log
(
'rfioehjgiouewrhgio'
);
let
obj
=
JSON
.
parse
(
v
);
let
obj
=
JSON
.
parse
(
v
);
...
@@ -509,6 +520,7 @@ const FlowChart = props => {
...
@@ -509,6 +520,7 @@ const FlowChart = props => {
new
go
.
Binding
(
'fromLinkable'
,
'NodeType'
,
v
=>
v
!==
'2'
),
// 是否允许用户绘制的链接到这里
new
go
.
Binding
(
'fromLinkable'
,
'NodeType'
,
v
=>
v
!==
'2'
),
// 是否允许用户绘制的链接到这里
new
go
.
Binding
(
'toLinkable'
,
'NodeType'
,
v
=>
v
!==
'1'
),
// 声明用户是否可以从这里绘制链接
new
go
.
Binding
(
'toLinkable'
,
'NodeType'
,
v
=>
v
!==
'1'
),
// 声明用户是否可以从这里绘制链接
);
);
// 节点盒子样式
const
nodeBoxStyle
=
(
atr
,
classname
)
=>
{
const
nodeBoxStyle
=
(
atr
,
classname
)
=>
{
switch
(
atr
)
{
switch
(
atr
)
{
case
'width'
:
case
'width'
:
...
@@ -582,7 +594,7 @@ const FlowChart = props => {
...
@@ -582,7 +594,7 @@ const FlowChart = props => {
// 双击线
// 双击线
const
addLineMsg
=
(
e
,
node
)
=>
{
const
addLineMsg
=
(
e
,
node
)
=>
{
console
.
log
(
node
.
part
.
data
,
'node.part.data'
);
console
.
log
(
node
.
part
.
data
,
'node.part.data'
);
setLine
Id
(
node
.
part
.
data
.
LineId
);
setLine
Key
(
node
.
part
.
data
.
LineKey
);
setLineMsg
(
node
.
part
.
data
);
setLineMsg
(
node
.
part
.
data
);
setLineVisible
(
true
);
setLineVisible
(
true
);
};
};
...
@@ -718,7 +730,7 @@ const FlowChart = props => {
...
@@ -718,7 +730,7 @@ const FlowChart = props => {
item
.
from
===
nodeData
.
NodeId
&&
item
.
from
===
nodeData
.
NodeId
&&
nodeData
.
RuleList
.
some
(
ele
=>
ele
.
NextNodeId
===
item
.
to
)
nodeData
.
RuleList
.
some
(
ele
=>
ele
.
NextNodeId
===
item
.
to
)
)
{
)
{
let
node
=
diagram
.
model
.
findLinkDataForKey
(
item
.
Line
Id
);
let
node
=
diagram
.
model
.
findLinkDataForKey
(
item
.
Line
Key
);
node
.
text
=
item
.
RuleName
;
node
.
text
=
item
.
RuleName
;
diagram
.
model
.
updateTargetBindings
(
node
);
diagram
.
model
.
updateTargetBindings
(
node
);
}
}
...
@@ -746,9 +758,9 @@ const FlowChart = props => {
...
@@ -746,9 +758,9 @@ const FlowChart = props => {
// 线配置回调函数
// 线配置回调函数
const
lineCallBack
=
obj
=>
{
const
lineCallBack
=
obj
=>
{
console
.
log
(
obj
,
'obj'
);
console
.
log
(
obj
,
'obj'
);
console
.
log
(
Line
Id
,
'LineId
'
);
console
.
log
(
Line
Key
,
'LineKey
'
);
console
.
log
(
diagram
,
'diagram'
);
console
.
log
(
diagram
,
'diagram'
);
let
node
=
diagram
.
model
.
findLinkDataForKey
(
Line
Id
);
let
node
=
diagram
.
model
.
findLinkDataForKey
(
Line
Key
);
console
.
log
(
node
,
'nodeData'
);
console
.
log
(
node
,
'nodeData'
);
node
.
text
=
obj
.
text
;
node
.
text
=
obj
.
text
;
diagram
.
model
.
updateTargetBindings
(
node
);
diagram
.
model
.
updateTargetBindings
(
node
);
...
@@ -764,9 +776,6 @@ const FlowChart = props => {
...
@@ -764,9 +776,6 @@ const FlowChart = props => {
// 保存后离开不用提醒要修改数据了
// 保存后离开不用提醒要修改数据了
setShowLeaveTip
(
false
);
setShowLeaveTip
(
false
);
leaveCallBack
(
false
);
leaveCallBack
(
false
);
res
.
data
.
Nodes
.
forEach
(
item
=>
{
item
.
nodeDetail
=
JSON
.
stringify
(
item
);
});
setCurrentFlowData
(
res
.
data
);
setCurrentFlowData
(
res
.
data
);
}
else
{
}
else
{
notification
.
error
({
notification
.
error
({
...
...
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