table-redesign.html
35.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>列表操作列与表格重设计 · uj-admin</title>
<style>
:root {
/* 全部取自 packages/design-tokens/src/palette.ts,不另起色系 */
--brand: #2b5ce6;
--brand-hover: #4b75ea;
--brand-soft: #eef3ff;
--page: #f4f6fa;
--base: #ffffff;
--raised: #f8fafc;
--hover: #f2f5fa;
--line: #e6ebf2;
--divider: #eef1f6;
--text-1: #1d2533;
--text-2: #4a5568;
--text-3: #8a94a6;
--header: #5a6779;
--success: #16a34a;
--success-soft: #e9f7ef;
--error: #e5484d;
--error-soft: #fdedee;
--neutral-soft: #f2f4f8;
--radius-card: 10px;
--shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px -2px rgba(16, 24, 40, 0.08);
--ease: cubic-bezier(0.4, 0, 0.2, 1);
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
body {
background: var(--page);
color: var(--text-1);
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei',
system-ui, sans-serif;
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
.doc {
max-width: 1180px;
margin: 0 auto;
padding: 28px 24px 64px;
}
/* ---------- 文档头 / 设计计划 ---------- */
.doc-head {
margin-bottom: 20px;
}
.eyebrow {
color: var(--text-3);
font-size: 12px;
letter-spacing: 0.06em;
text-transform: uppercase;
}
h1 {
margin: 6px 0 8px;
font-size: 26px;
font-weight: 600;
letter-spacing: -0.01em;
}
.lede {
margin: 0;
max-width: 760px;
color: var(--text-2);
font-size: 14px;
line-height: 1.75;
}
.plan {
margin-top: 18px;
padding: 18px 20px;
background: var(--base);
border: 1px solid var(--line);
border-radius: var(--radius-card);
box-shadow: var(--shadow-card);
}
.plan h2 {
margin: 0 0 14px;
font-size: 15px;
font-weight: 600;
}
.plan-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
gap: 18px 26px;
}
.plan-grid h3 {
margin: 0 0 8px;
color: var(--text-3);
font-size: 11px;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.plan-grid p,
.plan-grid ul {
margin: 0;
color: var(--text-2);
font-size: 13px;
line-height: 1.8;
}
.plan-grid ul {
padding-left: 16px;
}
.swatches {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
}
.sw {
width: 22px;
height: 22px;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.06);
}
code {
padding: 1px 5px;
border-radius: 3px;
background: var(--neutral-soft);
color: var(--text-2);
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
font-size: 12px;
}
/* ---------- 控制条 ---------- */
.controls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin: 22px 0 12px;
}
.ctrl-group {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 3px;
background: var(--base);
border: 1px solid var(--line);
border-radius: 8px;
}
.ctrl-label {
margin-right: 4px;
padding-left: 8px;
color: var(--text-3);
font-size: 12px;
}
.seg {
height: 28px;
padding: 0 11px;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--text-2);
font: inherit;
font-size: 12px;
cursor: pointer;
transition:
background-color 0.16s var(--ease),
color 0.16s var(--ease);
}
.seg:hover {
background: var(--hover);
}
.seg.is-on {
background: var(--brand);
color: #fff;
font-weight: 500;
}
.ctrl-hint {
color: var(--text-3);
font-size: 12px;
}
/* ---------- 卡片 / 页面骨架 ---------- */
.card {
background: var(--base);
border: 1px solid var(--line);
border-radius: var(--radius-card);
box-shadow: var(--shadow-card);
overflow: hidden;
}
.page-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 18px 20px 14px;
}
.page-title {
margin: 0 0 4px;
font-size: 20px;
font-weight: 600;
line-height: 1.4;
}
.page-desc {
margin: 0;
color: var(--text-3);
font-size: 13px;
}
.btn-primary {
height: 36px;
padding: 0 16px;
border: 0;
border-radius: 6px;
background: var(--brand);
color: #fff;
font: inherit;
font-size: 14px;
font-weight: 500;
cursor: pointer;
}
.filter {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
margin: 0 20px 14px;
padding: 12px 16px;
border: 1px solid var(--line);
border-radius: 8px;
}
.field {
display: flex;
align-items: center;
gap: 8px;
}
.field label {
color: var(--text-2);
font-size: 12px;
white-space: nowrap;
}
.field input,
.field select {
width: 168px;
height: 30px;
padding: 0 9px;
border: 1px solid var(--line);
border-radius: 6px;
background: #fff;
color: var(--text-2);
font: inherit;
font-size: 13px;
}
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
border-top: 1px solid var(--divider);
border-bottom: 1px solid var(--divider);
color: var(--text-3);
font-size: 13px;
font-variant-numeric: tabular-nums;
}
/* ---------- 表格 ---------- */
.scroller {
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: thin;
}
.scroller::-webkit-scrollbar {
height: 8px;
}
.scroller::-webkit-scrollbar-thumb {
border-radius: 4px;
background: #d6dee9;
}
table {
width: 1530px;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
}
body.v-after table {
width: 1444px;
}
th,
td {
padding: 10px 16px;
text-align: left;
border-bottom: 1px solid var(--divider);
font-size: 13px;
line-height: 20px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
th {
height: 42px;
background-color: var(--raised);
color: var(--header);
font-weight: 500;
}
td {
height: 44px;
background-color: var(--base);
color: var(--text-1);
}
tbody tr:last-child td {
border-bottom: 0;
}
tbody tr:hover td {
background-color: var(--hover);
}
/* 改版后:表头下边界坐实、行距更从容 */
body.v-after th {
border-bottom-color: var(--line);
}
body.v-after th,
body.v-after td {
padding-block: 12px;
}
body.v-compact th,
body.v-compact td {
padding-block: 8px;
}
/* 固定右列:项目里 actionColumnFixed 默认 right */
.op {
position: sticky;
right: 0;
z-index: 2;
}
th.op {
z-index: 3;
}
body.v-after .op {
box-shadow: inset 1px 0 0 0 var(--line);
}
/* 对齐轴:只在调试时叠加,不进产品 */
body.v-axis th,
body.v-axis td {
background-image: linear-gradient(90deg, rgba(43, 92, 230, 0.32) 0 1px, transparent 1px);
background-position: 16px 0;
background-repeat: no-repeat;
}
body.v-axis th.op,
body.v-axis td.op {
background-image:
linear-gradient(90deg, rgba(43, 92, 230, 0.32) 0 1px, transparent 1px),
linear-gradient(
90deg,
transparent calc(100% - 16px),
rgba(230, 72, 77, 0.42) calc(100% - 16px) calc(100% - 15px),
transparent calc(100% - 15px)
);
}
/* 标签 */
.tag {
display: inline-flex;
align-items: center;
gap: 5px;
height: 22px;
padding: 0 8px;
border-radius: 4px;
font-size: 12px;
line-height: 1;
white-space: nowrap;
}
.tag-info {
background: var(--brand-soft);
color: var(--brand);
}
.tag-neutral {
background: var(--neutral-soft);
color: var(--text-2);
}
.tag-ok {
background: var(--success-soft);
color: var(--success);
}
/* 改版前:antd 的近似色 + 文字圆点 ●(基线会随字体漂移) */
body:not(.v-after) .tag-info {
background: #f0f5ff;
color: #2b5ce6;
}
body:not(.v-after) .tag-ok {
background: #f6ffed;
color: #389e0d;
}
/* 改版后:圆点改 CSS 画,基线不随字体变;启用/停用共用同一形状 */
body.v-after .tag-ok::before,
body.v-after td .tag-neutral.is-status::before {
content: '';
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
body.v-after .dot-char {
display: none;
}
.code {
color: var(--text-2);
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
font-size: 12px;
}
.strong {
font-weight: 500;
}
.muted {
color: var(--text-3);
}
.num {
text-align: right;
font-variant-numeric: tabular-nums;
}
/* 行内操作 */
.acts {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-end;
gap: 4px;
white-space: nowrap;
}
.abtn {
height: 24px;
padding: 0 7px;
border: 0;
border-radius: 4px;
background: transparent;
color: var(--brand);
font: inherit;
font-size: 13px;
line-height: 24px;
cursor: pointer;
transition:
background-color 0.14s var(--ease),
color 0.14s var(--ease);
}
.abtn.danger {
color: #ff4d4f;
}
body.v-after .acts {
justify-content: flex-start;
}
/* 一行只留一个常驻彩色:主操作 */
body.v-after .abtn {
color: var(--text-2);
}
body.v-after .abtn.primary {
color: var(--brand);
}
/* 按钮 hover 时整行必然已变浅蓝,用白底浮出热区:
比再叠一层淡蓝更可辨识,也不引入第二种彩色 */
body.v-after .abtn:hover {
background: var(--base);
color: var(--brand);
}
body.v-after .abtn.danger:hover {
background: var(--error-soft);
color: var(--error);
}
/* 层级对比开关:退回三个等权彩色(只看对齐改动时用) */
body.v-flat.v-after .abtn {
color: var(--brand);
}
body.v-flat.v-after .abtn.danger {
color: #ff4d4f;
}
body.v-after .abtn:focus-visible {
outline: 2px solid var(--brand);
outline-offset: 1px;
}
/* 分页 */
.pager {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
padding: 12px 20px;
border-top: 1px solid var(--divider);
}
.pager .total {
margin-right: auto;
color: var(--text-3);
font-size: 13px;
font-variant-numeric: tabular-nums;
}
.pg {
min-width: 30px;
height: 30px;
padding: 0 6px;
border: 1px solid var(--line);
border-radius: 4px;
background: #fff;
color: var(--text-2);
font: inherit;
font-size: 13px;
font-variant-numeric: tabular-nums;
cursor: pointer;
}
.pg.is-on {
border-color: var(--brand);
background: var(--brand);
color: #fff;
font-weight: 600;
}
.pg-size {
height: 30px;
padding: 0 8px;
border: 1px solid var(--line);
border-radius: 4px;
background: #fff;
color: var(--text-2);
font: inherit;
font-size: 13px;
}
/* ---------- 说明区 ---------- */
.notes {
margin-top: 28px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 16px;
}
.note {
padding: 20px 22px;
background: var(--base);
border: 1px solid var(--line);
border-radius: var(--radius-card);
box-shadow: var(--shadow-card);
}
.note h2 {
margin: 0 0 12px;
font-size: 16px;
font-weight: 600;
}
.note h3 {
margin: 16px 0 6px;
font-size: 13px;
font-weight: 600;
}
.note p,
.note li {
color: var(--text-2);
font-size: 13px;
line-height: 1.8;
}
.note ul,
.note ol {
margin: 0;
padding-left: 18px;
}
.note p {
margin: 0 0 8px;
}
.kv {
display: grid;
grid-template-columns: 92px 1fr;
gap: 4px 10px;
font-size: 12px;
line-height: 1.8;
}
.kv b {
color: var(--text-3);
font-weight: 500;
}
.legend {
margin-top: 16px;
color: var(--text-3);
font-size: 12px;
line-height: 1.8;
}
@media (max-width: 720px) {
.doc {
padding: 20px 12px 48px;
}
.page-head {
flex-direction: column;
}
}
@media (prefers-reduced-motion: reduce) {
* {
transition: none !important;
}
}
</style>
</head>
<body class="v-after">
<div class="doc">
<header class="doc-head">
<div class="eyebrow">uj-admin · 企业级列表组件</div>
<h1>操作列与表格重设计</h1>
<p class="lede">
截图来自「系统设置 /
角色管理」。问题不在操作列本身,而在共享组件把「列宽」交给页面拍脑袋、又让表头与单元格各用一套对齐锚点。本页把改版前后放在同一张真实表格上对照,所有数据取自项目真实配置,页面无需登录即可逐状态检查。
</p>
<section class="plan" aria-label="设计计划">
<h2>设计计划(先定 token,再动笔)</h2>
<div class="plan-grid">
<div>
<h3>配色 · 沿用项目基线</h3>
<div class="swatches" aria-hidden="true">
<span class="sw" style="background: #2b5ce6"></span>
<span class="sw" style="background: #1d2533"></span>
<span class="sw" style="background: #4a5568"></span>
<span class="sw" style="background: #5a6779"></span>
<span class="sw" style="background: #f8fafc; border-color: #e6ebf2"></span>
<span class="sw" style="background: #eef1f6; border-color: #e6ebf2"></span>
<span class="sw" style="background: #16a34a"></span>
<span class="sw" style="background: #e5484d"></span>
</div>
<p>
<code>#2B5CE6</code> 主操作 / <code>#4A5568</code> 次操作 /
<code>#5A6779</code> 表头 / <code>#EEF1F6</code> 行线 /
<code>#E6EBF2</code> 边界。<br />一行只有一个常驻彩色;红只在 hover 或确认弹窗出现。
</p>
</div>
<div>
<h3>字阶 · 1 个字族两级字号</h3>
<p>
系统字族。表头与单元格 <code>13px / 20px</code>,标签与辅助
<code>12px</code>,页面标题 <code>20px / 600</code>。表头
<code>500</code> 不加粗,单元格主值 <code>500</code>,避免正文盖过表头。数字统一
<code>tabular-nums</code>。
</p>
</div>
<div>
<h3>版式 · 单一左锚点</h3>
<p>
ASCII 线框:<code>│ 名称 │ 编码 │ 描述 │ 类型 │ 状态 │ 操作 │</code><br />
每列内容起点 = 列左边界 +
16px,表头与单元格共用这一条竖线。操作列固定右侧,但不再右推内容。唯一例外是数值列右对齐(数据可读性优先)。
</p>
</div>
<div>
<h3>原则 · 效率优先,克制收口</h3>
<ul>
<li>列宽由内容决定,不由页面配置决定</li>
<li>分割线代替色块,不加阴影与斑马纹</li>
<li>破坏性操作默认中性、hover 才显红</li>
<li>不收起操作到「更多」下拉:多一次点击换不来美观</li>
</ul>
</div>
</div>
<p style="margin-top: 14px; color: var(--text-3); font-size: 12px">
<b>对照 brief 自检</b>:默认套路是「给操作列加胶囊按钮 / 图标按钮 / 更多下拉 / 斑马纹 /
彩色表头」。本稿一条未用:改动落在列宽公式与对齐锚点上,视觉增量只有「表头下边界 +
固定列左边界 + 层级字色 + CSS 状态点」四处,且全部复用项目已有
token。为差异化重排品牌色会与侧栏、登录页脱节,已否决。
</p>
</section>
</header>
<div class="controls" role="group" aria-label="原型状态切换">
<div class="ctrl-group">
<span class="ctrl-label">版本</span>
<button type="button" class="seg" data-mode="before">改版前</button>
<button type="button" class="seg is-on" data-mode="after">改版后</button>
</div>
<div class="ctrl-group">
<button type="button" class="seg" data-toggle="axis">显示对齐轴</button>
<button type="button" class="seg" data-toggle="compact">紧凑行高</button>
<button type="button" class="seg" data-toggle="flat">操作等权</button>
<button type="button" class="seg" data-scroll="left">滚到最左</button>
<button type="button" class="seg" data-scroll="right">滚到最右</button>
</div>
<span class="ctrl-hint">把鼠标移到数据行和操作按钮上看响应态</span>
</div>
<section class="card" aria-label="角色管理表格">
<div class="page-head">
<div>
<h2 class="page-title">角色管理</h2>
<p class="page-desc">
维护角色清单与基本信息,支持按关键字筛选;角色的菜单可见范围在「查看详情」中配置。
</p>
</div>
<button type="button" class="btn-primary">新增角色</button>
</div>
<div class="filter">
<div class="field">
<label>角色名称 / 编码</label><input value="" placeholder="模糊搜索" />
</div>
<div class="field">
<label>类型</label
><select>
<option>全部</option>
</select>
</div>
<div class="field">
<label>状态</label
><select>
<option>全部</option>
</select>
</div>
</div>
<div class="toolbar"><span>共 8 条</span><span class="muted">最近同步 17:32</span></div>
<div class="scroller" id="scroller">
<table>
<colgroup>
<col style="width: 220px" />
<col style="width: 220px" />
<col style="width: 120px" />
<col style="width: 450px" />
<col style="width: 120px" />
<col style="width: 120px" />
<col id="op-col" style="width: 280px" />
</colgroup>
<thead>
<tr>
<th>角色名称</th>
<th>角色编码</th>
<th class="num">账号数</th>
<th>角色描述</th>
<th>类型</th>
<th>状态</th>
<th class="op" id="op-head">操作</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</div>
<div class="pager">
<span class="total">共 8 条</span>
<button type="button" class="pg" aria-label="上一页">‹</button>
<button type="button" class="pg is-on">1</button>
<button type="button" class="pg">2</button>
<button type="button" class="pg" aria-label="下一页">›</button>
<select class="pg-size" aria-label="每页条数">
<option>10 条/页</option>
<option>20 条/页</option>
</select>
</div>
</section>
<div class="notes">
<section class="note">
<h2>1 · 页面现存问题</h2>
<ol>
<li>
<b>表格区 / 操作列</b>:列宽 <code>280px</code> 远大于三个按钮所需约
<code>154px</code>;表头左对齐(+16px)、内容被
<code>flex-end</code> 推到右端,两者在用户截图里相距约 117px、本原型按同配置复现实测
<code>94px</code>。同一列出现两个锚点,是「不协调」的直接来源。
</li>
<li>
<b>组件层 / 通病</b>:<code>DataTable</code> 的宽度公式为
<code>Math.max(页面值, 估算值)</code
>,注释写明「页面给大了尊重页面」,于是自动估算被页面估值架空。11 个列表页传了 80 /
110 / 130 / 150 / 180 / 200 / 220 / 280 共 8 种宽度,留白随页面随机变化。
</li>
<li>
<b>表格区 / 操作层级</b
>:查看详情、编辑同色同重,删除常驻亮红。三个动作等权,破坏性操作反而最抢眼,既无主次也提高误点风险。
</li>
<li>
<b>表格区 / 边界</b>:表头与表体之间、固定右列与可滚动区之间都用同一条
<code>#EEF1F6</code> 淡线,横向滚动后层次发虚,固定列像浮在表格上。
</li>
<li>
<b>表格区 / 状态标签</b>:「启用」用文字圆点
<code>●</code>,基线随字体与字号漂移;标签取自 antd 预设色(geekblue / green),与项目
<code>palette.soft.*</code> 是两套绿、两套蓝。
</li>
<li>
<b>表格区 / 数值列</b>:「账号数」未右对齐也未启用等宽数字,翻页时列内数字左右晃动。
</li>
</ol>
</section>
<section class="note">
<h2>2 · 整体优化思路</h2>
<p>
核心策略是
<b>「列宽归内容、锚点归一、层级归语义」</b
>,不是给操作列换一套皮肤。留白是几何问题,只能在几何层消掉;如果只调按钮颜色或加分隔线,280px
列里的那片空白仍然存在。
</p>
<p>
按 B 端优先级排序:数据可读性(所有列共享左锚点、数值右对齐)>
操作效率(三个动作一步可达、不收进下拉)> 视觉美观(层级字色、边界收口)>
个性化效果(本轮为零)。
</p>
<p>
改动只落在共享组件 <code>DataTable</code> 与 <code>@uj/ui</code> 样式层,业务页面
<code>columns</code> 与 <code>actionColumnWidth</code> 配置一行不改,12
个列表页同时受益。
</p>
<h2>3 · 分区详细优化方案</h2>
<h3>操作列(表格区右侧)</h3>
<ul>
<li>优化前:宽 280 / 表头左 / 内容右 / 三色等权。</li>
<li>
优化后:宽度钳制到「估算值 ~ 估算值+16px」,<code>align: left</code
>,表头与按钮组同起点;主操作「查看详情」保留主色,编辑与删除降为中性色,hover
分别转主色与语义红并浮出 4px 圆角浅底。
</li>
<li>决策点:删除默认不显红。它已由二次确认弹窗兜底,常驻红色只会把视线从数据拉走。</li>
</ul>
<h3>表头与行(表格区整体)</h3>
<ul>
<li>
表头下边界提到 <code>#E6EBF2</code>(比行线深一档),行线仍
<code>#EEF1F6</code>,靠一档色差立住层次,不加阴影。
</li>
<li>单元格上下内距 10 → 12px,行高约 46px;紧凑档 8px 保留给宽屏台账。</li>
<li>固定右列加 1px 左边界,横向滚动时明确「这列是钉住的」,替代投影。</li>
</ul>
<h3>标签、数值、分页</h3>
<ul>
<li>
状态点由 <code>UTag</code> 自动收成 CSS <code>::before</code> 6px
圆点(页面文案不改),色值统一到
<code>soft.success / soft.info / soft.neutral</code>。
</li>
<li>
数值列右对齐 + <code>tabular-nums</code>;分页「共 N
条」在左、页码在右,沿用现状不另造。
</li>
</ul>
</section>
<section class="note">
<h2>4 · 标准化设计规范落地</h2>
<div class="kv">
<b>间距栅格</b
><span
>单元格左右 16px;上下 12px(舒适)/ 8px(紧凑);行内操作 gap 4px;卡片内 20px</span
>
<b>字号层级</b
><span>表头与单元格 13/20 · 标签 12 · 页面标题 20/600 · 区块标题 16/600</span>
<b>圆角</b><span>卡片 10px · 控件 6px · 标签与 hover 底 4px · 状态点 50%</span>
<b>色彩 token</b
><span
><code>--uj-primary #2B5CE6</code> / <code>--uj-text-2 #4A5568</code> /
<code>--uj-divider #EEF1F6</code> / <code>--uj-border #E6EBF2</code> /
<code>--uj-success #16A34A</code> / <code>--uj-error #E5484D</code></span
>
<b>表格标准</b
><span
>表头 42px <code>raised</code> 底 + 下边界;行
46px;全列左锚点;数值列右对齐;固定右列 1px 左边界</span
>
<b>操作按钮</b
><span
>行内一律 text / small / 24px 高;一行最多 1 个常驻彩色;破坏性操作 hover 显红</span
>
<b>状态标签</b><span>浅底 + 深字 + 6px 同色点,圆角 4px,12px,无描边</span>
<b>列宽契约</b
><span
><code>actionColumnWidth</code> 由「硬宽度」改为「下限建议」;真实宽度 ∈ [估算值,
估算值+16px]</span
>
</div>
<h3>落地映射(文件级)</h3>
<ul>
<li>
<code>packages/biz/src/components/DataTable/index.tsx:159-172</code>:宽度公式 +
<code>align: 'left'</code> + 注释。
</li>
<li>
<code>packages/biz/src/components/DataTable/index.tsx:124-147</code
>:删掉行内按钮的内联 <code>color</code>(内联样式会压过组件层 CSS,规范无法收口)。
</li>
<li>
<code>packages/ui/src/styles/ui.css:519-</code>:<code>.uj-row-actions</code> 改
<code>flex-start</code>;新增表头下边界、固定列边界、层级按钮与状态点规则。
</li>
<li>
<code>packages/ui/src/components/Tag/index.tsx</code>:<code>UTag</code>
自动把文字圆点「●」收成 6px CSS 圆点,页面文案一行不改。
</li>
<li>
<code>packages/design-tokens/src/themeConfig.ts:156</code>:<code
>cellPaddingBlockMD 10 → 12</code
>。
</li>
<li>
业务页面 <code>columns</code> / <code>actionColumnWidth</code> /
<code>rowActions</code>:<b>不改</b>。
</li>
<li>
<b>实现与原型的一处差异(如实标注)</b>:<code>PermButton</code> 对
<code>type="text"</code> 强制内联 <code>paddingInline: 0</code>,真实按钮组比原型窄约
42px,固定列右端呼吸会更宽。左锚点一致不受影响;要精确贴合需改
<code>PermButton</code>,但它波及全站按钮,本轮未动。
</li>
</ul>
</section>
<section class="note">
<h2>5 · 本次设计能力提升点</h2>
<ol>
<li>
<b>先量再画</b>:把「看起来不协调」拆成可测的量(列宽 280 / 内容 ~154 / 锚点间距
117px),再决定是改色还是改几何。留白问题用配色永远修不好。
</li>
<li>
<b>把页面症状追到组件契约</b>:12 个页面各填一个 <code>actionColumnWidth</code>,说明
API 把「估算宽度」的责任推给了调用方。组件应该自己算,页面参数降级为建议值 ——
这类「通病」改一处胜过改十二处。
</li>
<li>
<b>层级用色彩预算而不是装饰</b
>:一行三个操作,给一个主色、两个中性色,比给三个都加图标或胶囊更清楚;破坏性操作的醒目程度应该与「是否已被确认」绑定,而不是常驻。
</li>
</ol>
<p class="legend">
表格文案取自
<code>apps/web/subapps/system/src/pages/RoleManage/index.tsx</code>
的真实列定义与操作配置;行内数据为演示值。色值取自
<code>packages/design-tokens/src/palette.ts</code
>。本页为设计原型,不依赖任何外部资源,可直接打开。
</p>
</section>
</div>
</div>
<script>
var ROWS = [
['超级管理员', 'SUPER_ADMIN', 3, '系统内置最高权限角色,拥有全部菜单与数据范围', '内置', 1],
['运营管理员', 'OPS_ADMIN', 12, '负责门店上架、积分规则与日常运营配置', '内置', 1],
['门店审批员', 'STORE_AUDITOR', 8, '门店资料初审与上架审批,不含系统设置', '内置', 1],
['财务复核', 'FINANCE_REVIEW', 5, '提现到账复核与对账确认', '内置', 1],
['客服专员', 'CS_AGENT', 24, '一客一群(预生成)客户群维护与积分答疑', '自定义', 1],
['区域督导', 'AREA_SUPERVISOR', 6, '片区门店巡检与活动配置', '自定义', 1],
['数据只读', 'DATA_READONLY', 2, '仅可查看报表与导出,不含任何写权限', '自定义', 1],
['试用期账号', 'TRIAL_USER', 1, '新入职同事的临时角色,30 天后自动停用', '自定义', 0],
];
function esc(s) {
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
function renderRows() {
var html = '';
for (var i = 0; i < ROWS.length; i++) {
var r = ROWS[i];
var typeTag = r[4] === '内置' ? 'tag-info' : 'tag-neutral';
var statusTag = r[5] === 1 ? 'tag-ok' : 'tag-neutral is-status';
var statusText = r[5] === 1 ? '启用' : '停用';
html +=
'<tr>' +
'<td class="strong" title="' +
esc(r[0]) +
'">' +
esc(r[0]) +
'</td>' +
'<td><span class="code">' +
esc(r[1]) +
'</span></td>' +
'<td class="num">' +
r[2] +
'</td>' +
'<td class="muted" title="' +
esc(r[3]) +
'">' +
esc(r[3]) +
'</td>' +
'<td><span class="tag ' +
typeTag +
'">' +
esc(r[4]) +
'</span></td>' +
'<td><span class="tag ' +
statusTag +
'"><span class="dot-char">●</span>' +
statusText +
'</span></td>' +
'<td class="op"><div class="acts">' +
'<button type="button" class="abtn primary">查看详情</button>' +
'<button type="button" class="abtn">编辑</button>' +
'<button type="button" class="abtn danger">删除</button>' +
'</div></td>' +
'</tr>';
}
document.getElementById('tbody').innerHTML = html;
}
function applyMode(mode) {
var after = mode === 'after';
document.body.classList.toggle('v-after', after);
document.getElementById('op-col').style.width = after ? '210px' : '280px';
var segs = document.querySelectorAll('[data-mode]');
for (var i = 0; i < segs.length; i++) {
segs[i].classList.toggle('is-on', segs[i].getAttribute('data-mode') === mode);
}
}
function scrollTo(side) {
var el = document.getElementById('scroller');
el.scrollLeft = side === 'left' ? 0 : el.scrollWidth;
}
document.querySelectorAll('[data-mode]').forEach(function (btn) {
btn.addEventListener('click', function () {
applyMode(btn.getAttribute('data-mode'));
scrollTo('right');
});
});
document.querySelectorAll('[data-toggle]').forEach(function (btn) {
btn.addEventListener('click', function () {
var cls = 'v-' + btn.getAttribute('data-toggle');
document.body.classList.toggle(cls);
btn.classList.toggle('is-on', document.body.classList.contains(cls));
});
});
document.querySelectorAll('[data-scroll]').forEach(function (btn) {
btn.addEventListener('click', function () {
scrollTo(btn.getAttribute('data-scroll'));
});
});
renderRows();
applyMode(location.hash.indexOf('before') >= 0 ? 'before' : 'after');
['axis', 'compact', 'flat'].forEach(function (k) {
if (location.hash.indexOf(k) >= 0) {
document.body.classList.add('v-' + k);
var b = document.querySelector('[data-toggle="' + k + '"]');
if (b) b.classList.add('is-on');
}
});
scrollTo(location.hash.indexOf('left') >= 0 ? 'left' : 'right');
</script>
</body>
</html>