From 6d0986f2aabee468bf57575e90d10418524bd752 Mon Sep 17 00:00:00 2001 From: hjhan Date: Fri, 28 Aug 2026 09:25:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A2=84=E4=BB=98=E9=87=91=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=A4=9A=E9=80=89=20chosen=20=E6=9C=89=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E9=A1=B9=E5=8D=B3=E9=9A=90=E8=97=8F=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86=EF=BC=8C=E7=A9=BA=E6=80=81=E6=81=A2=E5=A4=8D=E5=8D=A0?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 上一版仅全选时隐藏,仍有空框在剩余空间不足时换行占一行(簿记账户/资产类型单元格); 改为有任意选中项即隐藏(点选场景无需键盘过滤),全部取消后恢复占位提示 - 去掉搜索框 max-width 限宽:空态时全宽展示"请选择…" - 期限档位表操作列按钮去左边距+不换行,fixed 布局窄列下不再竖排 --- .../app/marginTemplate/marginTemplateV2DefaultEdit.js | 9 +++++---- .../app/marginTemplate/marginTemplateV2Edit.js | 9 +++++---- YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css | 11 +++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js index 34699cb4..8fb25572 100644 --- a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js +++ b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js @@ -631,15 +631,16 @@ $(function () { if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx); }); - //多选 chosen:可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截; - //取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery change(trigger_form_field_change), + //多选 chosen:已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白 + //(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。 + //勾选变化会触发原 select 的 jQuery change(trigger_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); diff --git a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js index f725c624..90a3d144 100644 --- a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js +++ b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js @@ -599,15 +599,16 @@ $(function () { if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx); }); - //多选 chosen:可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截; - //取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery change(trigger_form_field_change), + //多选 chosen:已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白 + //(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。 + //勾选变化会触发原 select 的 jQuery change(trigger_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); diff --git a/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css b/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css index 424ff76d..6d098cca 100644 --- a/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css +++ b/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css @@ -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):左色条 + 加粗,与表单正文分层*/