From 913780bc2b7a6b2fd9ab8448f1a1cb17b5a75858 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 13 Nov 2023 15:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgantt=E5=9B=BE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=A5=E8=A7=86=E5=9B=BE=E5=90=8E=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=9A=84pill=E5=B7=A6=E7=A7=BB=E7=9A=84bug?= =?UTF-8?q?=E3=80=82=E4=BC=98=E5=8C=96=E5=AD=97=E6=AE=B5=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/list/custom_width.js | 18 ++++++++++++------ web_gantt/static/src/js/gantt_row.js | 9 ++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) 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 = '';