@ -45,6 +45,7 @@ const Control = (props) => {
const [ videoBI , setVideoBI ] = useState ( [ ] ) ; / / 查 询 B I 分 析 数 据 - 视 频
const [ appBI , setAppBI ] = useState ( [ ] ) ; / / 查 询 B I 分 析 数 据 - 应 用
const [ efficiencyBI , setEfficiencyBI ] = useState ( { } ) ; / / 查 询 B I 分 析 数 据 - 问 题 处 置
const [ query , setQuery ] = useState ( { limit : 10 , page : 0 , projectCorrelationId : '' , types : '1,2,3,4' } ) ; / / 最 新 动 态
const [ querydata1 , setQueryData1 ] = useState ( [ ] ) ; / / 最 新 动 态 数 据
const [ long , setLong ] = useState ( '' ) ; / / 最 新 动 态 设 置
const [ pomsList , setPomsList ] = useState ( [ ] ) ; / / 项 目
@ -57,7 +58,7 @@ const Control = (props) => {
const exhibition = useRef ( { workbench : [ ] , statistical : [ ] } ) / / 页 面 结 构
const FormApi = useRef ( )
const querydata = useRef ( [ ] ) / / 最 新 动 态 数 据
const query = useRef ( { limit : 10 , page : 0 , projectCorrelationId : '' , types : '1,2,3,4' } ) / / 最 新 动 态
/ / c o n s t q u e r y = { l i m i t : 1 0 , p a g e : 0 , p r o j e c t C o r r e l a t i o n I d : ' ' , t y p e s : ' 1 , 2 , 3 , 4 ' } / / 最 新 动 态
/ / w e b s o c k e t 使 用 测 试
useEffect ( ( ) => {
@ -97,72 +98,6 @@ const Control = (props) => {
} )
}
concentration2 ( )
const line = document . getElementById ( "line" )
const news = document . getElementById ( "news" )
if ( line && news ) {
news . onscroll = ( ) => {
if ( ( line . clientHeight - 578 ) < news . scrollTop + 10 ) {
query . current = { ... query . current , page : query . current . page + 1 }
if ( exhibition ? . current ? . dynamic ? . length > 0 ) {
dispatch ( control . getLatestDynamic ( { ... query . current , projectCorrelationId : pepProjectId , page : query . current . page } ) ) . then ( res => {
console . log ( res . payload . data )
let branches = [ ... res . payload . data ? . appear , ... res . payload . data ? . confirm , ... res . payload . data ? . notice ]
if ( branches ? . length == 10 ) {
news . scrollTop = news . scrollTop - 640
}
let data = querydata . current
if ( res . success ) {
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'discovery' ) ) {
res . payload . data ? . appear ? . map ( v => data . push ( {
seed : 'discovery' ,
project : v . projectName ,
sources : v . alarmInfo ? . sourceName ,
type : v . type ,
time : v . time ,
id : v . id ,
} ) )
}
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'confirm' ) ) {
res . payload . data ? . confirm ? . map ( v => data . push ( {
seed : 'confirm' ,
project : v . projectName ,
sources : v . alarmInfo ? . source ,
type : v . alarmInfo ? . type ,
time : v . confirmTime ,
userName : v . userName ,
id : v . id ,
} ) )
}
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'notice' ) ) {
res . payload . data ? . notice ? . map ( v => data . push ( {
seed : 'notice' ,
time : v . time ,
project : v . projectName ,
userName : v . userName ? . map ( u => u . name ) ,
alarmPushConfig : v . alarmPushConfig ? . name ,
tactics : v . tactics ,
interval : v . tacticsParams ? . interval ,
deviceProportion : v . tacticsParams ? . deviceProportion ,
id : v . id ,
} ) )
}
data . sort ( ( a , b ) => {
if ( moment ( a . time ) . isBefore ( b . time ) ) {
return 1
} else {
return - 1
}
} )
console . log ( data )
querydata . current = data
setQueryData1 ( data )
}
} )
}
}
}
}
return ( ) => {
}
@ -235,12 +170,11 @@ const Control = (props) => {
/ / 查 询 最 新 动 态
async function concentration3 ( ) {
if ( exhibition ? . current ? . dynamic ? . length > 0 ) {
let dynamicData = [ 1 ]
await dispatch ( control . getLatestDynamic ( { ... query . current , projectCorrelationId : pepProjectId } ) ) . then ( res => {
console . log ( query ? . page ) ;
await dispatch ( control . getLatestDynamic ( { ... query , projectCorrelationId : pepProjectId } ) ) . then ( res => {
/ / c o n s o l e . l o g ( r e s . p a y l o a d . d a t a ) ;
if ( res . payload . data ? . appear ? . length || 0 + res . payload . data ? . confirm ? . length + res . payload . data ? . notice ? . length < 10 ) setASk ( false )
let data = [ ]
querydata . current = [ ]
if ( res . success ) {
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'discovery' ) ) {
res . payload . data ? . appear ? . map ( v => data . push ( {
@ -293,7 +227,74 @@ const Control = (props) => {
concentration3 ( )
} , [ pepProjectId , exhibition . current ] )
useEffect ( ( ) => {
const line = document . getElementById ( "line" )
const news = document . getElementById ( "news" )
if ( line && news ) {
news . onscroll = ( ) => {
console . log ( line . clientHeight )
console . log ( news . clientHeight )
console . log ( news . scrollTop )
if ( ( line . clientHeight - 578 ) < news . scrollTop + 10 ) {
setQuery ( { ... query , page : query . page + 1 } )
if ( exhibition ? . current ? . dynamic ? . length > 0 ) {
dispatch ( control . getLatestDynamic ( { ... query , projectCorrelationId : pepProjectId , page : query . page + 1 } ) ) . then ( res => {
console . log ( res . payload . data )
news . scrollTop = news . scrollTop - 640
let data = querydata . current
if ( res . success ) {
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'discovery' ) ) {
res . payload . data ? . appear ? . map ( v => data . push ( {
seed : 'discovery' ,
project : v . projectName ,
sources : v . alarmInfo ? . sourceName ,
type : v . type ,
time : v . time ,
id : v . id ,
} ) )
}
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'confirm' ) ) {
res . payload . data ? . confirm ? . map ( v => data . push ( {
seed : 'confirm' ,
project : v . projectName ,
sources : v . alarmInfo ? . source ,
type : v . alarmInfo ? . type ,
time : v . confirmTime ,
userName : v . userName ,
id : v . id ,
} ) )
}
if ( exhibition ? . current ? . dynamic ? . find ( v => v . key == 'notice' ) ) {
res . payload . data ? . notice ? . map ( v => data . push ( {
seed : 'notice' ,
time : v . time ,
project : v . projectName ,
userName : v . userName ? . map ( u => u . name ) ,
alarmPushConfig : v . alarmPushConfig ? . name ,
tactics : v . tactics ,
interval : v . tacticsParams ? . interval ,
deviceProportion : v . tacticsParams ? . deviceProportion ,
id : v . id ,
} ) )
}
data . sort ( ( a , b ) => {
if ( moment ( a . time ) . isBefore ( b . time ) ) {
return 1
} else {
return - 1
}
} )
console . log ( data )
querydata . current = data
setQueryData1 ( data )
}
} )
}
}
}
}
} , [ query ] )
useEffect ( ( ) => {