From 4c9fbab4712704498dc75e9bcd00d663a575c502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=84=B1?= Date: Mon, 8 Apr 2024 17:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=B6=E9=80=A0=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=AD=90=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/js/custom_form_status_indicator.js | 57 ++++++++----------- .../static/src/scss/custom_style.scss | 12 ++++ sf_base/static/src/scss/test.scss | 3 + sf_base/views/common_view.xml | 2 +- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js index 7db13b4b..100542b8 100644 --- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js +++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js @@ -4,6 +4,7 @@ import {patch} from '@web/core/utils/patch'; // import { Dialog } from "@web/core/dialog/dialog"; import {_t} from "@web/core/l10n/translation"; import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator"; +import {ListRenderer} from "@web/views/list/list_renderer"; import {Field} from "@web/views/fields/field"; @@ -45,6 +46,11 @@ const filedRequiredList = { 'date_planned_start': { multiple: false, noLabel: false }, 'date_planned_finished': { multiple: false, noLabel: false }, } +const tableRequiredList = [ + 'product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty', + 'name', 'fault_type', 'maintenance_standards', 'Period' +] + patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', { // 你可以重写或者添加一些方法和属性 async _onDiscardChanges() { @@ -110,7 +116,24 @@ patch(Field.prototype, 'jikimo_frontend.Field', { } } }) - +patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { + setup(){ + owl.onMounted(() => { + this.activeElement = this.uiService.activeElement; + this.setRequired() + }) + return this._super(...arguments); + }, + setRequired() { + this.allColumns.forEach(_ => { + if( tableRequiredList.indexOf(_.name) >= 0 ) { + const dom = $(`th[data-name=${_.name}]`) + let t = dom.html() + dom.html('*' + t) + } + }) + } +}) $(function () { document.addEventListener('click', function () { @@ -160,45 +183,13 @@ $(function () { }, 500) } - function setRequired(dom = {label: [], table: []}) { - let domTimer = null - let timer_count = 0 - clearInterval(domTimer) - domTimer = setInterval(() => { - timer_count++ - const lint = $('.o_form_view_container') - if (lint.length) { - clearInterval(domTimer) - const { table} = dom - - if (table.length) { - table.forEach(_ => { - const th = $(`th[data-name=${_}]`) - const t = th.find('span').eq(0).text().replace('*','') - th.find('span').eq(0).html('*' + t) - - }) - - } - } - if (timer_count == 20) { - clearInterval(domTimer) - } - }, 500) - } - var currentUrl = location.href - const customRequiredDom = { - table: ['product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty', 'name', 'fault_type', 'maintenance_standards', 'Period'] - } const listenerUrl = setInterval(() => { const isChange = currentUrl != location.href if (isChange) { currentUrl = location.href customRequired() - setRequired(customRequiredDom) } }, 500) customRequired() - setRequired(customRequiredDom) }) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index bc1be730..f7195534 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -467,3 +467,15 @@ div:has(.o_required_modifier) > label::before { background: #71639e; color: #fff } + +// 修改时间输入框宽度 +.o_datepicker_input.o_input.datetimepicker-input { + width: 200px; +} + + +.o_form_view .o_form_editable .o_row > .o_field_widget, .o_form_view .o_form_editable .o_row > .o_field_widget.o_field_float_time { + width: auto !important; + flex: unset; +} + diff --git a/sf_base/static/src/scss/test.scss b/sf_base/static/src/scss/test.scss index fdc5821e..c91a8a77 100644 --- a/sf_base/static/src/scss/test.scss +++ b/sf_base/static/src/scss/test.scss @@ -189,3 +189,6 @@ td.o_required_modifier { flex-direction: row !important; } +.supplier_ids_set_css thead th[data-name=partner_id]{ + width: 500px!important; +} \ No newline at end of file diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index 0826b51c..e829274a 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -269,7 +269,7 @@ - +