Browse Source

fix():修改pn提交时未重置的问题

tags/PMS_Frontend_v1.0.6-develop
xingjx 1 year ago
parent
commit
1ef6c31802
  1. 2
      src/assets/css/ant-modification.scss
  2. 9
      src/components/TableModule/index.jsx
  3. 13
      src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyDuration/index.scss
  4. 36
      src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyDuration/loadable.jsx
  5. 7
      src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyOverview/loadable.jsx
  6. 186
      src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyPeriod/loadable.jsx
  7. 8
      src/pages/DataAnalysisPrediction/ParkingBusinessAly/echarts.config.js
  8. 7
      src/services/DataAnalysisPrediction/ParkingBusinessAly/index.js

2
src/assets/css/ant-modification.scss

@ -268,7 +268,7 @@
.ant-table-fixed-header {
.ant-table-tbody {
tr:nth-child(2n + 1) > td {
background: var(--table-bg);
//background: var(--table-bg);
}
tr:nth-child(2n) > td {

9
src/components/TableModule/index.jsx

@ -145,9 +145,10 @@ const TableModule = forwardRef((props, ref) => {
}, [formData])
//
function fetch() {
function fetch(pn) {
// setLoading(true);
let form = { ...searchForm.getFieldsValue(), ...pageData, ...otherData };
let pnno = pn ? { pn: 1 } : {}
let form = { ...searchForm.getFieldsValue(), ...pageData, ...otherData, ...pnno };
if (timeFlag) {
form = {
...form,
@ -481,7 +482,7 @@ const TableModule = forwardRef((props, ref) => {
(item.defaultValue && item.defaultValue[1]) || moment()
}
>
<DatePicker showTime format={"YYYY-MM-DD HH:mm:ss"} allowClear={false}/>
<DatePicker showTime format={"YYYY-MM-DD HH:mm:ss"} allowClear={false} />
</Form.Item>
<div style={{ margin: "-20px 0 10px 0" }}>
<QuickMenu
@ -643,7 +644,7 @@ const TableModule = forwardRef((props, ref) => {
<Button className="reset" onClick={reset}>
重置
</Button>
<Button type="primary" className="submit" onClick={fetch}>
<Button type="primary" className="submit" onClick={() => { fetch(1) }}>
查询
</Button>
</div>

13
src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyDuration/index.scss

@ -142,6 +142,19 @@ $color-primary : var(--color-primary);
display: inline-block;
}
.export-btn {
display: inline-block;
text-align: center;
float: right;
width: 68px;
height: 34px;
line-height: 34px;
background: linear-gradient(180deg,#3aa9ff, #59b7ff);
border-radius: 4px;
margin-right: 15px;
margin-top: 10px;
cursor: pointer;
}
i {
border: 1px solid;
border-radius: 22px;

36
src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyDuration/loadable.jsx

@ -212,7 +212,7 @@ function ParkingAlyDuration() {
end_time: end,
});
};
//
//
const getRevenueOption = (data) => {
console.log(data)
// data = [
@ -712,22 +712,22 @@ function ParkingAlyDuration() {
}
setDefaultParams({ ...postData, ...pageInfo });
setTabLoading(true);
// ajax.getAppList({ ...postData, ...v, ...pageInfo }).then(
// (res) => {
// if (parseInt(res?.status) === 20000) {
// setResultData(res?.data || {});
// } else {
// message.error(res?.message);
// }
// setLoading(false);
// setTabLoading(false);
// },
// (err) => {
// console.log(err);
// setLoading(false);
// setTabLoading(false);
// }
// );
ajax.getParkingAlyDurationParkingList({ ...postData, ...v, ...pageInfo }).then(
(res) => {
if (parseInt(res?.status) === 20000) {
setResultData(res?.data || {});
} else {
message.error(res?.message);
}
setLoading(false);
setTabLoading(false);
},
(err) => {
console.log(err);
setLoading(false);
setTabLoading(false);
}
);
};
//
@ -963,6 +963,7 @@ function ParkingAlyDuration() {
<div className="duration-box">
<div className="result-box duration-left">
<div className="result-box-title">日均泊位周转次数排行榜</div>
<div className="export-btn" onClick={()=>{window.open('/api/ana/dataanalysis/get_turn_times_export')}}>导出</div>
<Tabs
defaultActiveKey="2"
activeKey={tabKey}
@ -1035,6 +1036,7 @@ function ParkingAlyDuration() {
</div>
<div className="result-box duration-right">
<div className="result-box-title">平均停车时长排行榜</div>
<div className="export-btn" onClick={()=>{window.open('/get_parking_duration_export')}}>导出</div>
<Table
columns={parkColumns}
dataSource={[]}

7
src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyOverview/loadable.jsx

@ -277,7 +277,7 @@ function ParkingAlyOverview() {
};
});
setRevenueData(lineChartOption(areaNames, xAxisData, seriesData));
setRevenueData(lineChartOption(areaNames, xAxisData,"停车记录数(个)", seriesData));
};
//,
@ -506,6 +506,7 @@ function ParkingAlyOverview() {
}
/>
</div>
<div className="yisa-search">
<label>日期
{/* <div className="daf">
@ -608,6 +609,7 @@ function ParkingAlyOverview() {
}
/>
</div>
<div className="form-btn">
<Button
className="reset"
@ -723,6 +725,7 @@ function ParkingAlyOverview() {
bordered
pagination={false}
size="middle"
scroll={{ y: 305 }}
/>
<Pagination {...paginationProps} className="pagination-common" total={tableData?.area_total_records} />
</>,
@ -744,7 +747,7 @@ function ParkingAlyOverview() {
bordered
pagination={false}
size="middle"
//scroll={{ y: 305 }}
scroll={{ y: 305 }}
// scroll={{
// x: 'calc(700px + 50%)',
// y: 240,

186
src/pages/DataAnalysisPrediction/ParkingBusinessAly/ParkingAlyPeriod/loadable.jsx

@ -3,6 +3,7 @@ import { ResultFlowResult } from "@/components";
import { Select, Input, Button, Table, message, Pagination, DatePicker, Modal, Cascader, Tooltip } from "antd";
import { Icon } from "@/components"
import { useSessionStorageState } from "ahooks";
import { lineChartOption, ringChartOption } from "../echarts.config";
import moment from "moment";
import ReactEcharts from "echarts-for-react";
import "./index.scss";
@ -83,7 +84,8 @@ function ParkingAlyPeriod() {
const TimeChange = () => {
let e = formData.date_type;
let str = "day";
let mat = "YYYY-MM-DD";
//let mat = "YYYY-MM-DD";
let mat = "YYYY-MM-DD HH:mm:ss";
if (e == 4) {
str = "year";
mat = "YYYY";
@ -121,152 +123,53 @@ function ParkingAlyPeriod() {
});
};
//
const getRevenueOption = (data) => {
const getRevenueOption = (data) =>{
//
data.sort((a, b) => {
return new Date(a.pay_date) - new Date(b.pay_date);
return new Date(a.date) - new Date(b.date);
});
console.log(data);
const areaNames = [...new Set(data.map((item) => item.area_name))];
const areaNames = data[0].name ? [...new Set(data.map((item) => item.name))] : [''];
//
const dates = [...new Set(data.map((item) => item.pay_date))].sort(
(a, b) => a.pay_date - b.pay_date
const dates = [...new Set(data.map((item) => item.date))].sort(
(a, b) => a.date - b.date
);
//
const seriesData = areaNames.map((areaName, index) => {
//
const areaData = data.filter((item) => item.area_name === areaName);
const areaData = data[0].name ? data.filter((item) => item.name === areaName) : data
//
return {
name: areaName,
name: areaNames.length > 1 ? areaName : '',
type: "line",
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
textStyle: { //
color: 'white',//
fontSize: 10//
}
},
label: {
show: true, //
position: 'top', //
color: 'white',//
fontSize: 10//
},
},
data: dates.map((item) => {
for (const { pay_date, income } of areaData) {
console.log(pay_date, income);
if (pay_date === item) return income;
for (const { date, record_count } of areaData) {
if (date === item) return record_count;
}
return 0;
}),
yAxisIndex: index == 1 ? 1 : null,
};
});
console.log(21, areaNames, seriesData)
// X
const xAxisData = dates.map((date) => {
return {
value: date,
textStyle: {
align: "center",
lineStyle: {
color: "#3AA9FF", // 线
shadowBlur: 6,
},
align: "center",
lineStyle: {
color: "skyblue", // 线
shadowBlur: 6,
},
};
});
setRevenueData({
title: {
text: "",
textStyle: {
color: "#fff",
},
},
tooltip: {
trigger: "axis",
},
legend: {
type: "scroll",
top: 0,
left: 'center',
data: areaNames,
itemWidth: 18,
itemHeight: 12,
width: '40%',
textStyle: {
fontSize: 14,
color: 'white',
},
},
xAxis: {
data: xAxisData,
type: 'category',
boundaryGap: false, //
axisLine: {
lineStyle: {
color: "#bbb",
},
},
axisLabel: {
textStyle: {
color: "#bbb",
},
},
},
yAxis: {
type: "value",
name: '车次数(次)',
min: 0,
// /max: 50,
interval: 10,
splitNumber: 6, //
axisLabel: {
//formatter: "{value}",
textStyle: {
color: "#bbb",
},
},
splitLine: {
show: true, // 线
interval: '0', // .0
lineStyle: {
color: ['#cccccc42'], // 线线
width: 1.3, // 线线
type: 'dashed', // 线线'solid'线'dashed'线'dotted',
},
},
},
color: ["#3AA9FF", "#F997DF"],
//series: seriesData,
series: [
{
"name": "西区",
"type": "line",
"data": [
12,
12,
24
]
},
{
"name": "西海岸新区",
"type": "line",
"data": [
9,
4,
4
]
},
],
grid: {
x: 50,
y: 55,
x2: 70,
y2: 20,
},
};
});
setRevenueData(lineChartOption(areaNames, xAxisData,"停车记录数(个)", seriesData));
};
function getParkingIncome() {
@ -384,9 +287,9 @@ function ParkingAlyPeriod() {
value: "id",
children: "children",
}}
value={formData.region}
value={formData.area_id}
onChange={(v, option) => {
setFormData({ ...formData, region: v ? v : null });
setFormData({ ...formData, area_id: v ? v : null });
}}
/>
</div>
@ -396,9 +299,9 @@ function ParkingAlyPeriod() {
className="form-con"
placeholder="请选择"
options={searchSelectList?.flow_type_list || []}
value={formData.pay_merchant_id}
value={formData.operator_id}
onChange={(v) =>
setFormData({ ...formData, pay_merchant_id: v })
setFormData({ ...formData, operator_id: v })
}
/>
</div>
@ -421,9 +324,9 @@ function ParkingAlyPeriod() {
value: '2',
},
]}
value={formData.pay_merchant_id}
value={formData.car_parking_type}
onChange={(v) =>
setFormData({ ...formData, pay_merchant_id: v })
setFormData({ ...formData, car_parking_type: v })
}
/>
</div>
@ -432,43 +335,19 @@ function ParkingAlyPeriod() {
<Input
className="form-con"
placeholder="请输入"
value={formData?.park}
value={formData?.road_name}
onChange={(e) =>
setFormData({ ...formData, park: e.target.value })
setFormData({ ...formData, road_name: e.target.value })
}
/>
</div>
<div className="yisa-search">
<label>日期
<div className="daf">
<Select
value={formData.date_type}
// style={{
// width: "100%",
// }}
placeholder="请选择"
options={[
{
value: "1",
label: "日",
},
{
value: "2",
label: "周",
},
{
value: "3",
label: "月",
},
]}
onChange={(e) => SetTimeNow(e)}
/>
</div>
</label>
<DatePicker
style={{ width: "100%" }}
// showTime
showTime
format={TimeChange().mat}
picker={TimeChange().str}
allowClear={false}
@ -541,6 +420,7 @@ function ParkingAlyPeriod() {
}
/>
</div>
<div className="form-btn">
<Button
className="reset"

8
src/pages/DataAnalysisPrediction/ParkingBusinessAly/echarts.config.js

@ -1,5 +1,5 @@
const lineChartOption = (areaNames, xAxisData, seriesData) => {
const lineChartOption = (areaNames, xAxisData, yAxisName, seriesData) => {
return {
title: {
text: "",
@ -36,7 +36,7 @@ const lineChartOption = (areaNames, xAxisData, seriesData) => {
},
yAxis: {
type: "value",
name: '停车记录数(次)',
name: yAxisName ? yAxisName : '',
min: 0,
// /max: 50,
interval: 10,
@ -119,6 +119,6 @@ const ringChartOption = (areaNames, ringData) => {
}
};
export {
lineChartOption,
ringChartOption,
lineChartOption,
ringChartOption,
}

7
src/services/DataAnalysisPrediction/ParkingBusinessAly/index.js

@ -57,10 +57,10 @@ const getParkingAlyDurationBerthList = (params) => {
data: params,
});
};
//停车业务分析-停车时长分析-停车时长
//停车业务分析-停车时长分析-平均停车时长排行榜
const getParkingAlyDurationParkingList = (params) => {
return ajax({
url: "",
url: "/api/ana/dataanalysis/show_average_parking_duration",
type: "post",
data: params,
});
@ -75,5 +75,6 @@ export default {
getParkingAlyDurationBar,
getParkingAlyDurationBerthList,
getParkingAlyDurationParkingList,
}
Loading…
Cancel
Save