Commit 6ede4c74 authored by 李纪文's avatar 李纪文

fix: 修改

parent b43c4882
......@@ -51,8 +51,8 @@ const StatisticalHistoryView = (props) => {
// 自定义时间选择
const onDateChange = (value, dateString) => {
setDateTime(dateString);
const start = moment(value).subtract(2, picker).format('YYYY-MM-DD 00:00:00');
const end = moment(value).format('YYYY-MM-DD 23:59:59');
const start = moment(value).subtract(2, picker).startOf(picker).format('YYYY-MM-DD 00:00:00');
const end = moment(value).endOf(picker).format('YYYY-MM-DD 23:59:59');
setTime({ startDate: start, endDate: end });
};
......@@ -203,12 +203,15 @@ const StatisticalHistoryView = (props) => {
data: [data0, data1, data2],
name: timeName,
};
const dataTable = data0.map((item, index) => {
const _data = [data0, data1, data2].sort((a, b) => {
return b.length - a.length;
})
const dataTable = _data[0].map((item, index) => {
return {
...item,
value0: item?.value === 0 || item?.value ? item?.value : '-',
value1: data1[index]?.value === 0 || data1[index]?.value ? data1[index]?.value : '-',
value2: data2[index]?.value === 0 || data2[index]?.value ? data2[index]?.value : '-',
value0: data0[index] ? data0[index]?.value === 0 || data0[index]?.value ? data0[index]?.value : '-' : '',
value1: data1[index] ? data1[index]?.value === 0 || data1[index]?.value ? data1[index]?.value : '-' : '',
value2: data2[index] ? data2[index]?.value === 0 || data2[index]?.value ? data2[index]?.value : '-' : '',
};
});
renderChart(dataChart, data);
......@@ -356,7 +359,7 @@ const StatisticalHistoryView = (props) => {
{columns.map((item, index) => {
let sum = 0;
currentData.reduce((prev, next) => {
sum += next[item.dataIndex] === '-' ? 0 : next[item.dataIndex];
sum += next[item.dataIndex] === '-' || next[item.dataIndex] === '' ? 0 : next[item.dataIndex];
}, 0);
return (
<Table.Summary.Cell key={item.dataIndex} index={index} align={'center'}>
......@@ -397,8 +400,8 @@ const StatisticalHistoryView = (props) => {
setPicker('year');
break;
case 'customer':
start = moment().startOf(picker).subtract(2, picker).format('YYYY-MM-DD 00:00:00');
end = moment().endOf(picker).format('YYYY-MM-DD 23:59:59');
start = moment(dateTime).startOf(picker).subtract(2, picker).format('YYYY-MM-DD 00:00:00');
end = moment(dateTime).endOf(picker).format('YYYY-MM-DD 23:59:59');
break;
}
setTime({ startDate: start, endDate: end });
......@@ -432,7 +435,7 @@ const StatisticalHistoryView = (props) => {
onChange={onPickerChange}
className={classNames(`${prefixCls}-select`)}
/>
<DatePicker onChange={onDateChange} value={moment(dateTime)} picker={picker} />
<DatePicker onChange={onDateChange} value={moment(dateTime)} picker={picker} allowClear={false}/>
</>
)}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment