This commit is contained in:
xman 2025-07-08 10:10:33 +08:00
parent 4485912f7e
commit 14c3e4e692

View File

@ -58,14 +58,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
// 为表格2绑定事件
Table.api.bindevent(table2);
var $city = $('#select_city');
// 延迟初始化,确保元素可见
// ✅ 延迟初始化 citypicker 避免 dropdown 位置异常
setTimeout(function () {
if ($city.data('citypicker')) {
$city.citypicker('destroy');
var $city = $('#select_city');
if (!$city.data('citypicker')) {
$city.citypicker();
}
$city.citypicker();
$city.off("cp:updated").on("cp:updated", function () {
var citypicker = $(this).data("citypicker");
@ -73,15 +71,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
$("#select_area_id").val(code);
});
// 手动调整弹层位置,补偿插件可能没有正确计算
var $dropdown = $('.city-picker-dropdown');
var offset = $city.offset();
$dropdown.css({
top: offset.top + $city.outerHeight(),
left: offset.left
});
}, 100);
}, 200);
// ✅ 清理掉异常 dropdown保险
$('.city-picker-dropdown').each(function () {
var offset = $(this).offset();
if (offset.top === 0 && offset.left === 0) {
$(this).remove();
}
});
}