fix(map): 修复接口返回数据空值处理,防止异常崩溃
- 所有异步接口获取的数据添加空值判断或默认空数组/空对象处理 - 修正部分状态赋值,避免因数据缺失导致报错 - 调整地图分公司信息逻辑,防止空值访问异常 - 统一视频播放地址获取时的空值赋默认值 - 优化部分组件初始化时对接口数据的安全调用代码master
parent
85885a7d8f
commit
b9ad0d8d44
|
|
@ -17,8 +17,9 @@ function VideoPatrolPanel(props) {
|
|||
const { data, success } = await props.getFixedCameraPlayUrl({
|
||||
indexCode: cameraNumber,
|
||||
});
|
||||
if (success && data)
|
||||
setPlayUrl(data || "");
|
||||
const videoUrl = data || "";
|
||||
if (success)
|
||||
setPlayUrl(videoUrl);
|
||||
};
|
||||
const selectCorp = (item) => {
|
||||
setActive(item.corpinfoName);
|
||||
|
|
@ -36,9 +37,10 @@ function VideoPatrolPanel(props) {
|
|||
useEffect(() => {
|
||||
const loadVideoList = async () => {
|
||||
const { data } = await props.getFixedCameraVideoList();
|
||||
setList(data || []);
|
||||
if (data?.length) {
|
||||
selectCorp(data[0]);
|
||||
const videoList = data || [];
|
||||
setList(videoList);
|
||||
if (videoList.length) {
|
||||
selectCorp(videoList[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ function WeatherPanel(props) {
|
|||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const { result = {} } = await props.getWeather();
|
||||
const { result } = await props.getWeather();
|
||||
const weatherResult = result || {};
|
||||
setWeather({
|
||||
...result.now,
|
||||
alertTitle: result.alerts?.[0]?.title || "当前暂无气象预警",
|
||||
...weatherResult.now,
|
||||
alertTitle: weatherResult.alerts?.[0]?.title || "当前暂无气象预警",
|
||||
});
|
||||
|
||||
const { data } = await props.getEventReportListUnfinished({
|
||||
|
|
|
|||
|
|
@ -33,18 +33,20 @@ function WorkPanel(props) {
|
|||
props.getEightWorkInfoDangerWorkStatistics(),
|
||||
props.getKeyProjectLargeScreenStatistics(),
|
||||
]);
|
||||
const eightWorkStatistics = eightWorkData || {};
|
||||
const keyProjectStatistics = keyProjectData || {};
|
||||
setData((prevState) => {
|
||||
prevState[1].doingCount = eightWorkData?.doingCount;
|
||||
prevState[1].appliedCount = eightWorkData?.appliedCount;
|
||||
prevState[1].doingCount = eightWorkStatistics.doingCount;
|
||||
prevState[1].appliedCount = eightWorkStatistics.appliedCount;
|
||||
|
||||
prevState[0].doingCount = keyProjectData?.morePeopleStartCount;
|
||||
prevState[0].appliedCount = keyProjectData?.morePeopleApplyCount;
|
||||
prevState[0].doingCount = keyProjectStatistics.morePeopleStartCount;
|
||||
prevState[0].appliedCount = keyProjectStatistics.morePeopleApplyCount;
|
||||
|
||||
prevState[2].doingCount = keyProjectData?.fourNewHomeworkStartCount;
|
||||
prevState[2].appliedCount = keyProjectData?.fourNewHomeworkApplyCount;
|
||||
prevState[2].doingCount = keyProjectStatistics.fourNewHomeworkStartCount;
|
||||
prevState[2].appliedCount = keyProjectStatistics.fourNewHomeworkApplyCount;
|
||||
|
||||
prevState[3].doingCount = keyProjectData?.nightWorkStartCount;
|
||||
prevState[3].appliedCount = keyProjectData?.nightWorkApplyCount;
|
||||
prevState[3].doingCount = keyProjectStatistics.nightWorkStartCount;
|
||||
prevState[3].appliedCount = keyProjectStatistics.nightWorkApplyCount;
|
||||
|
||||
return [...prevState];
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ function VideoItem({ cameraNumber, videoName, getFixedCameraPlayUrl }) {
|
|||
setLoading(true);
|
||||
setPlayUrl("");
|
||||
const { data, success } = await getFixedCameraPlayUrl({ indexCode: cameraNumber });
|
||||
const videoUrl = data || "";
|
||||
if (!isUnmounted && success)
|
||||
setPlayUrl(data || "");
|
||||
setPlayUrl(videoUrl);
|
||||
|
||||
if (!isUnmounted)
|
||||
setLoading(false);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ function Camera(props) {
|
|||
pageSize: 99,
|
||||
}),
|
||||
]);
|
||||
setLevelList(dictionaryData);
|
||||
setLevelList(dictionaryData || []);
|
||||
setVideoList(data || []);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ function DepartmentResponsibilityPanel(props) {
|
|||
useMount(() => {
|
||||
const loadData = async () => {
|
||||
const { data } = await props.getDepartmentDuty({ portArea, corpinfoId: currentBranchOffice });
|
||||
initEcharts(data);
|
||||
initEcharts(data || []);
|
||||
};
|
||||
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function RiskHazardPanel(props) {
|
|||
const loadData = async () => {
|
||||
const { data } = await props.getRiskPointHidden({ portArea, corpinfoId: currentBranchOffice });
|
||||
|
||||
setData(data);
|
||||
setData(data || []);
|
||||
};
|
||||
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ function WeatherPreventionPanel(props) {
|
|||
await props.getWeather(),
|
||||
await props.getPersonStatistics({ portArea, corpinfoId: currentBranchOffice }),
|
||||
]);
|
||||
setWeather(result.now || {});
|
||||
setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
|
||||
const weatherResult = result || {};
|
||||
setWeather(weatherResult.now || {});
|
||||
setAlerts(Array.isArray(weatherResult.alerts) ? weatherResult.alerts : []);
|
||||
setData(statistics.map(item => ({ ...item, value: (data || {})[item.key] || 0 })));
|
||||
};
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ function VideoPatrolPanel(props) {
|
|||
const { data, success } = await props.getFixedCameraPlayUrl({
|
||||
indexCode: video.cameraNumber,
|
||||
});
|
||||
const videoUrl = data || "";
|
||||
if (success)
|
||||
setPlayUrl(data || "");
|
||||
setPlayUrl(videoUrl);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ function EntryExitTrendPanel(props) {
|
|||
mkmjLevel: "2",
|
||||
mkmjType,
|
||||
});
|
||||
initEcharts(data);
|
||||
initEcharts(data || []);
|
||||
};
|
||||
|
||||
useMount(() => {
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@ function WeatherPreventionPanel(props) {
|
|||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const { result = {} } = await props.getWeather();
|
||||
setWeather(result.now || {});
|
||||
setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
|
||||
const { result } = await props.getWeather();
|
||||
const weatherResult = result || {};
|
||||
setWeather(weatherResult.now || {});
|
||||
setAlerts(Array.isArray(weatherResult.alerts) ? weatherResult.alerts : []);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function DepartmentWorkPanel(props) {
|
|||
pageIndex: 1,
|
||||
pageSize: 99,
|
||||
});
|
||||
setData(data);
|
||||
setData(data || []);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ function FireDeviceStatusPanel(props) {
|
|||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
const deviceStatus = data || {};
|
||||
setData({
|
||||
totalCount: data?.totalCount || 0,
|
||||
statusList: data?.statusList || [],
|
||||
totalCount: deviceStatus.totalCount || 0,
|
||||
statusList: deviceStatus.statusList || [],
|
||||
});
|
||||
};
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function FireInspectionRecordPanel(props) {
|
|||
pageIndex: 1,
|
||||
pageSize: 99,
|
||||
});
|
||||
setData(data);
|
||||
setData(data || []);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ function VolunteerFireTeamPanel(props) {
|
|||
pageSize: 99,
|
||||
teamType: "volunteer_rescue",
|
||||
});
|
||||
console.log(data);
|
||||
setData(data || []);
|
||||
};
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ function ProjectStatsPanel(props) {
|
|||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
const projectStatistics = data || {};
|
||||
setData([
|
||||
{ ...defaultStatistics[0], value: data?.totalProjectCount },
|
||||
{ ...defaultStatistics[1], value: data?.waitStartCount },
|
||||
{ ...defaultStatistics[2], value: data?.startCount },
|
||||
{ ...defaultStatistics[0], value: projectStatistics.totalProjectCount },
|
||||
{ ...defaultStatistics[1], value: projectStatistics.waitStartCount },
|
||||
{ ...defaultStatistics[2], value: projectStatistics.startCount },
|
||||
]);
|
||||
};
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const AlarmEquipment = (props) => {
|
|||
const getData = async () => {
|
||||
const { data } = await props.sensorDeviceInfo({ id: props.id });
|
||||
|
||||
setInfo(data);
|
||||
setInfo(data || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function BlindBoardWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function BreakGroundWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ function ConfinedSpaceWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
const { data: supplementaryInfo } = await props.eightWorkSupplementaryInfo({
|
||||
eqWorkId: props.workId,
|
||||
pageSize: 999,
|
||||
pageIndex: 1,
|
||||
});
|
||||
setGasMonitoringRecord(supplementaryInfo.filter(item => item.type === "gas"));
|
||||
setGasMonitoringRecord((supplementaryInfo || []).filter(item => item.type === "gas"));
|
||||
const { data: measuresLogs } = await props.eightworkMeasuresLogs({ workId: props.workId });
|
||||
setSafetyMeasures(measuresLogs.filter(item => item.type === 1));
|
||||
setOtherSafetyMeasures(measuresLogs.filter(item => item.type === 2));
|
||||
setSafetyMeasures((measuresLogs || []).filter(item => item.type === 1));
|
||||
setOtherSafetyMeasures((measuresLogs || []).filter(item => item.type === 2));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function CutRoadWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@ const DoorCamera = (props) => {
|
|||
const { data, success } = await props.getFixedCameraPlayUrl({
|
||||
indexCode: cameraNumber,
|
||||
});
|
||||
if (success && data)
|
||||
setPlayUrl(data || "");
|
||||
const videoUrl = data || "";
|
||||
if (success)
|
||||
setPlayUrl(videoUrl);
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
const { data } = await props.firstLevelDoorInfoCameraInfo({ id: props.id });
|
||||
setInfo(data);
|
||||
loadPlayUrl(data.videoResourceCode);
|
||||
const cameraInfo = data || {};
|
||||
setInfo(cameraInfo);
|
||||
loadPlayUrl(cameraInfo.videoResourceCode);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const Doorway = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.firstLevelDoorInfoInfo({ id: props.id });
|
||||
setInfo(data);
|
||||
setInfo(data || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ function ElectricityWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
const { data: supplementaryInfo } = await props.eightWorkSupplementaryInfo({
|
||||
eqWorkId: props.workId,
|
||||
pageSize: 999,
|
||||
pageIndex: 1,
|
||||
});
|
||||
setGasMonitoringRecord(supplementaryInfo.filter(item => item.type === "gas"));
|
||||
setGasMonitoringRecord((supplementaryInfo || []).filter(item => item.type === "gas"));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -17,17 +17,18 @@ const FireControlRoom = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.fireControlRoomInfo({ id: props.id });
|
||||
const roomInfo = data || {};
|
||||
const dictionaryData = await getDictionary({ dictValue: "fire_resource_contro_root_type" });
|
||||
const files = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM[302],
|
||||
eqForeignKey: data.roomId,
|
||||
eqForeignKey: roomInfo.roomId,
|
||||
});
|
||||
setInfo({
|
||||
...data,
|
||||
...roomInfo,
|
||||
roomImages: files,
|
||||
roomStatusName: getLabelName({
|
||||
list: dictionaryData,
|
||||
status: data.roomStatus,
|
||||
status: roomInfo.roomStatus,
|
||||
idKey: "dictValue",
|
||||
nameKey: "dictLabel",
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const FirePointLocation = (props) => {
|
|||
const getData = async () => {
|
||||
const { data } = await props.firePointInfo({ id: props.id });
|
||||
|
||||
setInfo(data);
|
||||
setInfo(data || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -17,17 +17,18 @@ const FirePumpRoom = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.firePumpRoomInfo({ id: props.id });
|
||||
const pumpRoomInfo = data || {};
|
||||
const dictionaryData = await getDictionary({ dictValue: "fire_resource_contro_root_type" });
|
||||
const files = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM[302],
|
||||
eqForeignKey: data.pumpRoomId,
|
||||
eqForeignKey: pumpRoomInfo.pumpRoomId,
|
||||
});
|
||||
setInfo({
|
||||
...data,
|
||||
...pumpRoomInfo,
|
||||
roomImages: files,
|
||||
pumpStatusName: getLabelName({
|
||||
list: dictionaryData,
|
||||
status: data.pumpRoomStatus,
|
||||
status: pumpRoomInfo.pumpRoomStatus,
|
||||
idKey: "dictValue",
|
||||
nameKey: "dictLabel",
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const FireRescueTeam = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.fireRescueTeamInfo({ id: props.id });
|
||||
setInfo(data);
|
||||
setInfo(data || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ const FireWaterSource = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.fireWaterSourceInfo({ id: props.id });
|
||||
const waterSourceInfo = data || {};
|
||||
const dictionaryData = await getDictionary({ dictValue: "fire_resource_water_type" });
|
||||
|
||||
setInfo({
|
||||
...data,
|
||||
...waterSourceInfo,
|
||||
waterSourceStatusName: getLabelName({
|
||||
list: dictionaryData,
|
||||
status: data.waterSourceStatus,
|
||||
status: waterSourceInfo.waterSourceStatus,
|
||||
idKey: "dictValue",
|
||||
nameKey: "dictLabel",
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const Gate = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.firstLevelDoorInfoFareGateInfo({ id: props.id });
|
||||
setInfo(data);
|
||||
setInfo(data || {});
|
||||
};
|
||||
useEffect(() => {
|
||||
getData();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function HighWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function HoistingWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ function HotWork(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data: basicInfo } = await props.eightWorkInfo({ id: props.id });
|
||||
setInfo(basicInfo);
|
||||
setInfo(basicInfo || {});
|
||||
const { data: supplementaryInfo } = await props.eightWorkSupplementaryInfo({
|
||||
eqWorkId: props.workId,
|
||||
pageSize: 999,
|
||||
pageIndex: 1,
|
||||
});
|
||||
setDelayedMonitoringRecord(supplementaryInfo.filter(item => item.type === "delay"));
|
||||
setGasMonitoringRecord(supplementaryInfo.filter(item => item.type === "gas"));
|
||||
setDelayedMonitoringRecord((supplementaryInfo || []).filter(item => item.type === "delay"));
|
||||
setGasMonitoringRecord((supplementaryInfo || []).filter(item => item.type === "gas"));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -55,14 +55,15 @@ const KeyProject = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.keyProjectInfo({ id: props.id });
|
||||
const projectInfo = data || {};
|
||||
|
||||
const files = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["168"],
|
||||
eqForeignKey: data.keyProjectId,
|
||||
eqForeignKey: projectInfo.keyProjectId,
|
||||
});
|
||||
setInfo({
|
||||
files,
|
||||
...data,
|
||||
...projectInfo,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ const VideoPlay = (props) => {
|
|||
|
||||
const getData = async () => {
|
||||
const { data, success } = await props.getFixedCameraPlayUrl({ indexCode: props.cameraNumber });
|
||||
if (success && data)
|
||||
setPlayUrl(data);
|
||||
const videoUrl = data || "";
|
||||
if (success)
|
||||
setPlayUrl(videoUrl);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ function SafetyMeasures(props) {
|
|||
|
||||
const getData = async () => {
|
||||
const { data } = await props.eightWorkMeasuresLogs({ workId: props.workId });
|
||||
setSafetyMeasures(data.filter(item => item.type === 1));
|
||||
setOtherSafetyMeasures(data.filter(item => item.type === 2));
|
||||
const measuresLogs = data || [];
|
||||
setSafetyMeasures(measuresLogs.filter(item => item.type === 1));
|
||||
setOtherSafetyMeasures(measuresLogs.filter(item => item.type === 2));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ function BasicInfoPanel(props) {
|
|||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const { data } = await props.getCorpInfoCorpUserSummary({ portArea });
|
||||
const summary = data || {};
|
||||
const counts = [
|
||||
data?.branchCorpCount,
|
||||
data?.relatedCorpCount,
|
||||
data?.userCount,
|
||||
summary.branchCorpCount,
|
||||
summary.relatedCorpCount,
|
||||
summary.userCount,
|
||||
];
|
||||
|
||||
setData(
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ function EntryExitTrendPanel(props) {
|
|||
useMount(() => {
|
||||
const loadData = async () => {
|
||||
const { data } = await props.getScreenMkmjRecord({ portArea, mkmjLevel: "1" });
|
||||
initEcharts(data);
|
||||
initEcharts(data || []);
|
||||
};
|
||||
|
||||
loadData();
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ function GateRecordPanel(props) {
|
|||
|
||||
const loadRecords = async (tabIndex) => {
|
||||
setRecords([]);
|
||||
const { data = [] } = await props.getScreenAccessRecord({
|
||||
const { data } = await props.getScreenAccessRecord({
|
||||
portArea,
|
||||
recordType: tabIndex + 1,
|
||||
});
|
||||
setRecords(data);
|
||||
setRecords(data || []);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function OnlineLocationInfoPanel(props) {
|
|||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const { data } = await props.getScreenPersonLocationList({ portArea });
|
||||
setData(data);
|
||||
setData(data || []);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@ function WorkStatusPanel(props) {
|
|||
const { data } = await props.getEightWorkInfoScreenStatusStatistics({
|
||||
portArea,
|
||||
});
|
||||
const workStatus = data || {};
|
||||
const counts = [
|
||||
data?.appliedCount,
|
||||
data?.approvingCount,
|
||||
data?.archivedCount,
|
||||
workStatus.appliedCount,
|
||||
workStatus.approvingCount,
|
||||
workStatus.archivedCount,
|
||||
];
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ function KeyProjectPanel(props) {
|
|||
const { data } = await props.getKeyProjectLargeScreenProjectStatistics({
|
||||
portArea,
|
||||
});
|
||||
const counts = [data?.totalProjectCount, data?.startCount];
|
||||
const projectStatistics = data || {};
|
||||
const counts = [projectStatistics.totalProjectCount, projectStatistics.startCount];
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function KeyWorkInfoPanel(props) {
|
|||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const { data } = await props.getScreenLargeScreenInfo({ portArea });
|
||||
setData(data);
|
||||
setData(data || []);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ function VideoLocationPanel(props) {
|
|||
const { data } = await props.getFixedCameraVideoLocationStat({
|
||||
portArea,
|
||||
});
|
||||
const counts = [data?.totalCount, data?.onlineCount, data?.offlineCount];
|
||||
const videoStatistics = data || {};
|
||||
const counts = [videoStatistics.totalCount, videoStatistics.onlineCount, videoStatistics.offlineCount];
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ function PeopleTrajectorySelect(props) {
|
|||
setQueryLoading(true);
|
||||
try {
|
||||
const { data } = await props.getPeopleTrajectory(params);
|
||||
const points = data?.points || [];
|
||||
const trajectoryData = data || {};
|
||||
const points = trajectoryData.points || [];
|
||||
if (points.length < 2) {
|
||||
mapMethods.current.removePeopleTrajectory();
|
||||
message.warning("该时间范围内没有可绘制的轨迹");
|
||||
|
|
|
|||
|
|
@ -84,23 +84,24 @@ function Map(props) {
|
|||
setTimeout(() => {
|
||||
if (window.sessionStorage.getItem("token")) {
|
||||
props.getCorpInfo().then(({ data }) => {
|
||||
if ([3, 4, 5].includes(data?.type)) {
|
||||
const corpInfo = data || {};
|
||||
if ([3, 4, 5].includes(corpInfo.type)) {
|
||||
// eslint-disable-next-line no-alert
|
||||
alert("您当前登录的账号没有权限访问此页面");
|
||||
closeWindow();
|
||||
}
|
||||
else if ([0, 1, 6].includes(data?.type)) {
|
||||
const id = data.id;
|
||||
const name = data.corpName;
|
||||
const longitude = data.longitude;
|
||||
const latitude = data.latitude;
|
||||
else if ([0, 1, 6].includes(corpInfo.type)) {
|
||||
const id = corpInfo.id;
|
||||
const name = corpInfo.corpName;
|
||||
const longitude = corpInfo.longitude;
|
||||
const latitude = corpInfo.latitude;
|
||||
|
||||
if (!id || !name || !longitude || !latitude)
|
||||
return message.warning("参数不完整,无法定位到对应分公司");
|
||||
|
||||
handlePortClick({ id: "00003" });
|
||||
handleBranchOfficeClick(data);
|
||||
mapMethods.current.addBranchOfficePoint(undefined, data);
|
||||
handleBranchOfficeClick(corpInfo);
|
||||
mapMethods.current.addBranchOfficePoint(undefined, corpInfo);
|
||||
mapMethods.current.flyTo({ longitude, latitude, height: 2000 });
|
||||
sessionStorage.setItem("mapCurrentBranchOfficeId", id);
|
||||
setIsBranchCompanyUser(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue