From e29883d0de94b4129882d70a7ee50437a1855be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=84=B1?= Date: Fri, 5 Jan 2024 14:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC=EF=BC=8C?= =?UTF-8?q?=E7=AD=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/scss/custom_style.scss | 29 +++++++++++---- .../static/src/scss/rowno_in_tree.scss | 2 +- sf_dlm_management/static/js/changeCss.js | 35 +++++++++++++++++++ .../product_template_management_view.xml | 4 ++- sf_sale/__manifest__.py | 5 +++ sf_sale/static/js/setTableWidth.js | 28 +++++++++++++++ sf_tool_management/__manifest__.py | 2 ++ sf_tool_management/static/src/change.scss | 10 ++++++ 8 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 sf_dlm_management/static/js/changeCss.js create mode 100644 sf_sale/static/js/setTableWidth.js diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 5d660025..eddf019b 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -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; @@ -411,4 +413,19 @@ div:has(.o_required_modifier) > label::before { .o_inner_group.processingMethod { 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; } \ No newline at end of file diff --git a/jikimo_frontend/static/src/scss/rowno_in_tree.scss b/jikimo_frontend/static/src/scss/rowno_in_tree.scss index c244ad7d..5f8a2648 100644 --- a/jikimo_frontend/static/src/scss/rowno_in_tree.scss +++ b/jikimo_frontend/static/src/scss/rowno_in_tree.scss @@ -1,4 +1,4 @@ .row_no { - width: 3.2% !important; + width: 35px !important; vertical-align: middle; } diff --git a/sf_dlm_management/static/js/changeCss.js b/sf_dlm_management/static/js/changeCss.js new file mode 100644 index 00000000..9510a207 --- /dev/null +++ b/sf_dlm_management/static/js/changeCss.js @@ -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) diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index 737d56db..b1bd8751 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -444,7 +444,7 @@ + attrs="{'readonly': [('categ_type', '=', '刀具')]}" class="fixTableCss"> @@ -463,6 +463,8 @@ + + diff --git a/sf_sale/__manifest__.py b/sf_sale/__manifest__.py index ba6a99db..6d340058 100644 --- a/sf_sale/__manifest__.py +++ b/sf_sale/__manifest__.py @@ -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': [ diff --git a/sf_sale/static/js/setTableWidth.js b/sf_sale/static/js/setTableWidth.js new file mode 100644 index 00000000..7cae3950 --- /dev/null +++ b/sf_sale/static/js/setTableWidth.js @@ -0,0 +1,28 @@ +function setTableWidth() { + let timer = null + const dom = $('.o_list_renderer ') + if(!dom.length) { + timer = setTimeout(setTableWidth, 500) + return + } + const widthTest = '' + $('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() +}) + diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py index e334c32a..c56f9463 100644 --- a/sf_tool_management/__manifest__.py +++ b/sf_tool_management/__manifest__.py @@ -27,6 +27,8 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ + 'sf_tool_management/static/src/change.scss' + ] }, diff --git a/sf_tool_management/static/src/change.scss b/sf_tool_management/static/src/change.scss index 40fdcc8e..a4e64f97 100644 --- a/sf_tool_management/static/src/change.scss +++ b/sf_tool_management/static/src/change.scss @@ -8,4 +8,14 @@ .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; } \ No newline at end of file