合并销售订单列,修改必填*展示方法,

This commit is contained in:
hyyy
2025-02-17 16:03:14 +08:00
parent 1e3f8f005e
commit 69c5996db7
6 changed files with 66 additions and 16 deletions

View File

@@ -1,3 +1,8 @@
.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){
border:1px solid #dee2e6 !important;
}
.custom_required_add::before{
content: '*';
color: red;
}

View File

@@ -6,6 +6,8 @@ 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 {StatusBarField} from "@web/views/fields/statusbar/statusbar_field";
import {FormLabel} from "@web/views/form/form_label";
import { fieldVisualFeedback } from "@web/views/fields/field";
import {Field} from "@web/views/fields/field";
@@ -115,9 +117,6 @@ patch(Field.prototype, 'jikimo_frontend.Field', {
setRequired() {
const id = this.props.id
const isRequired = filedRequiredList[id]
if(id == 'number_of_axles') {
console.log(isRequired)
}
if(isRequired) {
let dom;
dom = $(`label[for=${id}]`)
@@ -191,7 +190,31 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
}
}
})
patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
get className() {
const { invalid, empty, readonly } = fieldVisualFeedback(
this.props.fieldInfo.FieldComponent,
this.props.record,
this.props.fieldName,
this.props.fieldInfo
);
const classes = this.props.className ? [this.props.className] : [];
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0) {
classes.push('custom_required_add')
}
if (invalid) {
classes.push("o_field_invalid");
}
if (empty) {
classes.push("o_form_label_empty");
}
if (readonly) {
classes.push("o_form_label_readonly");
}
return classes.join(" ");
}
})
// 根据进度条设置水印
// const statusbar_params = {
@@ -231,7 +254,6 @@ $(function () {
clearInterval(timer)
timer = setInterval(() => {
timer_count++
const dom = $('.custom_required')
let tableDom = $('.table_custom_required')
if (tableDom.length) {
tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required')
@@ -243,17 +265,6 @@ $(function () {
})
clearInterval(timer)
}
if (dom.length) {
dom.each(function () {
const requiredDom = $(this).parent().prev().find('label')
let t = requiredDom.html()
if (t && t.indexOf('c*') < 0) {
t = '<i class="c*" style="color: red;margin-left: -4px">*</i>' + t
}
requiredDom.html(t)
})
clearInterval(timer)
}
if (timer_count == 20) {
clearInterval(timer)
}