修改制造模块子页面样式问题
This commit is contained in:
@@ -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)
|
||||
})
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user