更新
This commit is contained in:
@ -146,9 +146,12 @@ export function MapUtil(map) {
|
||||
// 展示气泡框
|
||||
MapUtil.prototype.makerPopup = (item,flag,style = 'Dark')=>{
|
||||
// Dark Light Custom
|
||||
let marker;
|
||||
let flagPop = flag+'_pop'
|
||||
if(!_that._self[flagPop]) _that._self[flagPop] = [];
|
||||
if(style == 'Dark' || style == 'Light') {
|
||||
let list = zdyContent(flag,item);// 默认的样式
|
||||
map.createPopup([item.jd,item.wd],{
|
||||
marker = map.createPopup([item.jd,item.wd],{
|
||||
style:style, // 气泡框样式:
|
||||
data:list,
|
||||
title:item.ssbm,
|
||||
@ -157,7 +160,7 @@ export function MapUtil(map) {
|
||||
pixelOffset:[0,-50]
|
||||
})
|
||||
}else {
|
||||
map.createPopup([item.jd,item.wd],{
|
||||
marker = map.createPopup([item.jd,item.wd],{
|
||||
style:'Custom', // // 自定义样式
|
||||
attrs:{
|
||||
class:'popupCustom'
|
||||
@ -168,13 +171,14 @@ export function MapUtil(map) {
|
||||
pixelOffset:[0,-30]
|
||||
})
|
||||
}
|
||||
_that._self[flagPop].push(marker)
|
||||
}
|
||||
// 弹窗自定义默认内容
|
||||
function zdyContent(flag,item){
|
||||
switch (flag) {
|
||||
case 'hm':
|
||||
return [
|
||||
{ label:'临安码线索数量',value:item.lamsx },
|
||||
{ label:'林安码线索数量',value:item.lamsx },
|
||||
{ label:'布控预警数量',value:item.bkyj },
|
||||
{ label:'红色预警数量',value:item.hsyj },
|
||||
{ label:'信息采集数量',value:item.xxcjsl },
|
||||
@ -189,7 +193,7 @@ export function MapUtil(map) {
|
||||
html = `
|
||||
<div class="popupCustomBox">
|
||||
<div class="popupCustomTitle_title">${item.ssbm}</div>
|
||||
<div>临安码线索数量:${item.lamsx}</div>
|
||||
<div>林安码线索数量:${item.lamsx}</div>
|
||||
<div>布控预警数量:${item.bkyj}</div>
|
||||
<div>红色预警数量:${item.hsyj}</div>
|
||||
<div>信息采集数量:${item.xxcjsl}</div>
|
||||
|
||||
@ -287,27 +287,56 @@ const rowcontextmenuHland = (row, column, e) => {
|
||||
};
|
||||
|
||||
const timer = ref(null);
|
||||
const isCloned = ref(false);
|
||||
const originalBodyHeight = ref(0);
|
||||
// 鼠标进入
|
||||
const clearnScroll = () => {
|
||||
clearInterval(timer.value);
|
||||
timer.value = null;
|
||||
};
|
||||
|
||||
watch(() => props.tableData, () => {
|
||||
nextTick(() => {
|
||||
if (props.isScroll) createScroll();
|
||||
})
|
||||
},{deep:true});
|
||||
|
||||
// 鼠标离开
|
||||
const createScroll = () => {
|
||||
clearnScroll();
|
||||
// 拿到table
|
||||
const tabel = multipleTableRef.value.layout.table.refs;
|
||||
// 拿到可以滚动的元素
|
||||
const tableWrapper = tabel.bodyWrapper.firstElementChild.firstElementChild;
|
||||
if (props.isScroll) {
|
||||
timer.value = setInterval(() => {
|
||||
tableWrapper.scrollTop += 1;
|
||||
//判断滚动到底部,设置为0(可视高度+距离顶部 = 整个高度)
|
||||
if ( tableWrapper.clientHeight + tableWrapper.scrollTop == tableWrapper.scrollHeight) {
|
||||
tableWrapper.scrollTop = 0;
|
||||
nextTick(() => {
|
||||
const refsPath = multipleTableRef.value?.$refs || multipleTableRef.value?.layout?.table?.refs;
|
||||
const scrollEl = refsPath?.bodyWrapper || multipleTableRef.value?.$el?.querySelector('.el-table__body-wrapper');
|
||||
const tableEl = scrollEl?.querySelector('table') || multipleTableRef.value?.$el?.querySelector('.el-table__body-wrapper table');
|
||||
const bodyEl = tableEl?.tBodies?.[0];
|
||||
if (!props.isScroll || !scrollEl || !tableEl || !bodyEl) return;
|
||||
if (!props.tableHeight) {
|
||||
const fixedH = scrollEl.clientHeight || multipleTableRef.value?.$el?.clientHeight || 0;
|
||||
if (fixedH > 0) {
|
||||
scrollEl.style.height = fixedH + 'px';
|
||||
scrollEl.style.overflowY = 'auto';
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
originalBodyHeight.value = bodyEl.offsetHeight;
|
||||
const oldClone = tableEl.querySelector('tbody[data-clone="true"]');
|
||||
if (oldClone) {
|
||||
tableEl.removeChild(oldClone);
|
||||
isCloned.value = false;
|
||||
}
|
||||
if (!isCloned.value) {
|
||||
const clone = bodyEl.cloneNode(true);
|
||||
clone.setAttribute('data-clone', 'true');
|
||||
tableEl.appendChild(clone);
|
||||
isCloned.value = true;
|
||||
}
|
||||
const target = scrollEl.firstElementChild?.firstElementChild || scrollEl;
|
||||
timer.value = setInterval(() => {
|
||||
target.scrollTop += 1;
|
||||
if (target.scrollTop >= originalBodyHeight.value) {
|
||||
target.scrollTop -= originalBodyHeight.value;
|
||||
}
|
||||
}, 20);
|
||||
});
|
||||
};
|
||||
|
||||
// 滚动-触底加载
|
||||
@ -370,4 +399,10 @@ onUnmounted(() => {
|
||||
.header-icon {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
watch(() => props.isScroll, (val) => {
|
||||
nextTick(() => {
|
||||
if (val) createScroll();
|
||||
else clearnScroll();
|
||||
});
|
||||
},{immediate:true});
|
||||
|
||||
Reference in New Issue
Block a user