This commit is contained in:
xman 2025-07-08 10:16:51 +08:00
parent eaf37bfe5e
commit 9dcfda0cb9

View File

@ -60,27 +60,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
setTimeout(function () { setTimeout(function () {
var $city = $('#select_city'); var $city = $('#select_city');
if (!$city.data('citypicker')) { if ($city.data('citypicker')) {
$city.citypicker(); $city.citypicker('destroy');
} }
$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);
}); });
// 手动调整dropdown位置确保它跟输入框对齐
var $dropdown = $('.city-picker-dropdown');
if ($dropdown.length) {
var offset = $city.offset();
$dropdown.css({
top: offset.top + $city.outerHeight() + 2, // +2像素做一点距离
left: offset.left,
display: 'block',
position: 'absolute',
'z-index': 9999
});
}
}, 500); }, 500);
} }