Commit 288b648c authored by 涂伟's avatar 涂伟

fix: '运维同步地图组件新增防抖'

parent 4e277b58
Pipeline #87631 passed with stages
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
SyncMapComponent, SyncMapComponent,
BatchDragSingleWebsite, BatchDragSingleWebsite,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import debounce from 'lodash/debounce';
import { EditTwoTone, ExclamationCircleOutlined, OrderedListOutlined } from '@ant-design/icons'; import { EditTwoTone, ExclamationCircleOutlined, OrderedListOutlined } from '@ant-design/icons';
import Modal from 'antd/lib/modal/Modal'; import Modal from 'antd/lib/modal/Modal';
import ProCard from '@ant-design/pro-card'; import ProCard from '@ant-design/pro-card';
...@@ -224,8 +225,8 @@ const WebConfigPage = props => { ...@@ -224,8 +225,8 @@ const WebConfigPage = props => {
} else { } else {
url = url =
localStorage.getItem('pd2-baseUrl') && localStorage.getItem('pd2-baseUrl') &&
localStorage.getItem('pd2-baseUrl') != 'null' && localStorage.getItem('pd2-baseUrl') != 'null' &&
localStorage.getItem('pd2-baseUrl') != 'undefined' localStorage.getItem('pd2-baseUrl') != 'undefined'
? localStorage.getItem('pd2-baseUrl') + val ? localStorage.getItem('pd2-baseUrl') + val
: val; : val;
} }
...@@ -320,6 +321,8 @@ const WebConfigPage = props => { ...@@ -320,6 +321,8 @@ const WebConfigPage = props => {
}); });
}; };
const delayedSyncMap = debounce(data => SyncMap(data), 500);
const sort = () => { const sort = () => {
console.log(webs); console.log(webs);
setSortVisible(true); setSortVisible(true);
...@@ -345,26 +348,26 @@ const WebConfigPage = props => { ...@@ -345,26 +348,26 @@ const WebConfigPage = props => {
地图组件数量 地图组件数量
{tabPaneItem.existMapComponent < tabPaneItem.mapComponent ? ( {tabPaneItem.existMapComponent < tabPaneItem.mapComponent ? (
<Tooltip title="点击一键修复" placement="topRight"> <Tooltip title="点击一键修复" placement="topRight">
<span style={{ color: 'red' }} onClick={() => SyncMap(tabPaneItem)}> <span style={{ color: 'red' }} onClick={() => delayedSyncMap(tabPaneItem)}>
{tabPaneItem.existMapComponent} {tabPaneItem.existMapComponent}
</span> </span>
/ /
<span style={{ color: '#1890ff' }} onClick={() => SyncMap(tabPaneItem)}> <span style={{ color: '#1890ff' }} onClick={() => delayedSyncMap(tabPaneItem)}>
{tabPaneItem.mapComponent} {tabPaneItem.mapComponent}
</span> </span>
</Tooltip> </Tooltip>
) : ( ) : (
<Tooltip title="点击同步地图组件" placement="topRight"> <Tooltip title="点击同步地图组件" placement="topRight">
<span style={{ color: '#1890ff' }} onClick={() => SyncMap(tabPaneItem)}> <span style={{ color: '#1890ff' }} onClick={() => delayedSyncMap(tabPaneItem)}>
{tabPaneItem.existMapComponent} {tabPaneItem.existMapComponent}
</span> </span>
<span>/</span> <span>/</span>
{tabPaneItem.existMapComponent !== tabPaneItem.mapComponent ? ( {tabPaneItem.existMapComponent !== tabPaneItem.mapComponent ? (
<span style={{ color: '#1890ff' }} onClick={() => SyncMap(tabPaneItem)}> <span style={{ color: '#1890ff' }} onClick={() => delayedSyncMap(tabPaneItem)}>
{tabPaneItem.existMapComponent} {tabPaneItem.existMapComponent}
</span> </span>
) : ( ) : (
<span style={{ color: '#1890ff' }} onClick={() => SyncMap(tabPaneItem)}> <span style={{ color: '#1890ff' }} onClick={() => delayedSyncMap(tabPaneItem)}>
{tabPaneItem.mapComponent} {tabPaneItem.mapComponent}
</span> </span>
)} )}
......
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