修改制造模块子页面样式问题

This commit is contained in:
黄焱
2024-04-08 17:17:27 +08:00
parent bb29db2ff5
commit 4c9fbab471
4 changed files with 40 additions and 34 deletions

View File

@@ -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('<i style="color: red;margin-left: -4px;position: absolute;left: 0">*</i>' + 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('<i style="color: red">*</i>' + 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)
})

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -269,7 +269,7 @@
</group>
<notebook>
<page string="供应商">
<field name='supplier_ids'>
<field name='supplier_ids' class="supplier_ids_set_css">
<tree editable='bottom'>
<field name="sequence" widget="handle" string="序号"/>
<field name="partner_id" string="名称"/>