科目映射表序号列加宽到3.5rem,表头#改为序号

This commit is contained in:
yueyang 2026-09-29 11:47:43 +08:00
parent c56109f81c
commit b6e52f7bff
2 changed files with 17 additions and 5 deletions

View File

@ -103,11 +103,21 @@
/* 表格必须锁列宽(table-layout:fixed)。默认的自动列宽会按内容互相挤压,
「借方/贷方科目」两列会被挤到文字被截断;锁死后按上面 th 的宽度分配,
窗口不够宽时由外层 .upstream-data-table-scroll 横向滚动。
87.5rem = 各列宽度之和,改列宽时要一起改。 */
.am-table { table-layout: fixed; min-width: 87.5rem; }
89rem = 各列宽度之和,改列宽时要一起改。 */
.am-table { table-layout: fixed; min-width: 89rem; }
/* 只读单元格超长就省略号(编辑态那格要放开,否则下拉会被裁) */
.am-table > tbody > tr.am-item:not(.is-editing) > td { overflow: hidden; text-overflow: ellipsis; }
/* 序号列:3.5rem 才放得下三位数,居中并锁死数字等宽,
避免宽窗口下被按比例挤压后出现「1…」 */
.am-table .am-index {
width: 3.5rem;
min-width: 3.5rem;
max-width: 3.5rem;
text-align: center;
font-variant-numeric: tabular-nums;
}
/* 行内编辑 */
/* 注意:td 上有 height:2.5rem + white-space:nowrap(来自 upstream-data-table),
编辑态必须放开,否则一级/二级两个下拉会被压成一行、挤出单元格 */
@ -324,7 +334,7 @@
<table class="upstream-data-table am-table">
<thead>
<tr>
<th style="width:2.5rem;">#</th>
<th class="am-index" style="width:3.5rem;">序号</th>
<th style="width:4.5rem;">平台</th>
<th style="width:17rem;">账单项目</th>
<th style="width:12rem;">财务备注</th>
@ -492,7 +502,7 @@
var edit = (editingId === r.id && draft);
if (edit) {
return '<tr class="am-item is-editing" data-id="' + r.id + '">'
+ '<td>' + (index + 1) + '</td>'
+ '<td class="am-index">' + (index + 1) + '</td>'
+ '<td class="am-edit-cell"><input data-f="platform" value="' + esc(draft.platform) + '" list="amPlatformList"></td>'
+ '<td class="am-edit-cell"><input data-f="item" value="' + esc(draft.item) + '"></td>'
+ '<td class="am-edit-cell"><input data-f="memo" value="' + esc(draft.memo) + '"></td>'
@ -508,7 +518,7 @@
+ '</div></td></tr>';
}
return '<tr class="am-item" data-id="' + r.id + '" data-index="' + index + '">'
+ '<td>' + (index + 1) + '</td>'
+ '<td class="am-index">' + (index + 1) + '</td>'
+ '<td>' + esc(r.platform) + '</td>'
+ '<td><span class="am-caret">▶</span> <span title="' + esc(r.item) + '">' + esc(r.item) + '</span></td>'
+ '<td><span title="' + esc(r.memo) + '">' + esc(r.memo) + '</span></td>'

View File

@ -95,6 +95,8 @@ class AccountMappingPageTest extends FeatureTestCase
->assertSee('var ROWS = [', false)
->assertSee('"platform":"得物"', false)
->assertSeeText('科目映射表')
// 序号列表头固定为「序号」且宽度 3.5rem:2.5rem 时三位数会被省略号截成「1…」
->assertSee('class="am-index" style="width:3.5rem;">序号</th>', false)
// ENDPOINT 经 @json 输出,斜杠会被转义成 \/,所以只断言变量名
->assertSee('var ENDPOINT =', false);
}