Browse Source

feat(): 添加大屏底部车场切换的功能

tags/PMS_Frontend_v1.0.6-develop
chenqiang 1 year ago
parent
commit
481e2d954e
  1. 198
      src/pages/DataAnalysisPrediction/ParkingOverview/loadable.jsx
  2. 15
      src/services/ParkingOverview/index.js

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

@ -161,7 +161,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
align: "center", align: "center",
}, },
]; ];
//
//qf
const qfcolumn = [ const qfcolumn = [
{ {
title: "车牌号", title: "车牌号",
@ -227,13 +227,13 @@ const ParkingOverview = connect(function mapStateToProps(state) {
// //
const [LeftShow, setLeftShow] = useState([ const [LeftShow, setLeftShow] = useState([
{ {
text: "车场总数",
text: "车场总数",
value: "parkTotal", value: "parkTotal",
img: Lf1, img: Lf1,
status: "", status: "",
}, },
{ {
text: "泊位总数",
text: "停车场泊位总数",
value: "berthTotal", value: "berthTotal",
img: Lf2, img: Lf2,
status: "", status: "",
@ -308,100 +308,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
total: 0, total: 0,
}); });
// //
const [qfdata, setqfdata] = useState([
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
{
cp: "鄂D24364",
je: "143",
},
]);
const [qfdata, setqfdata] = useState([]);
// //
const [Zata, setZata] = useState({ const [Zata, setZata] = useState({
@ -448,8 +355,9 @@ const ParkingOverview = connect(function mapStateToProps(state) {
// //
const [CarRoad, setCarRoad] = useState([ const [CarRoad, setCarRoad] = useState([
{ {
text: "西海岸新区",
label: "西海岸新区",
value: "1", value: "1",
type: 1,
}, },
]); ]);
// //
@ -945,28 +853,12 @@ const ParkingOverview = connect(function mapStateToProps(state) {
setCarShow(index + 1); setCarShow(index + 1);
} }
} }
setRoadSelect("1");
}; };
// //
const BottomTab = (val) => { const BottomTab = (val) => {
setRoadSelect(val); setRoadSelect(val);
}; };
//
const WordS = (
data = {
pl: "鄂A1234",
time: "2023.09.09 10:10:10",
road: "青岛停车场",
type: "1",
}
) => {
var str = "";
if ((data.type = 1)) {
str = `车牌号:${data.pl}入场时间${data.time}入场路段:${data.road}`;
} else {
str = `车牌号:${data.pl}出场时间${data.time}出场路段:${data.road}`;
}
return str;
};
// //
const SpeakWord = (val) => { const SpeakWord = (val) => {
setText(val); setText(val);
@ -976,7 +868,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
//(7) //(7)
const GetOverviewData = (val) => { const GetOverviewData = (val) => {
ajax.ParkingOverview.GetOverviewData({ type: val }).then(
ajax.ParkingOverview.GetOverviewData({
type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
}).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
setLeftDataTop({ ...res?.data }); setLeftDataTop({ ...res?.data });
@ -993,7 +889,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
}; };
//(7) //(7)
const GetUseInfo = (val) => { const GetUseInfo = (val) => {
ajax.ParkingOverview.GetUseInfo({ type: val }).then(
ajax.ParkingOverview.GetUseInfo({
type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
}).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
setLeftDataOther({ ...res.data }); setLeftDataOther({ ...res.data });
@ -1027,7 +927,6 @@ const ParkingOverview = connect(function mapStateToProps(state) {
crtimer.onmessage = function (evt) { crtimer.onmessage = function (evt) {
var data = JSON.parse(evt.data); var data = JSON.parse(evt.data);
console.log(data);
if (data?.data?.type == "inOutNotice") { if (data?.data?.type == "inOutNotice") {
SpeakWord(data?.data?.content); SpeakWord(data?.data?.content);
} else if (data?.data?.type == "arrears") { } else if (data?.data?.type == "arrears") {
@ -1035,30 +934,13 @@ const ParkingOverview = connect(function mapStateToProps(state) {
setHoShow(true); setHoShow(true);
} }
}; };
// ajax.ParkingOverview.GetCar({ type: val, dateType: item }).then(
// (res) => {
// if (parseInt(res?.status) === 20000) {
// SpeakWord(WordS(res?.data));
// } else {
// message.error(res?.message);
// }
// setLoading(true);
// },
// (err) => {
// console.log(err);
// setLoading(true);
// }
// );
}; };
//
const GetQfCar = (val, item) => {
ajax.ParkingOverview.GetQfCar({ type: val, dateType: item }).then(
//quyu
const GetAreaShop = () => {
ajax.ParkingOverview.GetAreaShop().then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
// if () {
// setqfdata(res?.data);
// setHoShow(true)
// }
setCarRoad(res?.data || []);
} else { } else {
message.error(res?.message); message.error(res?.message);
} }
@ -1090,7 +972,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
}; };
// //
const getMapData = (val) => { const getMapData = (val) => {
ajax.ParkingOverview.getMapData({ type: val }).then(
ajax.ParkingOverview.getMapData({
type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
}).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
let arrcopy = res?.data.map((ele, index) => { let arrcopy = res?.data.map((ele, index) => {
@ -1143,7 +1029,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
}; };
//- //-
const GetDataStatic = (val) => { const GetDataStatic = (val) => {
ajax.ParkingOverview.GetDataStatic({ type: val }).then(
ajax.ParkingOverview.GetDataStatic({
type: val,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
}).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
setZata(res?.data); setZata(res?.data);
@ -1163,6 +1053,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,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1183,6 +1075,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,
}).then( }).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
@ -1200,7 +1094,12 @@ const ParkingOverview = connect(function mapStateToProps(state) {
); );
}; // }; //
const GetComplaintType = (val, item) => { const GetComplaintType = (val, item) => {
ajax.ParkingOverview.GetComplaintType({ type: val, dateType: item }).then(
ajax.ParkingOverview.GetComplaintType({
type: val,
dateType: item,
areaType: CarRoad[CarShow].type,
value: CarRoad[CarShow].value,
}).then(
(res) => { (res) => {
if (parseInt(res?.status) === 20000) { if (parseInt(res?.status) === 20000) {
getOingOption(res?.data); getOingOption(res?.data);
@ -1311,19 +1210,15 @@ const ParkingOverview = connect(function mapStateToProps(state) {
GetRevenueAnalysis(RoadSelect, "1"); GetRevenueAnalysis(RoadSelect, "1");
GetParkingEvaluate(RoadSelect, "1"); GetParkingEvaluate(RoadSelect, "1");
GetComplaintType(RoadSelect, "1"); GetComplaintType(RoadSelect, "1");
}, [RoadSelect]);
}, [RoadSelect, CarShow]);
useEffect(() => { useEffect(() => {
getSelectData(); getSelectData();
// qftimer = setInterval(() => {
// GetQfCar();
// }, 2000);
// crtimer = setInterval(() => {
GetCar(); GetCar();
// }, 2000);
GetAreaShop();
return () => { return () => {
clearInterval(qftimer); clearInterval(qftimer);
crtimer.close(); crtimer.close();
// clearInterval(crtimer);
}; };
}, []); }, []);
return ( return (
@ -1466,6 +1361,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
"" ""
)} )}
{Text && ( {Text && (
// CarRoad[CarShow].type == 1 &&
<div className="left_content"> <div className="left_content">
<p> <p>
<SoundOutlined /> <SoundOutlined />
@ -1667,8 +1563,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
<div className="q" onClick={() => BottomCar("left")}> <div className="q" onClick={() => BottomCar("left")}>
<img src={Pkhl} alt="" srcset="" /> <img src={Pkhl} alt="" srcset="" />
</div> </div>
<p className="taw" title={CarRoad[CarShow]?.text || ""}>
{CarRoad[CarShow]?.text || ""}
<p className="taw" title={CarRoad[CarShow]?.label || ""}>
{CarRoad[CarShow]?.label || ""}
</p> </p>
<div className="q" onClick={() => BottomCar("right")}> <div className="q" onClick={() => BottomCar("right")}>
<img src={Pkhr} alt="" srcset="" /> <img src={Pkhr} alt="" srcset="" />

15
src/services/ParkingOverview/index.js

@ -98,19 +98,10 @@ export default {
}); });
}, },
//获取出入
GetCar: (params) => {
//获取区域或商户
GetAreaShop: (params) => {
return ajax({ return ajax({
url: "/api/ana/overview/berthUseInfo",
type: "get",
data: params,
});
},
//获取欠费
GetQfCar: (params) => {
return ajax({
url: "/api/ana/overview/berthUseInfo",
url: "/api/ana/overview/getOperatorArea",
type: "get", type: "get",
data: params, data: params,
}); });

Loading…
Cancel
Save