Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AmosBankView
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
bank
AmosBankView
Commits
c8140d95
Commit
c8140d95
authored
Jun 11, 2020
by
zhengjiangtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改自建系统为通用接口
parent
3a321c1a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
170 deletions
+24
-170
index.js
src/view/bank/virtualCloudPlatform/index.js
+0
-0
index.js
src/view/bizview/selfSupport/index.js
+24
-170
No files found.
src/view/bank/virtualCloudPlatform/index.js
View file @
c8140d95
This diff is collapsed.
Click to expand it.
src/view/bizview/selfSupport/index.js
View file @
c8140d95
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
classnames
from
'classnames'
;
import
{
message
}
from
'amos-framework'
;
import
dt2react
from
'dt2react'
;
import
AmosWebSocket
from
'amos-websocket'
;
import
TopologyComponent
from
'./TopologyComponent'
;
import
TreeComponent
from
'./TreeComponent'
;
import
mqtt
from
'mqtt'
;
import
*
as
endConf
from
'amos-processor/lib/config/endconf'
;
import
{
getSelfTopoTreeAction
,
getSelfTopographyAction
,
updateSelfTopographyAction
,
getTopographyEventsAction
,
getDeivceListAction
}
from
'./../../../services/selfServices'
;
// import AmosGridTable from './../../bizview/common/tableComponent/table/AmosGridTable';
import
{
getDeivceListAction
}
from
'./../../../services/selfServices'
;
import
{
getTopoTreeByTypeAction
,
getNodesByTypeAndTreeIdAction
,
saveNodesByTypeUrlAction
}
from
'./../../../services/monitorService'
;
import
AmosGridTable
from
'./../../component/table/table/AmosGridTable'
;
import
SysWsURL
from
'./../../../consts/wsUrlConsts'
;
const
AmosConfig
=
endConf
.
AmosConfig
;
const
mqttURI
=
AmosConfig
.
wsURI
.
mqttURI
;
const
options
=
{
//默认 30 * 1000毫秒,收到 CONNACK 之前等待的时间,即连接超时时间。
connectTimeout
:
40000
,
// 客户端 ID,随机生成
clientId
:
'bank_self_mqtt'
+
Math
.
random
().
toString
(
16
).
substr
(
2
,
8
),
clean
:
true
,
//默认 1000 毫秒,两次重新连接之间的间隔,客户端 ID 重复、认证失败等客户端会重新连接;
reconnectPeriod
:
1000
*
50
}
let
client
=
mqtt
.
connect
(
mqttURI
,
options
)
import
{
getTypeBySystem
}
from
'./../../bank/financialCityLan/conf'
;
const
checkListColumns
=
(
self
)
=>
{
return
[
...
...
@@ -87,6 +71,7 @@ const checkListColumns = (self) => {
//偏移
const
offsetHeight
=
110
;
const
defaultHeight
=
450
;
const
type
=
getTypeBySystem
(
'SelfSupport'
);
class
SelfSupport
extends
Component
{
...
...
@@ -121,106 +106,20 @@ class SelfSupport extends Component {
selectedRows
:
[],
selectedRowKeys
:
[],
pagination
:
true
,
isChecked
:
false
,
isChecked
:
false
};
this
.
updateTopologyData
=
{};
this
.
mapView
=
true
;
}
componentWillMount
()
{
}
componentDidMount
()
{
this
.
initData
();
if
(
this
.
props
.
location
.
state
)
{
this
.
state
.
cityLine
=
JSON
.
parse
(
this
.
props
.
location
.
state
.
cityLine
);
this
.
viewlineItem
();
}
// this.receivcemqtt();
}
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
.
location
.
state
)
{
this
.
state
.
cityLine
=
JSON
.
parse
(
nextProps
.
location
.
state
.
cityLine
);
this
.
viewlineItem
();
}
}
receivcemqtt
=
()
=>
{
client
.
on
(
'connect'
,
(
e
)
=>
{
console
.
log
(
"连接成功!!!"
)
//QoS0,最多一次送达。也就是发出去就fire掉,没有后面的事情了。
// QoS1,至少一次送达。发出去之后必须等待ack,没有ack,就要找时机重发
// QoS2,准确一次送达。消息id将拥有一个简单的生命周期。
// client.subscribe('bank/equipment/ping', { qos: 1 }, (res) => {
client
.
subscribe
(
'bank/equipment/ping'
,
{
qos
:
1
},
(
res
)
=>
{
if
(
!
res
)
{
console
.
log
(
'订阅成功'
);
}
else
{
console
.
log
(
'订阅失败'
)
}
});
// 接收消息处理
client
.
on
(
'message'
,
(
topic
,
message
)
=>
{
// console.log('收到来自', topic, '的消息', message.toString());
const
{
selectedKeys
}
=
this
.
state
;
this
.
initTopologyData
(
selectedKeys
[
0
],
''
);
});
// 断开发起重连
client
.
on
(
'reconnect'
,
(
error
)
=>
{
console
.
log
(
'正在重连:'
,
error
)
});
// 链接异常处理
client
.
on
(
'error'
,
(
error
)
=>
{
console
.
log
(
'连接失败:'
,
error
)
});
});
}
//点击地图线操作
viewlineItem
=
()
=>
{
let
{
treeData
,
selectedKeys
,
cityLine
}
=
this
.
state
;
if
(
cityLine
)
{
let
currentLine
=
`
${
cityLine
.
citys
[
0
]}
-
${
cityLine
.
citys
[
1
]}
`
;
for
(
let
i
=
0
;
i
<
treeData
.
length
;
i
++
)
{
let
dataItem
=
treeData
[
i
].
children
;
for
(
let
j
=
0
;
j
<
dataItem
.
length
;
j
++
)
{
if
(
dataItem
[
j
].
name
===
currentLine
)
{
// selectedKeys.push(dataItem[j].id)
selectedKeys
=
[
dataItem
[
j
].
id
];
console
.
log
(
selectedKeys
);
if
(
selectedKeys
[
0
])
{
this
.
initTopologyData
(
selectedKeys
[
0
]);
}
this
.
setState
({
selectedKeys
});
}
}
}
}
}
componentWillUnmount
()
{
window
.
localStorage
.
removeItem
(
'cityLine'
);
}
getPanelHeight
=
()
=>
{
let
tableNode
=
this
.
tableNode
;
let
tableLocation
=
dt2react
.
getOffset
(
tableNode
)
||
{};
return
(
tableLocation
!==
undefined
?
tableLocation
.
height
-
offsetHeight
:
defaultHeight
)
-
30
;
};
// 数据初始化
// eslint-disable-next-line react/sort-comp
initData
=
()
=>
{
let
expandedKeysData
=
[];
get
SelfTopoTreeAction
(
).
then
(
data
=>
{
get
TopoTreeByTypeAction
(
type
).
then
(
data
=>
{
data
.
map
(
item
=>
{
expandedKeysData
.
push
(
item
.
id
);
});
...
...
@@ -231,15 +130,25 @@ class SelfSupport extends Component {
selectedKeys
:
[
data
[
0
].
id
],
expandedKeys
:
expandedKeysData
,
pHeight
:
this
.
getPanelHeight
()
},
()
=>
{
this
.
viewlineItem
();
});
});
}
componentDidMount
()
{
this
.
initData
();
}
getPanelHeight
=
()
=>
{
let
tableNode
=
this
.
tableNode
;
let
tableLocation
=
dt2react
.
getOffset
(
tableNode
)
||
{};
return
(
tableLocation
!==
undefined
?
tableLocation
.
height
-
offsetHeight
:
defaultHeight
)
-
30
;
};
// 拓扑图数据初始化
initTopologyData
=
(
id
,
value
=
''
)
=>
{
get
SelfTopographyAction
(
id
).
then
(
data
=>
{
get
NodesByTypeAndTreeIdAction
(
type
,
id
).
then
(
data
=>
{
if
(
value
===
'refresh'
)
{
message
.
success
(
'拓扑图刷新成功!'
);
}
...
...
@@ -255,23 +164,12 @@ class SelfSupport extends Component {
});
}
// // 拓扑图事件数据初始化
// initTopologyEventData = () => {
// debugger
// getDeivceListAction().then(data => {
// this.setState({
// tableData: data
// });
// });
// }
/**
* 获取表格所选则的行数据
*/
getSelectedRows
=
(
selectedRows
,
selectedRowKeys
)
=>
{
this
.
setState
({
selectedRows
,
selectedRowKeys
});
let
{
riskSourceId
,
equipmentId
,
callBack
}
=
this
.
props
;
// callBack(selectedRowKeys,riskSourceId,equipmentId);
};
...
...
@@ -286,14 +184,6 @@ class SelfSupport extends Component {
}
}
mapLineClick
=
(
data
)
=>
{
window
.
localStorage
.
removeItem
(
'cityLine'
);
this
.
state
.
cityLine
=
data
;
this
.
viewlineItem
();
}
// 树展开
onExpand
=
(
expandedKeys
)
=>
{
this
.
setState
({
...
...
@@ -314,20 +204,6 @@ class SelfSupport extends Component {
});
}
// // 选择节点连线
// nodeSelectionLinkChanged = (node) => {
// if (node.isSelected) {
// // 点击选择节点
// if (node.data.clickable) {
// this.initTopologyData(node.data.treeNodeId);
// this.setState({
// selectedKeys: [node.data.treeNodeId]
// });
// }
// // console.log(node.data);
// }
// }
// 选择节点
nodeSelectionChanged
=
(
e
)
=>
{
// console.log('e',e);
...
...
@@ -349,7 +225,7 @@ class SelfSupport extends Component {
nodeData
:
nodeDataArray
,
linkData
:
linkDataArray
};
updateSelfTopographyAction
(
params
).
then
(
data
=>
{
saveNodesByTypeUrlAction
(
type
,
params
).
then
(
data
=>
{
message
.
success
(
'拓扑图保存成功!'
);
});
}
...
...
@@ -424,7 +300,7 @@ class SelfSupport extends Component {
}
}
const
{
topologyData
}
=
this
.
state
;
const
{
tableData
,
isTableDisplay
,
pHeight
,
activeView
}
=
this
.
state
;
const
{
tableData
,
isTableDisplay
,
activeView
}
=
this
.
state
;
console
.
log
(
topologyData
);
return
(
<
div
className
=
"self-wrapper"
>
...
...
@@ -485,36 +361,14 @@ class SelfSupport extends Component {
<
/div
>
<
/div
>
<
/div
>
{
/* <div className={`middle-content ${isTreeDisplay && isTableDisplay?'':'only-middle'}`}>
<div className="paslogy-content">
{
this.mapView ? <IndexChart mapLineClick={this.mapLineClick} /> :
<TopologyComponent
topologyData={topologyData}
nodeSelectionLinkChanged={this.nodeSelectionLinkChanged}
nodeChange={this.nodeChange}
/>
}
</div>
</div> */
}
<
div
className
=
{
classnames
({
'right-content'
:
isTableDisplay
,
'right-content-close'
:
!
isTableDisplay
})}
>
<
div
className
=
"devive-title"
>
日志
<
/div
>
<
div
className
=
"device-lists"
ref
=
{
node
=>
this
.
tableNode
=
node
}
>
{
/* <AmosGridTable
columns={checkListColumns(this)}
getTableDataAction={()=>{}}
callBack={()=>{}}
isPageable={true}
isChecked={false}
dataList={tableData}
//dataList={data}
getPanelHeight={this.getPanelHeight}
pHeight={pHeight}
/>
</div> */
}
<
AmosGridTable
columns
=
{
checkListColumns
(
this
)}
callBack
=
{
this
.
reload
}
...
...
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