ljm 修改备份
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { PlanningGanttRenderer } from "@planning/views/planning_gantt/planning_gantt_renderer";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
import {PlanningGanttRenderer} from "@planning/views/planning_gantt/planning_gantt_renderer";
|
||||
|
||||
|
||||
PlanningGanttRenderer.headerTemplate = "planning.PlanningGanttRenderer.Header";
|
||||
@@ -25,7 +25,7 @@ function floatToTime(floatTime) {
|
||||
patch(PlanningGanttRenderer.prototype, {
|
||||
computeDerivedParams() {
|
||||
super.computeDerivedParams();
|
||||
const { displayTotalRow } = this.model.metaData;
|
||||
const {displayTotalRow} = this.model.metaData;
|
||||
|
||||
if (displayTotalRow) {
|
||||
const prePills = this.getPills();
|
||||
@@ -92,7 +92,7 @@ patch(PlanningGanttRenderer.prototype, {
|
||||
col, // 当前列编号
|
||||
pills: [], // 当前分组中的 pills 数组
|
||||
aggregateValue: 0, // 分组的汇总值
|
||||
grid: { column: [col, 1] }, // 分组的网格位置(列信息)
|
||||
grid: {column: [col, 1]}, // 分组的网格位置(列信息)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -156,12 +156,14 @@ patch(PlanningGanttRenderer.prototype, {
|
||||
method: "POST",
|
||||
dataType: 'json',
|
||||
async: false, // 设置为同步请求
|
||||
beforeSend: (xhr) => {xhr.setRequestHeader('Content-Type', 'application/json');},
|
||||
data : JSON.stringify(jsonData),
|
||||
beforeSend: (xhr) => {
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
},
|
||||
data: JSON.stringify(jsonData),
|
||||
success: (result) => {
|
||||
slotTemplateData = result?.result?.records || [];
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
error: function (xhr, status, error) {
|
||||
// 请求失败的处理逻辑
|
||||
console.error("Error:", error);
|
||||
}
|
||||
@@ -186,7 +188,14 @@ patch(PlanningGanttRenderer.prototype, {
|
||||
group.end_time2 = groupSlotTemplate?.end_time2 || 0;
|
||||
group.day2 = groupSlotTemplate?.day2 || '';
|
||||
// 拼接显示信息
|
||||
group.ganttLegend = `${groupSlotTemplate.display_name} : ${floatToTime(group.start_time)} - ${floatToTime(group.day2)} ${floatToTime(group.end_time2)}`;
|
||||
// 拼接显示信息,根据 day2 是否有值来决定显示内容
|
||||
if (group.day2) {
|
||||
// 如果 day2 有值,显示 day2 的时间
|
||||
group.ganttLegend = `${groupSlotTemplate.display_name} : ${floatToTime(group.start_time)} - ${floatToTime(group.day2)} ${floatToTime(group.end_time2)}`;
|
||||
} else {
|
||||
// 如果 day2 没有值,正常显示
|
||||
group.ganttLegend = `${groupSlotTemplate.display_name} : ${floatToTime(group.start_time)} - ${floatToTime(group.end_time)}`;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='role_id']" position="after">
|
||||
<field name="department_id"/>
|
||||
<field name="end_time2"/>
|
||||
<field name="end_time2" widget="float_time"/>
|
||||
<field name="day2"/>
|
||||
<field name="color" widget="color_picker" optional="show"/>
|
||||
</xpath>
|
||||
@@ -22,7 +22,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='role_id']" position="after">
|
||||
<field name="department_id"/>
|
||||
<field name="end_time2"/>
|
||||
<field name="end_time2" widget="float_time"/>
|
||||
<field name="day2"/>
|
||||
<field name="color" widget="color_picker" optional="show"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user