From d79bdb10d35fd49c19aeb08e49dad5c96306e577 Mon Sep 17 00:00:00 2001 From: chengma Date: Sat, 15 Aug 2026 11:04:10 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=8E=8B=E7=BC=A9=E6=A1=A3=E5=8F=A3?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=A0=81=E7=AD=9B=E9=80=89=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=20(#239)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/inner_code_template_test.go | 54 ++++++++++++++++++++++++++++ admin/static/css/app.css | 13 +++++-- admin/templates/inner_code/list.html | 12 +++---- 3 files changed, 69 insertions(+), 10 deletions(-) diff --git a/admin/inner_code_template_test.go b/admin/inner_code_template_test.go index eaaba3f..245d928 100644 --- a/admin/inner_code_template_test.go +++ b/admin/inner_code_template_test.go @@ -65,3 +65,57 @@ func TestInnerCodeTemplate_模块状态白名单已登记(t *testing.T) { } } } + +func TestInnerCodeTemplate_筛选顺序与紧凑宽度(t *testing.T) { + raw, err := os.ReadFile("templates/inner_code/list.html") + if err != nil { + t.Fatal(err) + } + page := string(raw) + parts := []string{ + `id="inner-code-status"`, + `id="inner-code-date" type="date" name="date"`, + `id="inner-code-keyword"`, + `class="button-link" href="/inner-codes?date={{.BusinessDate}}">清除`, + ``, + } + lastIndex := -1 + for _, part := range parts { + index := strings.Index(page, part) + if index < 0 { + t.Fatalf("筛选工具栏缺少 %s", part) + } + if index <= lastIndex { + t.Fatalf("筛选工具栏顺序不正确,%s 没有位于上一控件之后", part) + } + lastIndex = index + } + filterStart := strings.Index(page, `
`) + if filterEnd < 0 { + t.Fatal("没有找到完整的档口入库码筛选表单") + } + filter := page[filterStart : filterStart+filterEnd] + if strings.Contains(filter, `type="hidden" name="date"`) { + t.Fatal("筛选表单应直接提交可见业务日期,不能继续保留重复隐藏字段") + } + + css, err := os.ReadFile("static/css/app.css") + if err != nil { + t.Fatal(err) + } + styles := string(css) + for _, want := range []string{ + `.inner-code-toolbar input[type="text"].inner-code-search`, + `flex: 0 0 150px`, `width: 150px`, `min-width: 150px`, + `.inner-code-toolbar .inner-code-filter-form { flex-wrap: wrap; }`, + `.inner-code-toolbar .inner-code-filter-form { flex-basis: 100%; }`, + } { + if !strings.Contains(styles, want) { + t.Errorf("筛选工具栏样式缺少 %s", want) + } + } +} diff --git a/admin/static/css/app.css b/admin/static/css/app.css index d136160..7fed973 100644 --- a/admin/static/css/app.css +++ b/admin/static/css/app.css @@ -624,8 +624,13 @@ input.wide { width: 100%; } .inner-code-status-failed { color: #b42318; background: #fff1f0; } .inner-code-status-pending { color: #57606a; background: #f3f4f6; } .inner-code-toolbar { flex: 0 0 auto; } -.inner-code-toolbar input[type="date"] { width: 138px; } -.inner-code-toolbar .inner-code-search { width: 220px; } +.inner-code-toolbar .inner-code-filter-form { flex-wrap: wrap; } +.inner-code-toolbar input[type="date"] { width: 138px; min-width: 138px; } +.inner-code-toolbar input[type="text"].inner-code-search { + flex: 0 0 150px; + width: 150px; + min-width: 150px; +} .inner-code-toolbar .file-field { display: inline-block; max-width: 150px; @@ -648,6 +653,10 @@ input.wide { width: 100%; } .ai-match-items-wrap { max-height: min(420px, 52vh); overflow: auto; } .ai-match-items-wrap th { position: sticky; top: 0; z-index: 1; } +@media (max-width: 760px) { + .inner-code-toolbar .inner-code-filter-form { flex-basis: 100%; } +} + select { padding: 5px 8px; border: 1px solid #ccd1d6; diff --git a/admin/templates/inner_code/list.html b/admin/templates/inner_code/list.html index 6562bff..a8b2e21 100644 --- a/admin/templates/inner_code/list.html +++ b/admin/templates/inner_code/list.html @@ -2,11 +2,6 @@ {{template "header" .}}
-
- - -
- @@ -16,17 +11,18 @@ -
- + + + - 清除 +