This commit is contained in:
xman 2025-07-08 10:03:25 +08:00
parent 9e28431346
commit ca630c0c6d
2 changed files with 16 additions and 14 deletions

View File

@ -11,7 +11,9 @@
z-index: 9999; z-index: 9999;
max-height: 400px; max-height: 400px;
overflow: auto; overflow: auto;
display: none; background: #fff;
border: 1px solid #ccc;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
} }
</style> </style>

View File

@ -58,22 +58,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
// 为表格2绑定事件 // 为表格2绑定事件
Table.api.bindevent(table2); Table.api.bindevent(table2);
// ✅ 延迟初始化 citypicker 避免 dropdown 位置异常
setTimeout(function () {
var $city = $('#select_city');
if (!$city.data('citypicker')) {
$city.citypicker();
}
$city.off("cp:updated").on("cp:updated", function () {
var citypicker = $(this).data("citypicker");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
$("#select_area_id").val(code);
});
// ✅ 初始化 citypicker只初始化一次 }, 100);
var $city = $('#select_city');
if (!$city.data('citypicker')) {
$city.citypicker();
}
// ✅ 绑定 updated 事件(也只绑定一次) // ✅ 清理掉异常 dropdown保险
$city.off("cp:updated").on("cp:updated", function () {
var citypicker = $(this).data("citypicker");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
$("#select_area_id").val(code);
});
// ✅ 删除错误 dropdown
$('.city-picker-dropdown').each(function () { $('.city-picker-dropdown').each(function () {
var offset = $(this).offset(); var offset = $(this).offset();
if (offset.top === 0 && offset.left === 0) { if (offset.top === 0 && offset.left === 0) {