This commit is contained in:
xman 2025-07-08 10:13:33 +08:00
parent 14c3e4e692
commit 8185086e5c

View File

@ -58,28 +58,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
// 为表格2绑定事件 // 为表格2绑定事件
Table.api.bindevent(table2); Table.api.bindevent(table2);
// ✅ 延迟初始化 citypicker 避免 dropdown 位置异常
setTimeout(function () { setTimeout(function () {
var $city = $('#select_city'); var $city = $('#select_city');
if (!$city.data('citypicker')) { if (!$city.data('citypicker')) {
$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");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province"); var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
$("#select_area_id").val(code); $("#select_area_id").val(code);
}); });
}, 100); // 手动调整dropdown位置确保它跟输入框对齐
var $dropdown = $('.city-picker-dropdown');
// ✅ 清理掉异常 dropdown保险 if ($dropdown.length) {
$('.city-picker-dropdown').each(function () { var offset = $city.offset();
var offset = $(this).offset(); $dropdown.css({
if (offset.top === 0 && offset.left === 0) { top: offset.top + $city.outerHeight() + 2, // +2像素做一点距离
$(this).remove(); left: offset.left,
display: 'block',
position: 'absolute',
'z-index': 9999
});
} }
}); }, 500);
} }