refactor(data): 统一变量命名并优化异步加载函数名
- 将多个组件中的状态变量统一命名为data,替代原有的records、statistics、list等命名 - 将异步加载函数名统一修改为loadData,提高代码一致性和可读性 - 修改相关组件渲染部分变量引用,确保渲染数据源正确 - 优化useEffect及useMount中异步函数调用名称,增强代码规范性 - 涉及组件包括branchOffice、IndexInfo、port等多个子模块,全面提升代码风格统一性master
parent
7b2f826b63
commit
97792143b0
|
|
@ -9,14 +9,14 @@ import "./index.less";
|
|||
|
||||
/** 负责查询并展示相关方单位备案和项目执行统计。 */
|
||||
function RecordStatsPanel(props) {
|
||||
const [list, setList] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadList = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getXgfStatisticsListRecordProjectStatistics();
|
||||
setList(data);
|
||||
setData(data);
|
||||
};
|
||||
|
||||
loadList();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel
|
||||
|
|
@ -36,8 +36,8 @@ function RecordStatsPanel(props) {
|
|||
<div>人员培训情况统计</div>
|
||||
</div>
|
||||
<div className="index-info-record-stats__body">
|
||||
<SeamlessScroll list={list} step={0.5}>
|
||||
{list.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div className="index-info-record-stats__row" key={index}>
|
||||
<div>{item.qualificationsTypeName}</div>
|
||||
<div>{item.managerDeptName}</div>
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import "./index.less";
|
|||
|
||||
/** 负责查询并展示各公司隐患整改统计。 */
|
||||
function RectificationPanel(props) {
|
||||
const [list, setList] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadList = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getHiddenStatisticsByCorp({
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setList(data);
|
||||
setData(data);
|
||||
};
|
||||
|
||||
loadList();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel
|
||||
|
|
@ -40,8 +40,8 @@ function RectificationPanel(props) {
|
|||
<div>待验收</div>
|
||||
</div>
|
||||
<div className="index-info-rectification__body">
|
||||
<SeamlessScroll list={list} step={0.5}>
|
||||
{list.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="index-info-rectification__row"
|
||||
style={{ backgroundImage: `url(${tableRowBackground})` }}
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ function WorkStatusPanel(props) {
|
|||
chartInstance.current.setOption(option);
|
||||
};
|
||||
useMount(() => {
|
||||
const loadChartData = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getProjectTaskScoreCount();
|
||||
initEcharts(chartRef, chartInstance, data);
|
||||
};
|
||||
|
||||
loadChartData();
|
||||
loadData();
|
||||
|
||||
return () => chartInstance.current?.dispose();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import "./index.less";
|
|||
|
||||
/** 负责查询并展示物联网设备报警记录。 */
|
||||
function AlarmPanel(props) {
|
||||
const [list, setList] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadList = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setList(data);
|
||||
setData(data);
|
||||
};
|
||||
|
||||
loadList();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel title="物联网设备报警情况" className="index-info-right-panel__alarm">
|
||||
|
|
@ -36,8 +36,8 @@ function AlarmPanel(props) {
|
|||
<div>处置状态</div>
|
||||
</div>
|
||||
<div className="index-info-alarm__body">
|
||||
<SeamlessScroll list={list} step={0.5}>
|
||||
{list.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="index-info-alarm__row"
|
||||
style={{ backgroundImage: `url(${tableRowBackground})` }}
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import "./index.less";
|
|||
|
||||
/** 负责加载并展示相关方单位的资质、项目与人员统计。 */
|
||||
function PartnerPanel(props) {
|
||||
const [list, setList] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadList = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getXgfStatisticsListCorpStatistics({
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setList(data);
|
||||
setData(data);
|
||||
};
|
||||
|
||||
loadList();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel
|
||||
|
|
@ -39,8 +39,8 @@ function PartnerPanel(props) {
|
|||
<div>执行人员情况</div>
|
||||
</div>
|
||||
<div className="index-info-partner__body">
|
||||
<SeamlessScroll list={list} step={0.5}>
|
||||
{list.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="index-info-partner__row"
|
||||
style={{ backgroundImage: `url(${tableRowBackground})` }}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import "./index.less";
|
|||
|
||||
/** 展示重点作业类型及危险作业接口返回的实时数量。 */
|
||||
function WorkPanel(props) {
|
||||
const [list, setList] = useState([
|
||||
const [data, setData] = useState([
|
||||
{
|
||||
name: "三人以上作业",
|
||||
doingCount: 0,
|
||||
|
|
@ -28,12 +28,12 @@ function WorkPanel(props) {
|
|||
{ name: "四新作业", doingCount: 0, appliedCount: 0, image: newWorkIcon },
|
||||
]);
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }] = await Promise.all([
|
||||
props.getEightWorkInfoDangerWorkStatistics(),
|
||||
props.getKeyProjectLargeScreenStatistics(),
|
||||
]);
|
||||
setList((prevState) => {
|
||||
setData((prevState) => {
|
||||
prevState[1].doingCount = eightWorkData.doingCount;
|
||||
prevState[1].appliedCount = eightWorkData.appliedCount;
|
||||
|
||||
|
|
@ -50,13 +50,13 @@ function WorkPanel(props) {
|
|||
});
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel title="重点作业管理统计" className="index-info-right-panel__work">
|
||||
<Spin spinning={props.biStatistics.getEightWorkInfoDangerWorkStatisticsLoading || props.biStatistics.getKeyProjectLargeScreenStatisticsLoading}>
|
||||
<div className="index-info-work__list">
|
||||
{list.map(item => (
|
||||
{data.map(item => (
|
||||
<div className="index-info-work__item" key={item.name}>
|
||||
<img src={item.image} alt="" />
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ function WeatherPreventionPanel(props) {
|
|||
const [alerts, setAlerts] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadWeather = async () => {
|
||||
const loadData = async () => {
|
||||
const { result = {} } = await props.getWeather();
|
||||
setWeather(result.now || {});
|
||||
setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
|
||||
};
|
||||
loadWeather();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ const disposalStatus = { 10: "报警中", 20: "未处置", 30: "已消警" };
|
|||
/** 负责查询并滚动展示封闭区域告警。 */
|
||||
function AreaAlarmPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -43,8 +43,8 @@ function AreaAlarmPanel(props) {
|
|||
props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading
|
||||
}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div className="branch-office-area-alarm__row" key={index}>
|
||||
<div>{item.fireRegionName}</div>
|
||||
<div>{item.alarmTypeName}</div>
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ import "./index.less";
|
|||
/** 负责合并两类作业统计并展示部门维度数据。 */
|
||||
function KeyWorkStatsPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }]
|
||||
= await Promise.all([
|
||||
props.getEightWorkInfoScreenDepartmentStatistics({
|
||||
|
|
@ -46,9 +46,9 @@ function KeyWorkStatsPanel(props) {
|
|||
department.eightWorkCount = item.workCount || 0;
|
||||
departmentMap.set(item.departmentId, department);
|
||||
});
|
||||
setRecords([...departmentMap.values()]);
|
||||
setData([...departmentMap.values()]);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -73,8 +73,8 @@ function KeyWorkStatsPanel(props) {
|
|||
.getEightWorkInfoScreenDepartmentStatisticsLoading
|
||||
}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="branch-office-key-work-stats__row"
|
||||
key={index}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ function WeatherPreventionPanel(props) {
|
|||
const [alerts, setAlerts] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadWeather = async () => {
|
||||
const loadData = async () => {
|
||||
const { result = {} } = await props.getWeather();
|
||||
setWeather(result.now || {});
|
||||
setAlerts(Array.isArray(result.alerts) ? result.alerts : []);
|
||||
};
|
||||
loadWeather();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import "./index.less";
|
|||
/** 负责查询并展示危险作业类别、状态及参与人数统计。 */
|
||||
function DangerWorkDataPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] }
|
||||
= await props.getEightWorkInfoScreenDangerWorkDataStatistics({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel title="危险作业数据统计" className="branch-office-danger-work__data">
|
||||
|
|
@ -39,8 +39,8 @@ function DangerWorkDataPanel(props) {
|
|||
.getEightWorkInfoScreenDangerWorkDataStatisticsLoading
|
||||
}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="branch-office-danger-work-data__row"
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import "./index.less";
|
|||
/** 负责合并两类部门作业统计并展示部门维度数据。 */
|
||||
function DepartmentWorkPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const [{ data: eightWorkData = [] }, { data: keyProjectData = [] }]
|
||||
= await Promise.all([
|
||||
props.getEightWorkInfoScreenDepartmentStatistics({
|
||||
|
|
@ -45,9 +45,9 @@ function DepartmentWorkPanel(props) {
|
|||
department.eightWorkCount = item.workCount || 0;
|
||||
departmentMap.set(item.departmentId, department);
|
||||
});
|
||||
setRecords([...departmentMap.values()]);
|
||||
setData([...departmentMap.values()]);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel
|
||||
|
|
@ -71,8 +71,8 @@ function DepartmentWorkPanel(props) {
|
|||
.getEightWorkInfoScreenDepartmentStatisticsLoading
|
||||
}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div className="branch-office-department-work__row" key={index}>
|
||||
<div>{item.departmentName}</div>
|
||||
<div>{item.fourNewHomeworkCount}</div>
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示各重点作业的执行状态。 */
|
||||
function KeyWorkPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }]
|
||||
= await Promise.all([
|
||||
props.getEightWorkInfoDangerWorkStatistics({
|
||||
|
|
@ -65,7 +65,7 @@ function KeyWorkPanel(props) {
|
|||
corpinfoId: currentBranchOffice,
|
||||
}),
|
||||
]);
|
||||
setStatistics([
|
||||
setData([
|
||||
{
|
||||
...defaultStatistics[0],
|
||||
currentCount: keyProjectData.fourNewHomeworkStartCount,
|
||||
|
|
@ -86,7 +86,7 @@ function KeyWorkPanel(props) {
|
|||
},
|
||||
]);
|
||||
};
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
return (
|
||||
<Panel title="重点作业" className="branch-office-danger-work__key-work">
|
||||
|
|
@ -97,7 +97,7 @@ function KeyWorkPanel(props) {
|
|||
}
|
||||
>
|
||||
<div className="branch-office-key-work__list">
|
||||
{statistics.map((item, index) => (
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="branch-office-key-work__item"
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示重点作业当前数量与申请数量。 */
|
||||
function KeyWorkStatsPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const [{ data: eightWorkData = {} }, { data: keyProjectData = {} }]
|
||||
= await Promise.all([
|
||||
props.getEightWorkInfoDangerWorkStatistics({
|
||||
|
|
@ -39,7 +39,7 @@ function KeyWorkStatsPanel(props) {
|
|||
corpinfoId: currentBranchOffice,
|
||||
}),
|
||||
]);
|
||||
setStatistics([
|
||||
setData([
|
||||
{
|
||||
...defaultStatistics[0],
|
||||
currentCount: keyProjectData.fourNewHomeworkStartCount,
|
||||
|
|
@ -57,7 +57,7 @@ function KeyWorkStatsPanel(props) {
|
|||
},
|
||||
]);
|
||||
};
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -69,7 +69,7 @@ function KeyWorkStatsPanel(props) {
|
|||
}
|
||||
>
|
||||
<div className="branch-office-key-work-stats__list">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div
|
||||
key={item.title}
|
||||
className="branch-office-key-work-stats__item"
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ const disposalStatus = { 10: "报警中", 20: "未处置", 30: "已消警" };
|
|||
/** 负责查询并滚动展示消防设备报警记录。 */
|
||||
function FireAlarmRecordPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -44,8 +44,8 @@ function FireAlarmRecordPanel(props) {
|
|||
props.biStatistics.getAlarmRecordScreenIotDeviceAlarmPageLoading
|
||||
}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="branch-office-fire-alarm-record__row"
|
||||
key={index}
|
||||
|
|
|
|||
|
|
@ -10,23 +10,23 @@ import "./index.less";
|
|||
/** 负责查询并展示消防设备总数及各状态数量。 */
|
||||
function FireDeviceStatusPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState({
|
||||
const [data, setData] = useState({
|
||||
totalCount: 0,
|
||||
statusList: [],
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getSensorDeviceFireSituation({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
setStatistics({
|
||||
setData({
|
||||
totalCount: data.totalCount || 0,
|
||||
statusList: data.statusList || [],
|
||||
});
|
||||
};
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -42,12 +42,12 @@ function FireDeviceStatusPanel(props) {
|
|||
</div>
|
||||
<div className="branch-office-fire-device-status__total">
|
||||
<span>设备总数</span>
|
||||
<strong>{statistics.totalCount}</strong>
|
||||
<strong>{data.totalCount}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="branch-office-fire-device-status__list">
|
||||
{statistics.statusList.map(item => (
|
||||
{data.statusList.map(item => (
|
||||
<div
|
||||
className={`branch-office-fire-device-status__item branch-office-fire-device-status__item--${item.bianma.toLocaleLowerCase()}`}
|
||||
key={item.bianma}
|
||||
|
|
|
|||
|
|
@ -10,19 +10,19 @@ import "./index.less";
|
|||
/** 负责展示企业志愿消防队伍本地信息。 */
|
||||
function VolunteerFireTeamPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getFireBrigadeMemberScreenList({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -40,8 +40,8 @@ function VolunteerFireTeamPanel(props) {
|
|||
</div>
|
||||
<div className="branch-office-volunteer-fire-team__body">
|
||||
<Spin spinning={props.biStatistics.getFireBrigadeMemberScreenListLoading}>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="branch-office-volunteer-fire-team__row"
|
||||
key={index}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ function ContractProjectPanel(props) {
|
|||
};
|
||||
|
||||
useMount(() => {
|
||||
const loadContractProjects = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getProjectContractProjectStatistics({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
|
|
@ -167,7 +167,7 @@ function ContractProjectPanel(props) {
|
|||
});
|
||||
initEcharts(chartRef, chartInstance, data);
|
||||
};
|
||||
loadContractProjects();
|
||||
loadData();
|
||||
|
||||
return () => {
|
||||
if (chartInstance.current) {
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import "./index.less";
|
|||
/** 负责查询并滚动展示项目检查、隐患和处罚数据。 */
|
||||
function ProjectProgressPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getKeyProjectLargeScreenProjectProgress({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -38,8 +38,8 @@ function ProjectProgressPanel(props) {
|
|||
<Spin
|
||||
spinning={props.biStatistics.getKeyProjectLargeScreenProjectProgressLoading}
|
||||
>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div
|
||||
className="branch-office-project-progress__row"
|
||||
key={index}
|
||||
|
|
|
|||
|
|
@ -17,21 +17,21 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示分公司项目总量及开工状态。 */
|
||||
function ProjectStatsPanel(props) {
|
||||
const { portArea, currentBranchOffice } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getProjectVisualProjectStatistics({
|
||||
portArea,
|
||||
corpinfoId: currentBranchOffice,
|
||||
});
|
||||
setStatistics([
|
||||
setData([
|
||||
{ ...defaultStatistics[0], value: data.totalProjectCount },
|
||||
{ ...defaultStatistics[1], value: data.pendingProjectCount },
|
||||
{ ...defaultStatistics[2], value: data.executingProjectCount },
|
||||
]);
|
||||
};
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -39,7 +39,7 @@ function ProjectStatsPanel(props) {
|
|||
<Spin spinning={props.biStatistics.getProjectVisualProjectStatisticsLoading}>
|
||||
<div className="branch-office-project-stats__content">
|
||||
<div className="branch-office-project-stats__list">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div
|
||||
className="branch-office-project-stats__item"
|
||||
key={item.label}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示港区单位、相关方及员工基础统计。 */
|
||||
function BasicInfoPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getCorpInfoCorpUserSummary({ portArea });
|
||||
const counts = [
|
||||
data.branchCorpCount,
|
||||
|
|
@ -31,7 +31,7 @@ function BasicInfoPanel(props) {
|
|||
data.userCount,
|
||||
];
|
||||
|
||||
setStatistics(
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
count: counts[index],
|
||||
|
|
@ -39,14 +39,14 @@ function BasicInfoPanel(props) {
|
|||
);
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Panel title="单位基础信息">
|
||||
<Spin spinning={props.biStatistics.getCorpInfoCorpUserSummaryLoading}>
|
||||
<div className="port-basic-info__options">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div key={item.label} className="port-basic-info__option">
|
||||
<img
|
||||
src={item.image}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ const tabs = ["分公司统计", "相关方单位统计"];
|
|||
function PersonnelStatsPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [activeTab, setActiveTab] = useState(0);
|
||||
const [statistics, setStatistics] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
const loadStatistics = async (enterpriseType) => {
|
||||
const loadData = async (enterpriseType) => {
|
||||
setIsVisible(false);
|
||||
const { data = [] } = await props.getCorpInfoCorpUserStatisticPage({
|
||||
portArea,
|
||||
|
|
@ -26,7 +26,7 @@ function PersonnelStatsPanel(props) {
|
|||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setStatistics(data);
|
||||
setData(data);
|
||||
setIsVisible(true);
|
||||
};
|
||||
|
||||
|
|
@ -35,11 +35,11 @@ function PersonnelStatsPanel(props) {
|
|||
return;
|
||||
|
||||
setActiveTab(index);
|
||||
loadStatistics(index === 0 ? 2 : 3);
|
||||
loadData(index === 0 ? 2 : 3);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadStatistics(2);
|
||||
loadData(2);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -68,8 +68,8 @@ function PersonnelStatsPanel(props) {
|
|||
<div className="port-personnel-stats__table-body">
|
||||
<Spin spinning={props.biStatistics.getCorpInfoCorpUserStatisticPageLoading}>
|
||||
{isVisible && (
|
||||
<SeamlessScroll list={statistics} step={0.5}>
|
||||
{statistics.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div key={index} className="port-personnel-stats__row">
|
||||
<div className="port-personnel-stats__cell">
|
||||
{item.corpName}
|
||||
|
|
|
|||
|
|
@ -47,16 +47,16 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示不同风险等级的风险点数量。 */
|
||||
function RiskStatsPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getRiskPointCorpRiskLevel({ portArea });
|
||||
const countByLevel = Object.fromEntries(
|
||||
data.map(item => [item.level, item.count]),
|
||||
);
|
||||
|
||||
setStatistics(
|
||||
setData(
|
||||
defaultStatistics.map(item => ({
|
||||
...item,
|
||||
count: countByLevel[item.level] || 0,
|
||||
|
|
@ -64,14 +64,14 @@ function RiskStatsPanel(props) {
|
|||
);
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Panel title="风险区域统计" className="port-index__risk-stats">
|
||||
<Spin spinning={props.biStatistics.getRiskPointCorpRiskLevelLoading}>
|
||||
<div className="port-risk-stats__options">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div key={item.level} className="port-risk-stats__option">
|
||||
<img
|
||||
src={item.image}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ const rankStyleNames = ["first", "second", "third"];
|
|||
/** 负责查询并展示危险作业记录及其排行样式。 */
|
||||
function WorkRecordPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [records, setRecords] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadRecords = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getEightWorkInfoScreenWorkRecord({
|
||||
portArea,
|
||||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setRecords(data);
|
||||
setData(data);
|
||||
};
|
||||
|
||||
loadRecords();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -39,8 +39,8 @@ function WorkRecordPanel(props) {
|
|||
</div>
|
||||
<div className="port-danger-work-record__table-body">
|
||||
<Spin spinning={props.biStatistics.getEightWorkInfoScreenWorkRecordLoading}>
|
||||
<SeamlessScroll list={records} step={0.5}>
|
||||
{records.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div key={index} className="port-danger-work-record__row">
|
||||
<div className="port-danger-work-record__cell">
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示危险作业申请、审批和归档状态统计。 */
|
||||
function WorkStatusPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getEightWorkInfoScreenStatusStatistics({
|
||||
portArea,
|
||||
});
|
||||
|
|
@ -33,7 +33,7 @@ function WorkStatusPanel(props) {
|
|||
data.approvingCount,
|
||||
data.archivedCount,
|
||||
];
|
||||
setStatistics(
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
count: counts[index],
|
||||
|
|
@ -41,14 +41,14 @@ function WorkStatusPanel(props) {
|
|||
);
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Panel title="安全作业状态统计">
|
||||
<Spin spinning={props.biStatistics.getEightWorkInfoScreenStatusStatisticsLoading}>
|
||||
<div className="port-danger-work-status__options">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div key={item.label} className="port-danger-work-status__option">
|
||||
<div
|
||||
className="port-danger-work-status__icon"
|
||||
|
|
|
|||
|
|
@ -114,14 +114,14 @@ function WorkTrendPanel(props) {
|
|||
};
|
||||
|
||||
useMount(() => {
|
||||
const loadTrendData = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = [] } = await props.getEightWorkInfoScreenWorkTrend({
|
||||
portArea,
|
||||
});
|
||||
initEcharts(chartRef, chartInstance, formatWorkTrendData(data));
|
||||
};
|
||||
|
||||
loadTrendData();
|
||||
loadData();
|
||||
return () => chartInstance.current?.dispose();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import "./index.less";
|
|||
function FireDeviceListPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const { queryParams } = props;
|
||||
const [deviceList, setDeviceList] = useState([]);
|
||||
const [data, setData] = useState([]);
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const loadDeviceList = async () => {
|
||||
const loadData = async () => {
|
||||
setIsVisible(false);
|
||||
const { data = [] } = await props.getFirePointDeviceList({
|
||||
portArea,
|
||||
|
|
@ -23,11 +23,11 @@ function FireDeviceListPanel(props) {
|
|||
pageIndex: 1,
|
||||
pageSize: 9999,
|
||||
});
|
||||
setDeviceList(data);
|
||||
setData(data);
|
||||
setIsVisible(true);
|
||||
};
|
||||
|
||||
loadDeviceList();
|
||||
loadData();
|
||||
}, [queryParams]);
|
||||
|
||||
return (
|
||||
|
|
@ -42,8 +42,8 @@ function FireDeviceListPanel(props) {
|
|||
<div className="port-fire-device-list__table-body">
|
||||
<Spin spinning={props.biStatistics.getFirePointDeviceListLoading}>
|
||||
{isVisible && (
|
||||
<SeamlessScroll list={deviceList} step={0.5}>
|
||||
{deviceList.map((item, index) => (
|
||||
<SeamlessScroll list={data} step={0.5}>
|
||||
{data.map((item, index) => (
|
||||
<div key={index} className="port-fire-device-list__row">
|
||||
<div className="port-fire-device-list__cell">
|
||||
{item.firePointName}
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示重点工程总量与开工数量。 */
|
||||
function KeyProjectPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getKeyProjectLargeScreenProjectStatistics({
|
||||
portArea,
|
||||
});
|
||||
const counts = [data.totalProjectCount, data.startCount];
|
||||
setStatistics(
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
count: counts[index],
|
||||
|
|
@ -35,14 +35,14 @@ function KeyProjectPanel(props) {
|
|||
);
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Panel title="重点工程" className="port-key-supervision__project">
|
||||
<Spin spinning={props.biStatistics.getKeyProjectLargeScreenProjectStatisticsLoading}>
|
||||
<div className="port-key-project__options">
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div key={item.label} className="port-key-project__option">
|
||||
<div
|
||||
className="port-key-project__icon"
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ const defaultStatistics = [
|
|||
/** 负责查询并展示摄像头总数、在线与离线统计。 */
|
||||
function VideoLocationPanel(props) {
|
||||
const { portArea } = useContext(Context);
|
||||
const [statistics, setStatistics] = useState(defaultStatistics);
|
||||
const [data, setData] = useState(defaultStatistics);
|
||||
|
||||
useEffect(() => {
|
||||
const loadStatistics = async () => {
|
||||
const loadData = async () => {
|
||||
const { data = {} } = await props.getFixedCameraVideoLocationStat({
|
||||
portArea,
|
||||
});
|
||||
const counts = [data.totalCount, data.onlineCount, data.offlineCount];
|
||||
setStatistics(
|
||||
setData(
|
||||
defaultStatistics.map((item, index) => ({
|
||||
...item,
|
||||
count: counts[index],
|
||||
|
|
@ -33,7 +33,7 @@ function VideoLocationPanel(props) {
|
|||
);
|
||||
};
|
||||
|
||||
loadStatistics();
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
@ -46,7 +46,7 @@ function VideoLocationPanel(props) {
|
|||
style={{ backgroundImage: `url(${videoBackground})` }}
|
||||
/>
|
||||
<div>
|
||||
{statistics.map(item => (
|
||||
{data.map(item => (
|
||||
<div
|
||||
key={item.label}
|
||||
className="port-video-location__statistic"
|
||||
|
|
|
|||
Loading…
Reference in New Issue