!12735 列表样式

Merge pull request !12735 from 李鹏宇/dev_wang
This commit is contained in:
李鹏宇
2026-08-27 10:29:16 +00:00
committed by Gitee
3 changed files with 146 additions and 4 deletions
+142
View File
@@ -6,4 +6,146 @@
.btn-blue {
color: #0069ff !important;
}
/* ===== 公告标题(name 字段)在 tree 中自动换行 =====
思路与 room.booking 议题列一致:Odoo list 视图不应用字段 style,
列宽只能靠 width+options 锁定,再用 white-space:normal 强制换行。
该类名仅 yuthon.notice 的 name 列使用,不会误伤其他列。*/
.o_yuthon_notice_name_wrap {
/*锁列宽:让长标题有折行空间*/
max-width: 400px !important;
width: 400px !important;
}
/*对单元格及所有子元素强制换行 + 剥离可能产生的 chip 容器外观*/
.o_yuthon_notice_name_wrap,
.o_yuthon_notice_name_wrap *,
.o_yuthon_notice_name_wrap .o_field_widget,
.o_yuthon_notice_name_wrap .o_field_char,
.o_yuthon_notice_name_wrap a,
.o_yuthon_notice_name_wrap span {
white-space: normal !important;
word-break: break-word !important;
overflow-wrap: break-word !important;
overflow: visible !important;
text-overflow: clip !important;
/*去除任何 chip/容器外观的兜底样式(背景/边框/圆角/阴影/内外边距)*/
background: transparent !important;
background-color: transparent !important;
border: 0 !important;
border-color: transparent !important;
border-style: none !important;
border-radius: 0 !important;
box-shadow: none !important;
outline: 0 !important;
padding: 0 !important;
margin: 0 !important;
}
/*若被包裹在 <a> 内,把 <a> 改成 display:contents 避免出现块状容器*/
.o_yuthon_notice_name_wrap a {
display: contents !important;
}
/*td 自身保持合适行高,避免被任意内容撑高*/
.o_yuthon_notice_name_wrap {
line-height: normal !important;
vertical-align: middle;
}
/* ===== 公告类型名称(name 字段)在 tree 中保持窄列 =====
该字段实际只放 2 个汉字(通知/公告/决定/其他),不应占整列宽;
锁列宽 120px 让 note 列有更多空间。
同时保留强制换行兜底,将来万一有人填长名称也能正常显示。*/
.o_yuthon_notice_type_name_short {
/*锁列宽:从 120 再缩短一倍到 60,单元格内容边距还得留一点*/
max-width: 60px !important;
width: 60px !important;
}
/*对单元格及所有子元素强制换行 + 剥离 chip 容器外观*/
.o_yuthon_notice_type_name_short,
.o_yuthon_notice_type_name_short *,
.o_yuthon_notice_type_name_short .o_field_widget,
.o_yuthon_notice_type_name_short .o_field_char,
.o_yuthon_notice_type_name_short a,
.o_yuthon_notice_type_name_short span,
.o_yuthon_notice_type_name_short input,
.o_yuthon_notice_type_name_short textarea {
white-space: normal !important;
word-break: break-word !important;
overflow-wrap: break-word !important;
overflow: visible !important;
text-overflow: clip !important;
/*去除任何 chip/容器外观的兜底样式(背景/边框/圆角/阴影/内外边距)*/
background: transparent !important;
background-color: transparent !important;
border: 0 !important;
border-color: transparent !important;
border-style: none !important;
border-radius: 0 !important;
box-shadow: none !important;
outline: 0 !important;
padding: 0 !important;
margin: 0 !important;
}
/*若被包裹在 <a> 内,把 <a> 改成 display:contents 避免出现块状容器*/
.o_yuthon_notice_type_name_short a {
display: contents !important;
}
/*td 自身保持合适行高,避免被任意内容撑高*/
.o_yuthon_notice_type_name_short {
line-height: normal !important;
vertical-align: middle;
}
/* ===== 公告类型说明(note 字段)在 tree 中自动换行 =====
思路同上,类名独立以免和 name 列相互影响。*/
.o_yuthon_notice_type_note_wrap {
/*锁列宽:让长说明文字有折行空间,从 400 调到 600 容纳更多正文*/
max-width: 600px !important;
width: 600px !important;
}
/*对单元格及所有子元素强制换行 + 剥离 chip 容器外观;
editable="bottom" 模式下字段会渲染成 input,
所以选择器要包含 input + textarea 才能在编辑态也生效。*/
.o_yuthon_notice_type_note_wrap,
.o_yuthon_notice_type_note_wrap *,
.o_yuthon_notice_type_note_wrap .o_field_widget,
.o_yuthon_notice_type_note_wrap .o_field_char,
.o_yuthon_notice_type_note_wrap a,
.o_yuthon_notice_type_note_wrap span,
.o_yuthon_notice_type_note_wrap input,
.o_yuthon_notice_type_note_wrap textarea {
white-space: normal !important;
word-break: break-word !important;
overflow-wrap: break-word !important;
overflow: visible !important;
text-overflow: clip !important;
/*去除任何 chip/容器外观的兜底样式(背景/边框/圆角/阴影/内外边距)*/
background: transparent !important;
background-color: transparent !important;
border: 0 !important;
border-color: transparent !important;
border-style: none !important;
border-radius: 0 !important;
box-shadow: none !important;
outline: 0 !important;
padding: 0 !important;
margin: 0 !important;
}
/*若被包裹在 <a> 内,把 <a> 改成 display:contents 避免出现块状容器*/
.o_yuthon_notice_type_note_wrap a {
display: contents !important;
}
/*td 自身保持合适行高,避免被任意内容撑高*/
.o_yuthon_notice_type_note_wrap {
line-height: normal !important;
vertical-align: middle;
}
@@ -5,8 +5,8 @@
<field name="model">yuthon.notice.type</field>
<field name="arch" type="xml">
<tree string="公告类型" editable="bottom">
<field name="name"/>
<field name="note"/>
<field name="name" class="o_yuthon_notice_type_name_short" options="{'width': '60px'}" width="60px"/>
<field name="note" class="o_yuthon_notice_type_note_wrap" options="{'width': '600px'}" width="600px"/>
</tree>
</field>
</record>
+2 -2
View File
@@ -7,7 +7,7 @@
<tree string="公告管理" decoration-success="notice_state == 'yes'"
decoration-info="notice_state == 'no'"
decoration-muted="notice_state == 'stop'" default_order="create_date1 desc">
<field name="name" required="1"/>
<field name="name" required="1" class="o_yuthon_notice_name_wrap" options="{'width': '400px'}" width="400px"/>
<field name="notice_type_id" string="类型"/>
<field name="users_id" string="发布人"/>
<field name="department_id" column_invisible="1"/>
@@ -121,7 +121,7 @@
decoration-danger="is_notice_roger == 'no'"
decoration-success="is_notice_roger == 'yes'"
js_class="custom_notice_tree_button" default_order="create_date1 desc">
<field name="name"/>
<field name="name" class="o_yuthon_notice_name_wrap" options="{'width': '400px'}" width="400px"/>
<field name="notice_type_id" string="类型"/>
<field name="users_id" string="发布人"/>
<field name="is_notice_roger"/>