Browse Source

fix(): 处理大屏默认数据

tags/PMS_Frontend_v1.0.6-develop
chenqiang 1 year ago
parent
commit
b935555ce3
  1. 69
      src/pages/DataAnalysisPrediction/ParkingOverview/loadable.jsx

69
src/pages/DataAnalysisPrediction/ParkingOverview/loadable.jsx

@ -430,7 +430,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const [CarRoad, setCarRoad] = useState([ const [CarRoad, setCarRoad] = useState([
{ {
label: "西海岸新区", label: "西海岸新区",
value: "1",
value: "0",
type: 1, type: 1,
}, },
]); ]);
@ -578,12 +578,12 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const SelectDay = (str, val) => { const SelectDay = (str, val) => {
if (str == 1) { if (str == 1) {
setDaySel(val); setDaySel(val);
if (CarRoad[CarShow].type == 1) {
if (CarRoad[CarShow]?.type == 1) {
GetComplaintType(RoadSelect, val); GetComplaintType(RoadSelect, val);
} }
} else if (str == 2) { } else if (str == 2) {
setDaySet(val); setDaySet(val);
if (CarRoad[CarShow].type == 2) {
if (CarRoad[CarShow]?.type == 2) {
GetincomeType(RoadSelect, val); GetincomeType(RoadSelect, val);
} else { } else {
GetParkingEvaluate(RoadSelect, val); GetParkingEvaluate(RoadSelect, val);
@ -1374,8 +1374,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const GetOverviewData = (val) => { const GetOverviewData = (val) => {
ajax.ParkingOverview.GetOverviewData({ ajax.ParkingOverview.GetOverviewData({
type: val, type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1394,8 +1394,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
// //
const GetParkinfo = () => { const GetParkinfo = () => {
ajax.ParkingOverview.GetParkinfo({ ajax.ParkingOverview.GetParkinfo({
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1415,8 +1415,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const GetUseInfo = (val) => { const GetUseInfo = (val) => {
ajax.ParkingOverview.GetUseInfo({ ajax.ParkingOverview.GetUseInfo({
type: val, type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1464,8 +1464,17 @@ const ParkingOverview = connect(function mapStateToProps(state) {
ajax.ParkingOverview.GetAreaShop().then( ajax.ParkingOverview.GetAreaShop().then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
setCarRoad(res?.data || []);
setCarRoad(
res?.data || [
{
label: "西海岸新区",
value: "0",
type: 1,
},
]
);
} else { } else {
message.error(res?.message); message.error(res?.message);
} }
setLoading(true); setLoading(true);
@ -1498,8 +1507,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const getMapData = (val) => { const getMapData = (val) => {
ajax.ParkingOverview.getMapData({ ajax.ParkingOverview.getMapData({
type: val, type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1555,8 +1564,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
const GetDataStatic = (val) => { const GetDataStatic = (val) => {
ajax.ParkingOverview.GetDataStatic({ ajax.ParkingOverview.GetDataStatic({
type: val, type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1576,8 +1585,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
//top5 //top5
const GetrateRank = () => { const GetrateRank = () => {
ajax.ParkingOverview.GetrateRank({ ajax.ParkingOverview.GetrateRank({
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1599,8 +1608,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
ajax.ParkingOverview.GetincomeType({ ajax.ParkingOverview.GetincomeType({
type: val, type: val,
dateType: item, dateType: item,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1622,8 +1631,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
ajax.ParkingOverview.GetRevenueAnalysis({ ajax.ParkingOverview.GetRevenueAnalysis({
type: val, type: val,
dateType: item, dateType: item,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1645,8 +1654,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
ajax.ParkingOverview.GetParkingEvaluate({ ajax.ParkingOverview.GetParkingEvaluate({
type: val, type: val,
dateType: item, dateType: item,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1668,8 +1677,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
ajax.ParkingOverview.GetComplaintType({ ajax.ParkingOverview.GetComplaintType({
type: val, type: val,
dateType: item, dateType: item,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
areaType: CarRoad[CarShow]?.type,
value: CarRoad[CarShow]?.value,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1778,7 +1787,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
// GetDataStatic(RoadSelect); // GetDataStatic(RoadSelect);
GetUseInfo(RoadSelect); GetUseInfo(RoadSelect);
GetRevenueAnalysis(RoadSelect, "1"); GetRevenueAnalysis(RoadSelect, "1");
if (CarRoad[CarShow].type == 2) {
if (CarRoad[CarShow]?.type == 2) {
GetrateRank(); GetrateRank();
GetincomeType(RoadSelect, "1"); GetincomeType(RoadSelect, "1");
GetOverviewData(RoadSelect); GetOverviewData(RoadSelect);
@ -1812,7 +1821,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
<div className="left_home"> <div className="left_home">
<div className="pkh_title">停车业务概览</div> <div className="pkh_title">停车业务概览</div>
<div className="dlex_f"> <div className="dlex_f">
{CarRoad[CarShow].type == 2
{CarRoad[CarShow]?.type == 2
? LeftShow.map((ele) => { ? LeftShow.map((ele) => {
return ( return (
<div <div
@ -2051,7 +2060,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
{HoShow ? <i></i> : ""} {HoShow ? <i></i> : ""}
</div> </div>
<div className="right_home"> <div className="right_home">
{CarRoad[CarShow].type == 2 ? (
{CarRoad[CarShow]?.type == 2 ? (
<div> <div>
<div className="pkh_title">收费员排行Top5</div> <div className="pkh_title">收费员排行Top5</div>
<div className="tfff"> <div className="tfff">
@ -2113,8 +2122,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
)} )}
<div> <div>
<div className="pkh_title"> <div className="pkh_title">
{CarRoad[CarShow].type == 2 ? "营业收入分析" : "车场服务评价"}
{CarRoad[CarShow].type == 1 && (
{CarRoad[CarShow]?.type == 2 ? "营业收入分析" : "车场服务评价"}
{CarRoad[CarShow]?.type == 1 && (
<Tooltip <Tooltip
placement="bottom" placement="bottom"
title={<span>统计范围内用户对车场进行评价的不同分值占比</span>} title={<span>统计范围内用户对车场进行评价的不同分值占比</span>}
@ -2138,7 +2147,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
); );
})} })}
</div> </div>
{CarRoad[CarShow].type == 1 ? (
{CarRoad[CarShow]?.type == 1 ? (
<div id="ecsdf" style={{ height: "180px", width: "100%" }}></div> <div id="ecsdf" style={{ height: "180px", width: "100%" }}></div>
) : ( ) : (
<ReactEcharts <ReactEcharts

Loading…
Cancel
Save