fix: 预付金模板多选 chosen 有选中项即隐藏搜索框,空态恢复占位

- 上一版仅全选时隐藏,仍有空框在剩余空间不足时换行占一行(簿记账户/资产类型单元格);
  改为有任意选中项即隐藏(点选场景无需键盘过滤),全部取消后恢复占位提示
- 去掉搜索框 max-width 限宽:空态时全宽展示"请选择…"
- 期限档位表操作列按钮去左边距+不换行,fixed 布局窄列下不再竖排
This commit is contained in:
hjhan
2026-08-28 09:25:57 +08:00
parent b398e392d0
commit 6d0986f2aa
3 changed files with 17 additions and 12 deletions
@@ -631,15 +631,16 @@ $(function () {
if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx);
});
//多选 chosen可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截;
//取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery changetrigger_form_field_change),
//多选 chosen已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白
//(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。
//勾选变化会触发原 select 的 jQuery changetrigger_form_field_change),
//加载重建/增删区块后的 refreshChosen 会触发 chosen:updated,两处都走这里的委托统一刷新
function refreshChosenSearchField(select) {
var $sel = $(select);
var $container = $sel.next('.chosen-container-multi');
if ($container.length === 0) return;
var allSelected = $sel.find('option').length > 0 && $sel.find('option:not(:selected)').length === 0;
$container.find('li.search-field').toggle(!allSelected);
var noneSelected = $sel.find('option:selected').length === 0;
$container.find('li.search-field').toggle(noneSelected);
}
$(document).on('change chosen:updated', 'select.chosen-select[multiple]', function () {
refreshChosenSearchField(this);
@@ -599,15 +599,16 @@ $(function () {
if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx);
});
//多选 chosen可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截;
//取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery changetrigger_form_field_change),
//多选 chosen已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白
//(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。
//勾选变化会触发原 select 的 jQuery changetrigger_form_field_change),
//加载重建/增删区块后的 refreshChosen 会触发 chosen:updated,两处都走这里的委托统一刷新
function refreshChosenSearchField(select) {
var $sel = $(select);
var $container = $sel.next('.chosen-container-multi');
if ($container.length === 0) return;
var allSelected = $sel.find('option').length > 0 && $sel.find('option:not(:selected)').length === 0;
$container.find('li.search-field').toggle(!allSelected);
var noneSelected = $sel.find('option:selected').length === 0;
$container.find('li.search-field').toggle(noneSelected);
}
$(document).on('change chosen:updated', 'select.chosen-select[multiple]', function () {
refreshChosenSearchField(this);
@@ -137,10 +137,13 @@ p {
width: 4px;
}
/*多选 chosen 的隐藏搜索框:全局 input[type=text] 152px 会把它撑宽到与已选标签挤不下而换行
在控件底部留出一截空行;限制宽度使 标签+搜索框 保持单行*/
.form-layout .chosen-container-multi .chosen-choices li.search-field input {
max-width: 70px;
/*多选 chosen:有选中项后由页面 JS 隐藏搜索框(见 marginTemplateV2*Edit.js 的 refreshChosenSearchField
空态时搜索框独占控件全宽,负责展示"请选择…"占位*/
/*期限档位表操作列:delBtn 的 20px 左边距在 fixed 布局的窄列里会把"- 删除区块"挤成竖排*/
.border.detail td .delBtn {
margin-left: 0;
white-space: nowrap;
}
/*区块标题(新模板信息/选择模板规则/参数组N):左色条 + 加粗,与表单正文分层*/