Commit da122e60 authored by 涂茜's avatar 涂茜

fix: bug

parent b27051f5
Pipeline #28135 passed with stages
in 5 minutes 1 second
...@@ -43,7 +43,7 @@ const Demo = () => { ...@@ -43,7 +43,7 @@ const Demo = () => {
pageSize: 20, pageSize: 20,
// deviceTypes: '二供泵房,二供机组', // deviceTypes: '二供泵房,二供机组',
getChild: true, getChild: true,
// userID: 1, userID: 1,
// queryInfo: '', // queryInfo: '',
// sortFields: '', // sortFields: '',
// direction: '', // direction: '',
......
...@@ -22,7 +22,7 @@ const DeviceTree = (props) => { ...@@ -22,7 +22,7 @@ const DeviceTree = (props) => {
const [treeData, setTreeData] = useState([]); const [treeData, setTreeData] = useState([]);
const [params, setParams] = useState({}); const [params, setParams] = useState({});
const [total, setTotal] = useState(0); const [totalCount, setTotalCount] = useState(0);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
useEffect(() => { useEffect(() => {
...@@ -31,7 +31,7 @@ const DeviceTree = (props) => { ...@@ -31,7 +31,7 @@ const DeviceTree = (props) => {
pageSize: serviceParams.pageSize || 20, pageSize: serviceParams.pageSize || 20,
deviceTypes: serviceParams.deviceTypes || '二供泵房,二供机组', deviceTypes: serviceParams.deviceTypes || '二供泵房,二供机组',
getChild: serviceParams.getChild, getChild: serviceParams.getChild,
userID: serviceParams.userID || 0, userID: serviceParams.userID || '',
queryInfo: serviceParams.queryInfo || '', queryInfo: serviceParams.queryInfo || '',
sortFields: serviceParams.sortFields || '', sortFields: serviceParams.sortFields || '',
direction: serviceParams.direction || '', direction: serviceParams.direction || '',
...@@ -61,7 +61,7 @@ const DeviceTree = (props) => { ...@@ -61,7 +61,7 @@ const DeviceTree = (props) => {
const newData = handleData(data); const newData = handleData(data);
setLoading(false); setLoading(false);
setTreeData(newData); setTreeData(newData);
setTotal(response.data.totalPages); setTotalCount(response.data.totalCount);
onTreeCheck([newData[0]]); onTreeCheck([newData[0]]);
onTreeSelect([newData[0]]); onTreeSelect([newData[0]]);
} else { } else {
...@@ -118,7 +118,7 @@ const DeviceTree = (props) => { ...@@ -118,7 +118,7 @@ const DeviceTree = (props) => {
onChange={onSearch} onChange={onSearch}
onPressEnter={onSearch} onPressEnter={onSearch}
/> />
<Divider /> <Divider className={classNames(`${prefixCls}-divider`)} />
<div className={classNames(`${prefixCls}-content`)}> <div className={classNames(`${prefixCls}-content`)}>
<Spin spinning={loading}> <Spin spinning={loading}>
{!!treeData.length && ( {!!treeData.length && (
...@@ -143,11 +143,16 @@ const DeviceTree = (props) => { ...@@ -143,11 +143,16 @@ const DeviceTree = (props) => {
hideOnSinglePage hideOnSinglePage
current={params.pageIndex || 1} current={params.pageIndex || 1}
pageSize={params.pageSize || 20} pageSize={params.pageSize || 20}
total={total} total={totalCount}
onChange={onPaginationChange} onChange={onPaginationChange}
/> />
</div> </div>
)} )}
{!pagination && (
<Divider plain className={classNames(`${prefixCls}-total`)}>
{totalCount} 记录
</Divider>
)}
</div> </div>
); );
}; };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
height: 100%; height: 100%;
padding: 5px; padding: 5px;
.ant-divider { &-divider {
margin: 6px 0 12px 0; margin: 6px 0 12px 0;
} }
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
width: 100%; width: 100%;
} }
.ant-tree-indent { .ant-tree-switcher-noop {
width: 0; width: 14px;
} }
.ant-tree-node-content-wrapper { .ant-tree-node-content-wrapper {
...@@ -46,4 +46,14 @@ ...@@ -46,4 +46,14 @@
&-pagination { &-pagination {
margin: 10px auto; margin: 10px auto;
} }
&-total.ant-divider-horizontal.ant-divider-with-text {
margin: 10px auto;
color: #a4b1c7;
}
.ant-divider-horizontal.ant-divider-with-text::before,
.ant-divider-horizontal.ant-divider-with-text::after {
top: 0;
}
} }
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