|
|
@ -25,7 +25,7 @@ const Bigscreen = (props) => { |
|
|
|
const [proportion, setProportion] = useState([]) |
|
|
|
const [formatter, setFormatter] = useState({}) |
|
|
|
const [groupDetail, setGroupDetail] = useState({}) |
|
|
|
|
|
|
|
const [allProjects,setAllProjects]=useState([]) |
|
|
|
const [alarmData, setAlarmData] = useState()//第三项之后的数据 |
|
|
|
const [biggest, setBiggest] = useState()//最大的刻度值 |
|
|
|
const [mockData, setMockData] = useState()//所有的告警数据 |
|
|
@ -67,7 +67,11 @@ const Bigscreen = (props) => { |
|
|
|
setGroupDetail(res.payload.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
dispatch(actions.workOrder.getPomsProjectBasicAll()).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setAllProjects(res.payload.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -135,27 +139,27 @@ const Bigscreen = (props) => { |
|
|
|
} |
|
|
|
}, [mockData]) |
|
|
|
|
|
|
|
console.log('xxx1',actions) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if(groupDetail?.pomsProjectIds&&groupDetail?.pomsProjectIds.length){ |
|
|
|
const query=groupDetail?.pomsProjectIds+'' |
|
|
|
if(groupDetail?.pomsProjectIds&&groupDetail?.pomsProjectIds.length&&allProjects&&allProjects.length){ |
|
|
|
const query=groupDetail?.pomsProjectIds |
|
|
|
dispatch(actions.projectGroup.getProjectWorkOrders({projectIds:query})).then(res=>{ |
|
|
|
if(res.success){ |
|
|
|
setProportion([...res.payload.data?.slice(0, 3)?.map(v => ({ name: pomsProjectBasicAll.find(item=>item.valiue===v.projectId)?.label, value: v.count })), |
|
|
|
{ value: res.payload.data&&res.payload.data.length>3?res.payload.data?.slice(3)?.reduce((p,c)=>{ |
|
|
|
return p+c.count |
|
|
|
},0):0, name: '其它' }]) |
|
|
|
setProportion([...res.payload.data?.slice(0, 3)?.map(v => ({ name: allProjects?.find(item=>item.value===v.projectId)?.label, value: Number(v.count) })), |
|
|
|
{ name: '其它', value: res.payload.data&&res.payload.data.length>3?res.payload.data?.slice(3)?.reduce((p,c)=>{ |
|
|
|
return p+Number(c.count) |
|
|
|
},0):0 }]) |
|
|
|
} |
|
|
|
}) |
|
|
|
dispatch(actions.projectGroup.getProjectWorkOrders({projectIds:query})).then(res=>{ |
|
|
|
dispatch(actions.projectGroup.getWorkOrdersRepairRank({projectIds:query})).then(res=>{ |
|
|
|
if(res.success){ |
|
|
|
setGroupProject(res.payload.data?.slice(0, 10).map(v => ({name:v.formname,duration:v?.endTime.diff(v?.startTime,'hours') })) || []) |
|
|
|
setGroupProject(res.payload.data?.slice(0, 10).map(v => ({name:v.formname,duration:moment(v?.endTime).diff(v?.startTime,'hours') })) || []) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
},[groupDetail]) |
|
|
|
},[groupDetail,allProjects]) |
|
|
|
|
|
|
|
let statisticOnline = (groupId) => { |
|
|
|
dispatch(actions.projectGroup.groupStatisticOnline({ groupId })).then(res => { |
|
|
@ -502,12 +506,16 @@ console.log('xxx1',actions) |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { auth, global, groupStatisticOnline } = state; |
|
|
|
|
|
|
|
const { auth, global, groupStatisticOnline,pomsProjectBasicAll } = state; |
|
|
|
console.log('global1',global) |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
|
actions: global.actions, |
|
|
|
clientHeight: global.clientHeight, |
|
|
|
groupStatisticOnline: groupStatisticOnline?.data |
|
|
|
groupStatisticOnline: groupStatisticOnline?.data, |
|
|
|
pomsProjectBasicAll: pomsProjectBasicAll.data || [], |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|