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
c27cf46b
Commit
c27cf46b
authored
Aug 01, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复点击白屏问题;增加历史曲线表格的排序;
parent
0a460799
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
30 deletions
+48
-30
contributing.md
docs/contributing.md
+9
-0
App.jsx
packages/base-components/VmsVideo/src/App.jsx
+0
-1
index.js
packages/extend-components/EC_HistoryView/src/index.js
+39
-29
No files found.
docs/contributing.md
View file @
c27cf46b
...
...
@@ -41,6 +41,15 @@ npm run build
npm run release
```
```
bash
# 完整发布
npm run build
add commit your code
npm run release
# 发布后文件的格式化导致变更,需要还原一下。请注意,是发布完后还原。
git checkout
--
.
```
```
bash
# 在base-components下新增TreeCustom文件夹
lerna create @wisdom-components/TreeCustom base-components
...
...
packages/base-components/VmsVideo/src/App.jsx
View file @
c27cf46b
...
...
@@ -47,7 +47,6 @@ class App extends React.Component {
isResize
:
false
,
text
:
''
,
isFlv
:
false
,
loadingText
:
'加载中'
,
debug
:
false
,
recordType
:
'mp4'
,
loadingTimeout
:
10
,
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
c27cf46b
import
React
,
{
useContext
,
useEffect
,
useMemo
,
useState
}
from
'react'
;
import
React
,
{
useContext
,
useEffect
,
useMemo
,
useState
,
useCallback
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
classNames
from
'classnames'
;
import
{
...
...
@@ -218,6 +218,8 @@ const timeColumn = {
fixed
:
'left'
,
ellipsis
:
true
,
align
:
'center'
,
sorter
:
true
,
sortOrder
:
'descend'
};
const
HistoryView
=
(
props
)
=>
{
...
...
@@ -257,7 +259,7 @@ const HistoryView = (props) => {
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
tableData
,
setTableData
]
=
useState
([]);
const
[
chartDataSource
,
setChartDataSource
]
=
useState
([]);
const
[
timeOrder
,
setTimeOrder
]
=
useState
(
'descend'
);
const
[
chartType
,
setChartType
]
=
useState
(
'lineChart'
);
const
[
showBoxOption
,
setShowBoxOption
]
=
useState
(
true
);
// 选择的时间范围值
...
...
@@ -572,7 +574,7 @@ const HistoryView = (props) => {
});
};
const handleTableData = (data) => {
const handleTableData =
useCallback(
(data) => {
const ignoreOutliers = checkboxData.find((item) => item.key === 'ignoreOutliers').checked;
const dataIndexAccess = (dataItem, index) => {
const {stationCode, sensorName} = dataItem;
...
...
@@ -651,13 +653,13 @@ const HistoryView = (props) => {
aa = a.slice(contrastOption === 'day' ? 11 : 8, 16);
bb = b.slice(contrastOption === 'day' ? 11 : 8, 16);
}
return aa.localeCompare(bb);
return
timeOrder === 'descend' ? -aa.localeCompare(bb) :
aa.localeCompare(bb);
};
const times = Object.keys(timeData).sort(timeSort);
const tableData = times.map((time) => timeData[time]);
setColumns([timeColumn, ...columnsData]);
setTableData(tableData);
};
}
, [timeOrder])
;
const [deviceAlarmSchemes, setDeviceAlarmSchemes] = useState([]);
const beforChangeParams = (value = {}) => {
...
...
@@ -739,7 +741,6 @@ const HistoryView = (props) => {
setLoading(true);
Promise.all(requestArr).then((results) => {
if (results.length) {
debugger
let data = [];
results.forEach((res, index) => {
const {dateFrom, dateTo} = dateRange?.[index] ?? {};
...
...
@@ -787,7 +788,37 @@ const HistoryView = (props) => {
});
});
}, [dateRange, dataConfig, deviceParams, chartType]);
const handleChange = (pagination, filter, sort) => {
if (sort.field === 'time') {
debugger
setTimeOrder(sort.order)
}
};
const tableMemo = useMemo(() => {
return <>
<div className={`
$
{
prefixCls
}
-
options
`}>
{renderTimeOption()}
{renderCurveOption()}
</div>
<div className={`
$
{
prefixCls
}
-
content
`}>
{chartDataSource.length > 0 ? (
<BasicTable
dataSource={tableData.sort((a, b) => {
let _a = a.time;
let _b = b.time
return timeOrder === 'ascend' ? moment(_a) - moment(_b) : moment(_b) - moment(_a);
})}
columns={columns}
{...tableProps}
pagination={false}
onChange={handleChange}
/>
) : (
<PandaEmpty/>
)}
</div>
</>
}, [timeOrder, chartDataSource, columns, tableProps, tableData])
const renderPanel = (model) => {
if (model === 'curve') {
return (
...
...
@@ -830,28 +861,7 @@ const HistoryView = (props) => {
);
}
if (model === 'table') {
return (
<>
<div className={`
$
{
prefixCls
}
-
options
`}>
{renderTimeOption()}
{renderCurveOption()}
</div>
<div className={`
$
{
prefixCls
}
-
content
`}>
{chartDataSource.length > 0 ? (
<BasicTable
dataSource={tableData}
columns={columns}
{...tableProps}
pagination={false}
onChange={() => {
}}
/>
) : (
<PandaEmpty/>
)}
</div>
</>
);
return tableMemo;
}
};
...
...
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