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

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

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