Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-station-module-view
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
station
amos-station-module-view
Commits
623735d3
Commit
623735d3
authored
Jun 11, 2020
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改缺陷757
parent
876bde88
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
114 deletions
+78
-114
View3D.js
mods/components/3dviewConvertor/view/View3D.js
+3
-8
AreaLeftTree.js
.../3dviewConvertor/view/moduleEditComponent/AreaLeftTree.js
+75
-106
No files found.
mods/components/3dviewConvertor/view/View3D.js
View file @
623735d3
...
...
@@ -796,13 +796,10 @@ class View3D extends Component {
//选中区域变化
selectItemChange
=
(
selectArea
)
=>
{
this
.
a3dRef
.
changeDrawState
(
PEN_STATE
.
CLEARED
);
//清除当前路径
// 结束绘制
this
.
setState
({
drawing
:
false
});
this
.
setState
({
selectArea
,
rightHeight
:
JSON
.
parse
(
selectArea
.
routePath
).
regionHeigth
,
selectArea
:
{
...
selectArea
},
drawing
:
false
,
// 结束绘制
rightHeight
:
selectArea
.
routePath
?
JSON
.
parse
(
selectArea
.
routePath
).
regionHeigth
:
10
,
showRightPanel
:
true
});
}
...
...
@@ -848,7 +845,6 @@ class View3D extends Component {
this
.
areas
.
push
(
<
PolygonRegion
{...
this
.
areaStyles
.
normal
}
points
=
{
item
.
routePath
?
JSON
.
parse
(
item
.
routePath
).
routePath
:
''
}
onCreated
=
{(
e
)
=>
{
this
.
onRegionCreated
(
e
,
item
);}}
/>
)
;
{
this
.
getAreas
(
item
.
children
);}
}
}
else
{
if
(
dragItem
)
{
if
(
dragItem
&&
dragItem
.
parentId
&&
dragItem
.
parentId
===
item
.
id
)
{
...
...
@@ -862,7 +858,6 @@ class View3D extends Component {
}
}
}
else
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
this
.
getAreas
(
item
.
children
);
...
...
mods/components/3dviewConvertor/view/moduleEditComponent/AreaLeftTree.js
View file @
623735d3
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Connect
,
Tree
,
Search
,
Button
}
from
'amos-framework'
;
import
{
Tree
,
Search
,
Button
}
from
'amos-framework'
;
import
imgStatic
from
'../../consts/imgStatic'
;
const
moduleEditIcon
=
imgStatic
.
moduleEditIcon
;
const
eventConnect
=
Connect
.
eventConnect
;
const
TreeNode
=
Tree
.
TreeNode
;
const
getParentKey
=
(
key
,
tree
)
=>
{
let
parentKey
;
for
(
let
i
=
0
;
i
<
tree
.
length
;
i
++
)
{
const
node
=
tree
[
i
];
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
if
(
node
.
children
.
some
(
item
=>
item
.
id
===
key
))
{
parentKey
=
node
.
id
;
}
else
if
(
getParentKey
(
key
,
node
.
children
))
{
...
...
@@ -21,7 +20,9 @@ const getParentKey = (key, tree) => {
return
parentKey
;
};
@
eventConnect
/**
* 区域绑定树
*/
class
AreaLeftTree
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -36,42 +37,32 @@ class AreaLeftTree extends Component {
treeDataList
:
[],
searchValue
:
''
};
}
component
Did
Mount
()
{
let
{
treeData
,
pointTypeArr
,
treeDataList
}
=
this
.
props
;
component
Will
Mount
()
{
const
{
treeData
,
pointTypeArr
,
treeDataList
}
=
this
.
props
;
this
.
setState
({
treeData
,
treeDataList
,
pointTypeArr
,
pointType
:
pointTypeArr
[
0
]?
pointTypeArr
[
0
].
code
:
''
})
pointType
:
pointTypeArr
[
0
]
?
pointTypeArr
[
0
].
code
:
''
});
}
componentWillUnmount
()
{
}
componentWillReceiveProps
(
nextProps
)
{
console
.
log
(
nextProps
)
let
{
treeData
,
pointTypeArr
,
pageType
,
treeDataList
}
=
nextProps
;
console
.
log
(
nextProps
);
const
{
treeData
,
pointTypeArr
,
treeDataList
}
=
nextProps
;
this
.
setState
({
treeData
,
pointTypeArr
,
treeDataList
,
pointType
:
pointTypeArr
[
0
]?
pointTypeArr
[
0
].
code
:
''
})
pointType
:
pointTypeArr
[
0
]
?
pointTypeArr
[
0
].
code
:
''
});
}
// onSelectChange = (value, item) =>{
// console.log(value, item);
// this.state.pointType = value;
// this.props.pointTypeChange(value);
// }
onSearchChange
=
e
=>
{
const
{
treeDataList
,
treeData
}
=
this
.
state
const
{
treeDataList
,
treeData
}
=
this
.
state
;
const
value
=
e
.
target
.
value
;
const
expandedKeys
=
treeDataList
.
map
(
item
=>
{
...
...
@@ -85,131 +76,106 @@ class AreaLeftTree extends Component {
expandedKeys
,
searchValue
:
value
,
autoExpandParent
:
true
});
}
}
;
onExpand
=
(
expandedKeys
)
=>
{
//console.log('onExpand', arguments);
onExpand
=
expandedKeys
=>
{
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this
.
setState
({
expandedKeys
,
autoExpandParent
:
false
});
}
// onCheck = (checkedKeys,e) => {
// console.log('onCheck', checkedKeys);
// // console.log('onCheck', e);
// let currentKey = checkedKeys.checked[0]?checkedKeys.checked[checkedKeys.checked.length-1]:'';
// if (checkedKeys.checked.length<2) {
// currentKey = checkedKeys.checked[0]
// } else {
// if (checkedKeys.checked[0] == this.state.checkedKeys[0]) {
// currentKey = checkedKeys.checked[1]
// } else {
// currentKey = checkedKeys.checked[0]
// }
// }
// // checkedKeys[0] = checkedKeys[checkedKeys.length - 1]
// this.setState({ checkedKeys: currentKey?[currentKey]:[] });
// this.props.selectItemChange(currentKey);
// if (currentKey) {
// this.props.startDrow(currentKey);
// }else {
// this.props.stopDrowing()
// }
// }
drowArea
=
(
editItem
)
=>
{
};
}
onTreeSelect
=
(
selectedKeys
,
info
)
=>
{
console
.
log
(
'onSelect'
,
info
);
let
selectItem
=
info
.
node
.
props
.
dataRef
;
this
.
setState
({
selectedKeys
});
this
.
setState
({
selectedKeys
});
this
.
props
.
selectItemChange
(
selectItem
);
}
// onClick={(e)=>{e.nativeEvent.stopImmediatePropagation();e.stopPropagation();console.log(123123);}}
renderTreeNodes
=
(
data
)
=>
{
let
{
searchValue
}
=
this
.
state
// console.log(data);
if
(
data
.
length
>
0
)
{
return
data
.
map
((
item
)
=>
{
};
renderTreeNodes
=
data
=>
{
const
{
searchValue
}
=
this
.
state
;
if
(
data
.
length
>
0
)
{
return
data
.
map
(
item
=>
{
const
index
=
item
.
name
.
indexOf
(
searchValue
);
const
beforeStr
=
item
.
name
.
substr
(
0
,
index
);
const
afterStr
=
item
.
name
.
substr
(
index
+
searchValue
.
length
);
const
title
=
index
>
-
1
?
(
<
span
>
{
beforeStr
}
<
span
style
=
{{
color
:
'#f50'
}}
>
{
searchValue
}
<
/span
>
{
afterStr
}
{
' '
}
{
beforeStr
}{
' '
}
<
span
style
=
{{
color
:
'#f50'
}}
>
{
' '
}
{
searchValue
}{
' '
}
<
/span>{' '
}
{
afterStr
}{
' '
}
<
/span
>
)
:
(
<
span
>
{
item
.
name
}
<
/span
>
<
span
>
{
item
.
name
}
<
/span
>
);
if
(
item
.
children
)
{
return
(
<
TreeNode
title
=
{
<
div
>
{
' '
}
{
<
span
>
{
title
}
<
span
className
=
'icon'
>
{
item
.
isBind
?
''
:
<
span
>
{
' '
}
{
title
}{
' '
}
<
span
className
=
"icon"
>
{
' '
}
{
item
.
isBind
?
''
:
<
img
src
=
{
moduleEditIcon
.
editBtn
}
onClick
=
{(
e
)
=>
{
alt
=
""
onClick
=
{
e
=>
{
e
.
nativeEvent
.
stopImmediatePropagation
();
e
.
stopPropagation
();
this
.
props
.
startDrow
(
item
);
}}
/
>
}
{
item
.
isBind
?
<
img
src
=
{
moduleEditIcon
.
bindedTip
}
alt
=
''
/>
:
item
.
routePath
?
<
img
src
=
{
moduleEditIcon
.
noSaveTip
}
alt
=
''
/>
:
<
img
src
=
{
moduleEditIcon
.
noSaveTip
}
alt
=
''
/>
}
}{
' '
}
{
item
.
isBind
?
<
img
src
=
{
moduleEditIcon
.
bindedTip
}
alt
=
""
/>
:
item
.
routePath
?
<
img
src
=
{
moduleEditIcon
.
noSaveTip
}
alt
=
""
/>
:
<
img
src
=
{
moduleEditIcon
.
noSaveTip
}
alt
=
""
/>
}{
' '
}
<
/span>{' '
}
<
/span
>
<
/span
>
}
}{
' '
}
<
/div
>
}
key
=
{
item
.
id
}
dataRef
=
{
item
}
>
{
this
.
renderTreeNodes
(
item
.
children
)}
{
this
.
renderTreeNodes
(
item
.
children
)}
{
' '
}
<
/TreeNode
>
);
}
});
}
}
};
render
()
{
let
{
treeData
,
checkedKeys
,
pointTypeArr
,
pointType
}
=
this
.
state
;
let
{
pageType
}
=
this
.
props
;
const
{
treeData
}
=
this
.
state
;
return
(
<
div
className
=
"leftTree"
>
<
div
className
=
'leftContainer'
>
<
div
className
=
'topForm'
>
<
Search
className
=
'leftSearch'
icon
=
"search"
onChange
=
{
this
.
onSearchChange
}
onIconClick
=
{
this
.
onSearchChange
}
/
>
<
div
className
=
"leftContainer"
>
<
div
className
=
"topForm"
>
<
Search
className
=
"leftSearch"
icon
=
"search"
onChange
=
{
this
.
onSearchChange
}
onIconClick
=
{
this
.
onSearchChange
}
/
>
<
/div
>
<
div
className
=
'treeBox'
>
<
div
className
=
"treeBox"
>
<
Tree
// checkable
// checkStrictly
selectable
=
{
true
}
selectable
onExpand
=
{
this
.
onExpand
}
expandedKeys
=
{
this
.
state
.
expandedKeys
}
autoExpandParent
=
{
true
}
// onCheck={this.onCheck}
// checkedKeys={checkedKeys}
autoExpandParent
onSelect
=
{
this
.
onTreeSelect
}
selectedKeys
=
{
this
.
state
.
selectedKeys
}
blockNode
...
...
@@ -217,28 +183,31 @@ class AreaLeftTree extends Component {
{
this
.
renderTreeNodes
(
treeData
)}
<
/Tree
>
<
/div
>
<
div
className
=
'bottomBtns'
>
<
div
className
=
"bottomBtns"
>
<
Button
className
=
'sureBtn'
onClick
=
{()
=>
{
this
.
props
.
saveAreaData
()
}}
><
/Button
>
className
=
"sureBtn"
onClick
=
{()
=>
this
.
props
.
saveAreaData
()}
/
>
<
Button
className
=
'deleteBtn'
onClick
=
{()
=>
{
this
.
props
.
deleteAreaBind
()
}}
><
/Button
>
className
=
"deleteBtn"
onClick
=
{()
=>
this
.
props
.
deleteAreaBind
()}
/
>
<
/div
>
<
/div
>
<
/div
>
);
}
}
AreaLeftTree
.
propTypes
=
{
subscribe
:
PropTypes
.
func
,
trigger
:
PropTypes
.
func
treeData
:
PropTypes
.
array
,
pointTypeArr
:
PropTypes
.
array
,
treeDataList
:
PropTypes
.
array
,
saveAreaData
:
PropTypes
.
func
,
deleteAreaBind
:
PropTypes
.
func
,
pageType
:
PropTypes
.
string
,
startDrow
:
PropTypes
.
func
,
selectItemChange
:
PropTypes
.
func
};
export
default
AreaLeftTree
;
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