diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js index 512abc44..63da7fdd 100644 --- a/jikimo_frontend/static/src/list/custom_width.js +++ b/jikimo_frontend/static/src/list/custom_width.js @@ -44,11 +44,11 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { }, setDefaultColumnWidths(column_num) { - const bbb = this.state.columns[0].name + // const bbb = this.state.columns[0].name const widths = this.state.columns.map((col) => this.calculateColumnWidth(col)); - const sumOfRelativeWidths = (widths - .filter(({ type }) => type === "relative") - .reduce((sum, { value }) => sum + value, 0)); + // const sumOfRelativeWidths = (widths + // .filter(({ type }) => type === "relative") + // .reduce((sum, { value }) => sum + value, 0)); // 获取数组的最后一项 const lastItem = widths[widths.length - 1]; @@ -60,10 +60,16 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { widths.push(newItem); // 判断销售的sequence - if (this.state.columns[0].name === "sequence") { - widths[1] = { type: "relative", value: 0.1 }; + // if (this.state.columns[0].name === "sequence") { + // widths[1] = { type: "relative", value: 0.1 }; + // } + + // 判断 this.state.columns 是否存在且长度大于零 + if (this.state.columns && this.state.columns.length > 0 && this.state.columns[0].name === "sequence") { + widths[1] = { type: "relative", value: 0.1 }; } + // 1 because nth-child selectors are 1-indexed, 2 when the first column contains // the checkboxes to select records. const columnOffset = this.hasSelectors ? 2 : 1; diff --git a/web_gantt/static/src/js/gantt_row.js b/web_gantt/static/src/js/gantt_row.js index efff4af2..2867188c 100644 --- a/web_gantt/static/src/js/gantt_row.js +++ b/web_gantt/static/src/js/gantt_row.js @@ -774,7 +774,14 @@ var GanttRow = Widget.extend({ let index = 0; for (const date of this.viewInfo.slots) { const slotStart = date; - const slotStop = date.clone().add(8, interval); + // const slotStop = date.clone().add(8, interval); + let slotStop; + + if (interval === "hour") { + slotStop = date.clone().add(8, "hour"); + } else { + slotStop = date.clone().add(1, interval); + } const isToday = date.isSame(new Date(), 'day') && this.state.scale !== 'day'; let slotStyle = '';