修改表格,等样式

This commit is contained in:
黄焱
2024-01-05 14:10:43 +08:00
parent 5b9b700372
commit e29883d0de
8 changed files with 107 additions and 8 deletions

View File

@@ -132,11 +132,11 @@ td.o_required_modifier {
//font-weight: bold;
}
.text-truncate {
overflow: unset !important;
text-overflow: unset !important;
white-space: nowrap!important;
}
//.text-truncate {
// overflow: unset !important;
// text-overflow: unset !important;
// white-space: nowrap!important;
//}
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove) {
white-space: nowrap !important;
@@ -383,7 +383,9 @@ div:has(.o_required_modifier) > label::before {
}
}
}
.oe_kanban_details li.o_text_overflow {
display: block;
}
.o_stock_kanban .o_kanban_card_content {
.row {
align-items: center;
@@ -412,3 +414,18 @@ div:has(.o_required_modifier) > label::before {
grid-template-columns: auto;
}
}
// 设置所有表格序号列padding为0
.o_form_view .o_notebook > .tab-content > .tab-pane > :first-child:not(.o_group) .o_field_x2many.o_field_x2many_list tr > :first-child, .o_form_view .o_notebook > .tab-content > .tab-pane > :first-child.o_invisible_modifier + .o_field_widget .o_field_x2many.o_field_x2many_list tr > :first-child {
padding: 0;
text-align: center;
}
// 设置剩余number类型数据表格列 left
.o_list_renderer .o_list_table thead .o_list_number_th {
text-align:left;
}
.o_list_renderer .flex-row-reverse {
flex-direction: unset!important;
}

View File

@@ -1,4 +1,4 @@
.row_no {
width: 3.2% !important;
width: 35px !important;
vertical-align: middle;
}

View File

@@ -0,0 +1,35 @@
// 因为表格可以拖动设置宽度所以需要用js设置初始宽度
function setBasicParamTableWidth() {
const basicParamDom = $('.fixTableCss')
let dom = []
try {
dom = basicParamDom.find('table').find('thead').children().children()
} catch {
dom = []
}
if (!dom) return
dom.each(function () {
if ($(this).hasClass('row_no') >= 0) { // 序号列
// 不设置 通过css设置
}
const text = $(this).text()
$(this).find('span').removeClass('text-truncate')
if (text.length > 5) {
$(this).width('150px')
} else if (text.length == 5) {
$(this).width('100px')
} else if (text.length == 4) {
$(this).width('80px')
} else if (text.length == 3) {
$(this).width('65px')
} else if (text.length == 2) {
$(this).width('50px')
}
})
}
setTimeout(setBasicParamTableWidth, 500)

View File

@@ -444,7 +444,7 @@
<page string="切削速度Vc"
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}">
<field name="cutting_speed_ids" string="" widget="one2many"
attrs="{'readonly': [('categ_type', '=', '刀具')]}">
attrs="{'readonly': [('categ_type', '=', '刀具')]}" class="fixTableCss">
<tree editable="bottom">
<!-- <field name="order"/>-->
<field name="execution_standard_id"/>
@@ -463,6 +463,8 @@
<field name="application"/>
</tree>
</field>
<script src="/sf_dlm_management/static/js/changeCss.js"></script>
</page>
<page string="每齿走刀量fz"
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))],'readonly': [('categ_type', '=', '刀具')]}">

View File

@@ -22,6 +22,11 @@
'views/purchase_order_view.xml',
'views/quick_easy_order_view.xml'
],
'assets': {
'web.assets_backend': [
'sf_sale/static/js/setTableWidth.js',
]
},
'demo': [
],
'qweb': [

View File

@@ -0,0 +1,28 @@
function setTableWidth() {
let timer = null
const dom = $('.o_list_renderer ')
if(!dom.length) {
timer = setTimeout(setTableWidth, 500)
return
}
const widthTest = '<span id="widthTest" style="width: fit-content"></span>'
$('body').append(widthTest)
clearTimeout(timer)
const tbody_tr = dom.find('tbody').children('tr')
dom.find('thead').children('tr').children().each(function () {
$('#widthTest').text($(this).text())
const width = $('#widthTest').width()
const i = $(this).index()
console.log(111)
tbody_tr.each(function () {
if($(this).children().length > 2) {
$(this).children().eq(i).css('min-width', width + 'px')
}
})
})
}
$(function () {
setTableWidth()
})

View File

@@ -27,6 +27,8 @@
'web.assets_qweb': [
],
'web.assets_backend': [
'sf_tool_management/static/src/change.scss'
]
},

View File

@@ -9,3 +9,13 @@
.modal-content .o_list_button {
}
.o_form_view .o_field_widget .o_list_renderer {
width: calc(100% - 64px) !important;
margin:0 auto;
overflow: auto;
}
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector).o_list_number {
text-align: left;
}