Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
6ede4c74
Commit
6ede4c74
authored
Sep 19, 2023
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改
parent
b43c4882
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
index.js
.../extend-components/EC_StatisticalHistoryView/src/index.js
+13
-10
No files found.
packages/extend-components/EC_StatisticalHistoryView/src/index.js
View file @
6ede4c74
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment