refactor(data): 统一变量命名并优化异步加载函数名

- 将多个组件中的状态变量统一命名为data,替代原有的records、statistics、list等命名
- 将异步加载函数名统一修改为loadData,提高代码一致性和可读性
- 修改相关组件渲染部分变量引用,确保渲染数据源正确
- 优化useEffect及useMount中异步函数调用名称,增强代码规范性
- 涉及组件包括branchOffice、IndexInfo、port等多个子模块,全面提升代码风格统一性
master
LiuJiaNan 2026-07-23 15:34:57 +08:00
parent 7b2f826b63
commit 97792143b0
29 changed files with 146 additions and 146 deletions

View File

@ -9,14 +9,14 @@ import "./index.less";
/** 负责查询并展示相关方单位备案和项目执行统计。 */ /** 负责查询并展示相关方单位备案和项目执行统计。 */
function RecordStatsPanel(props) { function RecordStatsPanel(props) {
const [list, setList] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadList = async () => { const loadData = async () => {
const { data = [] } = await props.getXgfStatisticsListRecordProjectStatistics(); const { data = [] } = await props.getXgfStatisticsListRecordProjectStatistics();
setList(data); setData(data);
}; };
loadList(); loadData();
}, []); }, []);
return ( return (
<Panel <Panel
@ -36,8 +36,8 @@ function RecordStatsPanel(props) {
<div>人员培训情况统计</div> <div>人员培训情况统计</div>
</div> </div>
<div className="index-info-record-stats__body"> <div className="index-info-record-stats__body">
<SeamlessScroll list={list} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{list.map((item, index) => ( {data.map((item, index) => (
<div className="index-info-record-stats__row" key={index}> <div className="index-info-record-stats__row" key={index}>
<div>{item.qualificationsTypeName}</div> <div>{item.qualificationsTypeName}</div>
<div>{item.managerDeptName}</div> <div>{item.managerDeptName}</div>

View File

@ -10,17 +10,17 @@ import "./index.less";
/** 负责查询并展示各公司隐患整改统计。 */ /** 负责查询并展示各公司隐患整改统计。 */
function RectificationPanel(props) { function RectificationPanel(props) {
const [list, setList] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadList = async () => { const loadData = async () => {
const { data = [] } = await props.getHiddenStatisticsByCorp({ const { data = [] } = await props.getHiddenStatisticsByCorp({
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setList(data); setData(data);
}; };
loadList(); loadData();
}, []); }, []);
return ( return (
<Panel <Panel
@ -40,8 +40,8 @@ function RectificationPanel(props) {
<div>待验收</div> <div>待验收</div>
</div> </div>
<div className="index-info-rectification__body"> <div className="index-info-rectification__body">
<SeamlessScroll list={list} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{list.map((item, index) => ( {data.map((item, index) => (
<div <div
className="index-info-rectification__row" className="index-info-rectification__row"
style={{ backgroundImage: `url(${tableRowBackground})` }} style={{ backgroundImage: `url(${tableRowBackground})` }}

View File

@ -136,12 +136,12 @@ function WorkStatusPanel(props) {
chartInstance.current.setOption(option); chartInstance.current.setOption(option);
}; };
useMount(() => { useMount(() => {
const loadChartData = async () => { const loadData = async () => {
const { data = [] } = await props.getProjectTaskScoreCount(); const { data = [] } = await props.getProjectTaskScoreCount();
initEcharts(chartRef, chartInstance, data); initEcharts(chartRef, chartInstance, data);
}; };
loadChartData(); loadData();
return () => chartInstance.current?.dispose(); return () => chartInstance.current?.dispose();
}); });

View File

@ -10,17 +10,17 @@ import "./index.less";
/** 负责查询并展示物联网设备报警记录。 */ /** 负责查询并展示物联网设备报警记录。 */
function AlarmPanel(props) { function AlarmPanel(props) {
const [list, setList] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadList = async () => { const loadData = async () => {
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({ const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setList(data); setData(data);
}; };
loadList(); loadData();
}, []); }, []);
return ( return (
<Panel title="物联网设备报警情况" className="index-info-right-panel__alarm"> <Panel title="物联网设备报警情况" className="index-info-right-panel__alarm">
@ -36,8 +36,8 @@ function AlarmPanel(props) {
<div>处置状态</div> <div>处置状态</div>
</div> </div>
<div className="index-info-alarm__body"> <div className="index-info-alarm__body">
<SeamlessScroll list={list} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{list.map((item, index) => ( {data.map((item, index) => (
<div <div
className="index-info-alarm__row" className="index-info-alarm__row"
style={{ backgroundImage: `url(${tableRowBackground})` }} style={{ backgroundImage: `url(${tableRowBackground})` }}

View File

@ -10,17 +10,17 @@ import "./index.less";
/** 负责加载并展示相关方单位的资质、项目与人员统计。 */ /** 负责加载并展示相关方单位的资质、项目与人员统计。 */
function PartnerPanel(props) { function PartnerPanel(props) {
const [list, setList] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadList = async () => { const loadData = async () => {
const { data = [] } = await props.getXgfStatisticsListCorpStatistics({ const { data = [] } = await props.getXgfStatisticsListCorpStatistics({
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setList(data); setData(data);
}; };
loadList(); loadData();
}, []); }, []);
return ( return (
<Panel <Panel
@ -39,8 +39,8 @@ function PartnerPanel(props) {
<div>执行人员情况</div> <div>执行人员情况</div>
</div> </div>
<div className="index-info-partner__body"> <div className="index-info-partner__body">
<SeamlessScroll list={list} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{list.map((item, index) => ( {data.map((item, index) => (
<div <div
className="index-info-partner__row" className="index-info-partner__row"
style={{ backgroundImage: `url(${tableRowBackground})` }} style={{ backgroundImage: `url(${tableRowBackground})` }}

View File

@ -11,7 +11,7 @@ import "./index.less";
/** 展示重点作业类型及危险作业接口返回的实时数量。 */ /** 展示重点作业类型及危险作业接口返回的实时数量。 */
function WorkPanel(props) { function WorkPanel(props) {
const [list, setList] = useState([ const [data, setData] = useState([
{ {
name: "三人以上作业", name: "三人以上作业",
doingCount: 0, doingCount: 0,
@ -28,12 +28,12 @@ function WorkPanel(props) {
{ name: "四新作业", doingCount: 0, appliedCount: 0, image: newWorkIcon }, { name: "四新作业", doingCount: 0, appliedCount: 0, image: newWorkIcon },
]); ]);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }] = await Promise.all([ const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }] = await Promise.all([
props.getEightWorkInfoDangerWorkStatistics(), props.getEightWorkInfoDangerWorkStatistics(),
props.getKeyProjectLargeScreenStatistics(), props.getKeyProjectLargeScreenStatistics(),
]); ]);
setList((prevState) => { setData((prevState) => {
prevState[1].doingCount = eightWorkData.doingCount; prevState[1].doingCount = eightWorkData.doingCount;
prevState[1].appliedCount = eightWorkData.appliedCount; prevState[1].appliedCount = eightWorkData.appliedCount;
@ -50,13 +50,13 @@ function WorkPanel(props) {
}); });
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="重点作业管理统计" className="index-info-right-panel__work"> <Panel title="重点作业管理统计" className="index-info-right-panel__work">
<Spin spinning={props.biStatistics.getEightWorkInfoDangerWorkStatisticsLoading || props.biStatistics.getKeyProjectLargeScreenStatisticsLoading}> <Spin spinning={props.biStatistics.getEightWorkInfoDangerWorkStatisticsLoading || props.biStatistics.getKeyProjectLargeScreenStatisticsLoading}>
<div className="index-info-work__list"> <div className="index-info-work__list">
{list.map(item => ( {data.map(item => (
<div className="index-info-work__item" key={item.name}> <div className="index-info-work__item" key={item.name}>
<img src={item.image} alt="" /> <img src={item.image} alt="" />
<div> <div>

View File

@ -28,12 +28,12 @@ function WeatherPreventionPanel(props) {
const [alerts, setAlerts] = useState([]); const [alerts, setAlerts] = useState([]);
useEffect(() => { useEffect(() => {
const loadWeather = async () => { const loadData = async () => {
const { result = {} } = await props.getWeather(); const { result = {} } = await props.getWeather();
setWeather(result.now || {}); setWeather(result.now || {});
setAlerts(Array.isArray(result.alerts) ? result.alerts : []); setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
}; };
loadWeather(); loadData();
}, []); }, []);
return ( return (

View File

@ -12,19 +12,19 @@ const disposalStatus = { 10: "报警中", 20: "未处置", 30: "已消警" };
/** 负责查询并滚动展示封闭区域告警。 */ /** 负责查询并滚动展示封闭区域告警。 */
function AreaAlarmPanel(props) { function AreaAlarmPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({ const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -43,8 +43,8 @@ function AreaAlarmPanel(props) {
props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading
} }
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div className="branch-office-area-alarm__row" key={index}> <div className="branch-office-area-alarm__row" key={index}>
<div>{item.fireRegionName}</div> <div>{item.fireRegionName}</div>
<div>{item.alarmTypeName}</div> <div>{item.alarmTypeName}</div>

View File

@ -10,10 +10,10 @@ import "./index.less";
/** 负责合并两类作业统计并展示部门维度数据。 */ /** 负责合并两类作业统计并展示部门维度数据。 */
function KeyWorkStatsPanel(props) { function KeyWorkStatsPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }] const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }]
= await Promise.all([ = await Promise.all([
props.getEightWorkInfoScreenDepartmentStatistics({ props.getEightWorkInfoScreenDepartmentStatistics({
@ -46,9 +46,9 @@ function KeyWorkStatsPanel(props) {
department.eightWorkCount = item.workCount || 0; department.eightWorkCount = item.workCount || 0;
departmentMap.set(item.departmentId, department); departmentMap.set(item.departmentId, department);
}); });
setRecords([...departmentMap.values()]); setData([...departmentMap.values()]);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -73,8 +73,8 @@ function KeyWorkStatsPanel(props) {
.getEightWorkInfoScreenDepartmentStatisticsLoading .getEightWorkInfoScreenDepartmentStatisticsLoading
} }
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div <div
className="branch-office-key-work-stats__row" className="branch-office-key-work-stats__row"
key={index} key={index}

View File

@ -29,12 +29,12 @@ function WeatherPreventionPanel(props) {
const [alerts, setAlerts] = useState([]); const [alerts, setAlerts] = useState([]);
useEffect(() => { useEffect(() => {
const loadWeather = async () => { const loadData = async () => {
const { result = {} } = await props.getWeather(); const { result = {} } = await props.getWeather();
setWeather(result.now || {}); setWeather(result.now || {});
setAlerts(Array.isArray(result.alerts) ? result.alerts : []); setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
}; };
loadWeather(); loadData();
}, []); }, []);
return ( return (

View File

@ -10,17 +10,17 @@ import "./index.less";
/** 负责查询并展示危险作业类别、状态及参与人数统计。 */ /** 负责查询并展示危险作业类别、状态及参与人数统计。 */
function DangerWorkDataPanel(props) { function DangerWorkDataPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } const { data = [] }
= await props.getEightWorkInfoScreenDangerWorkDataStatistics({ = await props.getEightWorkInfoScreenDangerWorkDataStatistics({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
<Panel title="危险作业数据统计" className="branch-office-danger-work__data"> <Panel title="危险作业数据统计" className="branch-office-danger-work__data">
@ -39,8 +39,8 @@ function DangerWorkDataPanel(props) {
.getEightWorkInfoScreenDangerWorkDataStatisticsLoading .getEightWorkInfoScreenDangerWorkDataStatisticsLoading
} }
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div <div
key={index} key={index}
className="branch-office-danger-work-data__row" className="branch-office-danger-work-data__row"

View File

@ -10,9 +10,9 @@ import "./index.less";
/** 负责合并两类部门作业统计并展示部门维度数据。 */ /** 负责合并两类部门作业统计并展示部门维度数据。 */
function DepartmentWorkPanel(props) { function DepartmentWorkPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }] const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }]
= await Promise.all([ = await Promise.all([
props.getEightWorkInfoScreenDepartmentStatistics({ props.getEightWorkInfoScreenDepartmentStatistics({
@ -45,9 +45,9 @@ function DepartmentWorkPanel(props) {
department.eightWorkCount = item.workCount || 0; department.eightWorkCount = item.workCount || 0;
departmentMap.set(item.departmentId, department); departmentMap.set(item.departmentId, department);
}); });
setRecords([...departmentMap.values()]); setData([...departmentMap.values()]);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
<Panel <Panel
@ -71,8 +71,8 @@ function DepartmentWorkPanel(props) {
.getEightWorkInfoScreenDepartmentStatisticsLoading .getEightWorkInfoScreenDepartmentStatisticsLoading
} }
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div className="branch-office-department-work__row" key={index}> <div className="branch-office-department-work__row" key={index}>
<div>{item.departmentName}</div> <div>{item.departmentName}</div>
<div>{item.fourNewHomeworkCount}</div> <div>{item.fourNewHomeworkCount}</div>

View File

@ -51,9 +51,9 @@ const defaultStatistics = [
/** 负责查询并展示各重点作业的执行状态。 */ /** 负责查询并展示各重点作业的执行状态。 */
function KeyWorkPanel(props) { function KeyWorkPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }] const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }]
= await Promise.all([ = await Promise.all([
props.getEightWorkInfoDangerWorkStatistics({ props.getEightWorkInfoDangerWorkStatistics({
@ -65,7 +65,7 @@ function KeyWorkPanel(props) {
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}), }),
]); ]);
setStatistics([ setData([
{ {
...defaultStatistics[0], ...defaultStatistics[0],
currentCount: keyProjectData.fourNewHomeworkStartCount, currentCount: keyProjectData.fourNewHomeworkStartCount,
@ -86,7 +86,7 @@ function KeyWorkPanel(props) {
}, },
]); ]);
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="重点作业" className="branch-office-danger-work__key-work"> <Panel title="重点作业" className="branch-office-danger-work__key-work">
@ -97,7 +97,7 @@ function KeyWorkPanel(props) {
} }
> >
<div className="branch-office-key-work__list"> <div className="branch-office-key-work__list">
{statistics.map((item, index) => ( {data.map((item, index) => (
<div <div
key={index} key={index}
className="branch-office-key-work__item" className="branch-office-key-work__item"

View File

@ -24,10 +24,10 @@ const defaultStatistics = [
/** 负责查询并展示重点作业当前数量与申请数量。 */ /** 负责查询并展示重点作业当前数量与申请数量。 */
function KeyWorkStatsPanel(props) { function KeyWorkStatsPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }] const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }]
= await Promise.all([ = await Promise.all([
props.getEightWorkInfoDangerWorkStatistics({ props.getEightWorkInfoDangerWorkStatistics({
@ -39,7 +39,7 @@ function KeyWorkStatsPanel(props) {
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}), }),
]); ]);
setStatistics([ setData([
{ {
...defaultStatistics[0], ...defaultStatistics[0],
currentCount: keyProjectData.fourNewHomeworkStartCount, currentCount: keyProjectData.fourNewHomeworkStartCount,
@ -57,7 +57,7 @@ function KeyWorkStatsPanel(props) {
}, },
]); ]);
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
@ -69,7 +69,7 @@ function KeyWorkStatsPanel(props) {
} }
> >
<div className="branch-office-key-work-stats__list"> <div className="branch-office-key-work-stats__list">
{statistics.map(item => ( {data.map(item => (
<div <div
key={item.title} key={item.title}
className="branch-office-key-work-stats__item" className="branch-office-key-work-stats__item"

View File

@ -12,19 +12,19 @@ const disposalStatus = { 10: "报警中", 20: "未处置", 30: "已消警" };
/** 负责查询并滚动展示消防设备报警记录。 */ /** 负责查询并滚动展示消防设备报警记录。 */
function FireAlarmRecordPanel(props) { function FireAlarmRecordPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({ const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -44,8 +44,8 @@ function FireAlarmRecordPanel(props) {
props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading
} }
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div <div
className="branch-office-fire-alarm-record__row" className="branch-office-fire-alarm-record__row"
key={index} key={index}

View File

@ -10,23 +10,23 @@ import "./index.less";
/** 负责查询并展示消防设备总数及各状态数量。 */ /** 负责查询并展示消防设备总数及各状态数量。 */
function FireDeviceStatusPanel(props) { function FireDeviceStatusPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [statistics, setStatistics] = useState({ const [data, setData] = useState({
totalCount: 0, totalCount: 0,
statusList: [], statusList: [],
}); });
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getSensorDeviceFireSituation({ const { data = {} } = await props.getSensorDeviceFireSituation({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}); });
setStatistics({ setData({
totalCount: data.totalCount || 0, totalCount: data.totalCount || 0,
statusList: data.statusList || [], statusList: data.statusList || [],
}); });
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
@ -42,12 +42,12 @@ function FireDeviceStatusPanel(props) {
</div> </div>
<div className="branch-office-fire-device-status__total"> <div className="branch-office-fire-device-status__total">
<span>设备总数</span> <span>设备总数</span>
<strong>{statistics.totalCount}</strong> <strong>{data.totalCount}</strong>
</div> </div>
</div> </div>
</div> </div>
<div className="branch-office-fire-device-status__list"> <div className="branch-office-fire-device-status__list">
{statistics.statusList.map(item => ( {data.statusList.map(item => (
<div <div
className={`branch-office-fire-device-status__item branch-office-fire-device-status__item--${item.bianma.toLocaleLowerCase()}`} className={`branch-office-fire-device-status__item branch-office-fire-device-status__item--${item.bianma.toLocaleLowerCase()}`}
key={item.bianma} key={item.bianma}

View File

@ -10,19 +10,19 @@ import "./index.less";
/** 负责展示企业志愿消防队伍本地信息。 */ /** 负责展示企业志愿消防队伍本地信息。 */
function VolunteerFireTeamPanel(props) { function VolunteerFireTeamPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } = await props.getFireBrigadeMemberScreenList({ const { data = [] } = await props.getFireBrigadeMemberScreenList({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -40,8 +40,8 @@ function VolunteerFireTeamPanel(props) {
</div> </div>
<div className="branch-office-volunteer-fire-team__body"> <div className="branch-office-volunteer-fire-team__body">
<Spin spinning={props.biStatistics.getFireBrigadeMemberScreenListLoading}> <Spin spinning={props.biStatistics.getFireBrigadeMemberScreenListLoading}>
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div <div
className="branch-office-volunteer-fire-team__row" className="branch-office-volunteer-fire-team__row"
key={index} key={index}

View File

@ -158,7 +158,7 @@ function ContractProjectPanel(props) {
}; };
useMount(() => { useMount(() => {
const loadContractProjects = async () => { const loadData = async () => {
const { data = [] } = await props.getProjectContractProjectStatistics({ const { data = [] } = await props.getProjectContractProjectStatistics({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
@ -167,7 +167,7 @@ function ContractProjectPanel(props) {
}); });
initEcharts(chartRef, chartInstance, data); initEcharts(chartRef, chartInstance, data);
}; };
loadContractProjects(); loadData();
return () => { return () => {
if (chartInstance.current) { if (chartInstance.current) {

View File

@ -10,17 +10,17 @@ import "./index.less";
/** 负责查询并滚动展示项目检查、隐患和处罚数据。 */ /** 负责查询并滚动展示项目检查、隐患和处罚数据。 */
function ProjectProgressPanel(props) { function ProjectProgressPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } = await props.getKeyProjectLargeScreenProjectProgress({ const { data = [] } = await props.getKeyProjectLargeScreenProjectProgress({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -38,8 +38,8 @@ function ProjectProgressPanel(props) {
<Spin <Spin
spinning={props.biStatistics.getKeyProjectLargeScreenProjectProgressLoading} spinning={props.biStatistics.getKeyProjectLargeScreenProjectProgressLoading}
> >
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div <div
className="branch-office-project-progress__row" className="branch-office-project-progress__row"
key={index} key={index}

View File

@ -17,21 +17,21 @@ const defaultStatistics = [
/** 负责查询并展示分公司项目总量及开工状态。 */ /** 负责查询并展示分公司项目总量及开工状态。 */
function ProjectStatsPanel(props) { function ProjectStatsPanel(props) {
const { portArea, currentBranchOffice } = useContext(Context); const { portArea, currentBranchOffice } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getProjectVisualProjectStatistics({ const { data = {} } = await props.getProjectVisualProjectStatistics({
portArea, portArea,
corpinfoId: currentBranchOffice, corpinfoId: currentBranchOffice,
}); });
setStatistics([ setData([
{ ...defaultStatistics[0], value: data.totalProjectCount }, { ...defaultStatistics[0], value: data.totalProjectCount },
{ ...defaultStatistics[1], value: data.pendingProjectCount }, { ...defaultStatistics[1], value: data.pendingProjectCount },
{ ...defaultStatistics[2], value: data.executingProjectCount }, { ...defaultStatistics[2], value: data.executingProjectCount },
]); ]);
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
@ -39,7 +39,7 @@ function ProjectStatsPanel(props) {
<Spin spinning={props.biStatistics.getProjectVisualProjectStatisticsLoading}> <Spin spinning={props.biStatistics.getProjectVisualProjectStatisticsLoading}>
<div className="branch-office-project-stats__content"> <div className="branch-office-project-stats__content">
<div className="branch-office-project-stats__list"> <div className="branch-office-project-stats__list">
{statistics.map(item => ( {data.map(item => (
<div <div
className="branch-office-project-stats__item" className="branch-office-project-stats__item"
key={item.label} key={item.label}

View File

@ -20,10 +20,10 @@ const defaultStatistics = [
/** 负责查询并展示港区单位、相关方及员工基础统计。 */ /** 负责查询并展示港区单位、相关方及员工基础统计。 */
function BasicInfoPanel(props) { function BasicInfoPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getCorpInfoCorpUserSummary({ portArea }); const { data = {} } = await props.getCorpInfoCorpUserSummary({ portArea });
const counts = [ const counts = [
data.branchCorpCount, data.branchCorpCount,
@ -31,7 +31,7 @@ function BasicInfoPanel(props) {
data.userCount, data.userCount,
]; ];
setStatistics( setData(
defaultStatistics.map((item, index) => ({ defaultStatistics.map((item, index) => ({
...item, ...item,
count: counts[index], count: counts[index],
@ -39,14 +39,14 @@ function BasicInfoPanel(props) {
); );
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="单位基础信息"> <Panel title="单位基础信息">
<Spin spinning={props.biStatistics.getCorpInfoCorpUserSummaryLoading}> <Spin spinning={props.biStatistics.getCorpInfoCorpUserSummaryLoading}>
<div className="port-basic-info__options"> <div className="port-basic-info__options">
{statistics.map(item => ( {data.map(item => (
<div key={item.label} className="port-basic-info__option"> <div key={item.label} className="port-basic-info__option">
<img <img
src={item.image} src={item.image}

View File

@ -15,10 +15,10 @@ const tabs = ["分公司统计", "相关方单位统计"];
function PersonnelStatsPanel(props) { function PersonnelStatsPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [activeTab, setActiveTab] = useState(0); const [activeTab, setActiveTab] = useState(0);
const [statistics, setStatistics] = useState([]); const [data, setData] = useState([]);
const [isVisible, setIsVisible] = useState(false); const [isVisible, setIsVisible] = useState(false);
const loadStatistics = async (enterpriseType) => { const loadData = async (enterpriseType) => {
setIsVisible(false); setIsVisible(false);
const { data = [] } = await props.getCorpInfoCorpUserStatisticPage({ const { data = [] } = await props.getCorpInfoCorpUserStatisticPage({
portArea, portArea,
@ -26,7 +26,7 @@ function PersonnelStatsPanel(props) {
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setStatistics(data); setData(data);
setIsVisible(true); setIsVisible(true);
}; };
@ -35,11 +35,11 @@ function PersonnelStatsPanel(props) {
return; return;
setActiveTab(index); setActiveTab(index);
loadStatistics(index === 0 ? 2 : 3); loadData(index === 0 ? 2 : 3);
}; };
useEffect(() => { useEffect(() => {
loadStatistics(2); loadData(2);
}, []); }, []);
return ( return (
@ -68,8 +68,8 @@ function PersonnelStatsPanel(props) {
<div className="port-personnel-stats__table-body"> <div className="port-personnel-stats__table-body">
<Spin spinning={props.biStatistics.getCorpInfoCorpUserStatisticPageLoading}> <Spin spinning={props.biStatistics.getCorpInfoCorpUserStatisticPageLoading}>
{isVisible && ( {isVisible && (
<SeamlessScroll list={statistics} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{statistics.map((item, index) => ( {data.map((item, index) => (
<div key={index} className="port-personnel-stats__row"> <div key={index} className="port-personnel-stats__row">
<div className="port-personnel-stats__cell"> <div className="port-personnel-stats__cell">
{item.corpName} {item.corpName}

View File

@ -47,16 +47,16 @@ const defaultStatistics = [
/** 负责查询并展示不同风险等级的风险点数量。 */ /** 负责查询并展示不同风险等级的风险点数量。 */
function RiskStatsPanel(props) { function RiskStatsPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = [] } = await props.getRiskPointCorpRiskLevel({ portArea }); const { data = [] } = await props.getRiskPointCorpRiskLevel({ portArea });
const countByLevel = Object.fromEntries( const countByLevel = Object.fromEntries(
data.map(item => [item.level, item.count]), data.map(item => [item.level, item.count]),
); );
setStatistics( setData(
defaultStatistics.map(item => ({ defaultStatistics.map(item => ({
...item, ...item,
count: countByLevel[item.level] || 0, count: countByLevel[item.level] || 0,
@ -64,14 +64,14 @@ function RiskStatsPanel(props) {
); );
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="风险区域统计" className="port-index__risk-stats"> <Panel title="风险区域统计" className="port-index__risk-stats">
<Spin spinning={props.biStatistics.getRiskPointCorpRiskLevelLoading}> <Spin spinning={props.biStatistics.getRiskPointCorpRiskLevelLoading}>
<div className="port-risk-stats__options"> <div className="port-risk-stats__options">
{statistics.map(item => ( {data.map(item => (
<div key={item.level} className="port-risk-stats__option"> <div key={item.level} className="port-risk-stats__option">
<img <img
src={item.image} src={item.image}

View File

@ -12,19 +12,19 @@ const rankStyleNames = ["first", "second", "third"];
/** 负责查询并展示危险作业记录及其排行样式。 */ /** 负责查询并展示危险作业记录及其排行样式。 */
function WorkRecordPanel(props) { function WorkRecordPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [records, setRecords] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
const loadRecords = async () => { const loadData = async () => {
const { data = [] } = await props.getEightWorkInfoScreenWorkRecord({ const { data = [] } = await props.getEightWorkInfoScreenWorkRecord({
portArea, portArea,
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setRecords(data); setData(data);
}; };
loadRecords(); loadData();
}, []); }, []);
return ( return (
@ -39,8 +39,8 @@ function WorkRecordPanel(props) {
</div> </div>
<div className="port-danger-work-record__table-body"> <div className="port-danger-work-record__table-body">
<Spin spinning={props.biStatistics.getEightWorkInfoScreenWorkRecordLoading}> <Spin spinning={props.biStatistics.getEightWorkInfoScreenWorkRecordLoading}>
<SeamlessScroll list={records} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{records.map((item, index) => ( {data.map((item, index) => (
<div key={index} className="port-danger-work-record__row"> <div key={index} className="port-danger-work-record__row">
<div className="port-danger-work-record__cell"> <div className="port-danger-work-record__cell">
<div <div

View File

@ -21,10 +21,10 @@ const defaultStatistics = [
/** 负责查询并展示危险作业申请、审批和归档状态统计。 */ /** 负责查询并展示危险作业申请、审批和归档状态统计。 */
function WorkStatusPanel(props) { function WorkStatusPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getEightWorkInfoScreenStatusStatistics({ const { data = {} } = await props.getEightWorkInfoScreenStatusStatistics({
portArea, portArea,
}); });
@ -33,7 +33,7 @@ function WorkStatusPanel(props) {
data.approvingCount, data.approvingCount,
data.archivedCount, data.archivedCount,
]; ];
setStatistics( setData(
defaultStatistics.map((item, index) => ({ defaultStatistics.map((item, index) => ({
...item, ...item,
count: counts[index], count: counts[index],
@ -41,14 +41,14 @@ function WorkStatusPanel(props) {
); );
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="安全作业状态统计"> <Panel title="安全作业状态统计">
<Spin spinning={props.biStatistics.getEightWorkInfoScreenStatusStatisticsLoading}> <Spin spinning={props.biStatistics.getEightWorkInfoScreenStatusStatisticsLoading}>
<div className="port-danger-work-status__options"> <div className="port-danger-work-status__options">
{statistics.map(item => ( {data.map(item => (
<div key={item.label} className="port-danger-work-status__option"> <div key={item.label} className="port-danger-work-status__option">
<div <div
className="port-danger-work-status__icon" className="port-danger-work-status__icon"

View File

@ -114,14 +114,14 @@ function WorkTrendPanel(props) {
}; };
useMount(() => { useMount(() => {
const loadTrendData = async () => { const loadData = async () => {
const { data = [] } = await props.getEightWorkInfoScreenWorkTrend({ const { data = [] } = await props.getEightWorkInfoScreenWorkTrend({
portArea, portArea,
}); });
initEcharts(chartRef, chartInstance, formatWorkTrendData(data)); initEcharts(chartRef, chartInstance, formatWorkTrendData(data));
}; };
loadTrendData(); loadData();
return () => chartInstance.current?.dispose(); return () => chartInstance.current?.dispose();
}); });

View File

@ -11,11 +11,11 @@ import "./index.less";
function FireDeviceListPanel(props) { function FireDeviceListPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const { queryParams } = props; const { queryParams } = props;
const [deviceList, setDeviceList] = useState([]); const [data, setData] = useState([]);
const [isVisible, setIsVisible] = useState(true); const [isVisible, setIsVisible] = useState(true);
useEffect(() => { useEffect(() => {
const loadDeviceList = async () => { const loadData = async () => {
setIsVisible(false); setIsVisible(false);
const { data = [] } = await props.getFirePointDeviceList({ const { data = [] } = await props.getFirePointDeviceList({
portArea, portArea,
@ -23,11 +23,11 @@ function FireDeviceListPanel(props) {
pageIndex: 1, pageIndex: 1,
pageSize: 9999, pageSize: 9999,
}); });
setDeviceList(data); setData(data);
setIsVisible(true); setIsVisible(true);
}; };
loadDeviceList(); loadData();
}, [queryParams]); }, [queryParams]);
return ( return (
@ -42,8 +42,8 @@ function FireDeviceListPanel(props) {
<div className="port-fire-device-list__table-body"> <div className="port-fire-device-list__table-body">
<Spin spinning={props.biStatistics.getFirePointDeviceListLoading}> <Spin spinning={props.biStatistics.getFirePointDeviceListLoading}>
{isVisible && ( {isVisible && (
<SeamlessScroll list={deviceList} step={0.5}> <SeamlessScroll list={data} step={0.5}>
{deviceList.map((item, index) => ( {data.map((item, index) => (
<div key={index} className="port-fire-device-list__row"> <div key={index} className="port-fire-device-list__row">
<div className="port-fire-device-list__cell"> <div className="port-fire-device-list__cell">
{item.firePointName} {item.firePointName}

View File

@ -19,15 +19,15 @@ const defaultStatistics = [
/** 负责查询并展示重点工程总量与开工数量。 */ /** 负责查询并展示重点工程总量与开工数量。 */
function KeyProjectPanel(props) { function KeyProjectPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getKeyProjectLargeScreenProjectStatistics({ const { data = {} } = await props.getKeyProjectLargeScreenProjectStatistics({
portArea, portArea,
}); });
const counts = [data.totalProjectCount, data.startCount]; const counts = [data.totalProjectCount, data.startCount];
setStatistics( setData(
defaultStatistics.map((item, index) => ({ defaultStatistics.map((item, index) => ({
...item, ...item,
count: counts[index], count: counts[index],
@ -35,14 +35,14 @@ function KeyProjectPanel(props) {
); );
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
<Panel title="重点工程" className="port-key-supervision__project"> <Panel title="重点工程" className="port-key-supervision__project">
<Spin spinning={props.biStatistics.getKeyProjectLargeScreenProjectStatisticsLoading}> <Spin spinning={props.biStatistics.getKeyProjectLargeScreenProjectStatisticsLoading}>
<div className="port-key-project__options"> <div className="port-key-project__options">
{statistics.map(item => ( {data.map(item => (
<div key={item.label} className="port-key-project__option"> <div key={item.label} className="port-key-project__option">
<div <div
className="port-key-project__icon" className="port-key-project__icon"

View File

@ -17,15 +17,15 @@ const defaultStatistics = [
/** 负责查询并展示摄像头总数、在线与离线统计。 */ /** 负责查询并展示摄像头总数、在线与离线统计。 */
function VideoLocationPanel(props) { function VideoLocationPanel(props) {
const { portArea } = useContext(Context); const { portArea } = useContext(Context);
const [statistics, setStatistics] = useState(defaultStatistics); const [data, setData] = useState(defaultStatistics);
useEffect(() => { useEffect(() => {
const loadStatistics = async () => { const loadData = async () => {
const { data = {} } = await props.getFixedCameraVideoLocationStat({ const { data = {} } = await props.getFixedCameraVideoLocationStat({
portArea, portArea,
}); });
const counts = [data.totalCount, data.onlineCount, data.offlineCount]; const counts = [data.totalCount, data.onlineCount, data.offlineCount];
setStatistics( setData(
defaultStatistics.map((item, index) => ({ defaultStatistics.map((item, index) => ({
...item, ...item,
count: counts[index], count: counts[index],
@ -33,7 +33,7 @@ function VideoLocationPanel(props) {
); );
}; };
loadStatistics(); loadData();
}, []); }, []);
return ( return (
@ -46,7 +46,7 @@ function VideoLocationPanel(props) {
style={{ backgroundImage: `url(${videoBackground})` }} style={{ backgroundImage: `url(${videoBackground})` }}
/> />
<div> <div>
{statistics.map(item => ( {data.map(item => (
<div <div
key={item.label} key={item.label}
className="port-video-location__statistic" className="port-video-location__statistic"