This commit is contained in:
xman 2025-07-08 10:09:11 +08:00
parent f02bdbcb85
commit 4485912f7e

View File

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