Accept Merge Request #520: (feature/制造代码优化 -> develop)

Merge Request: 修复gantt图修改日视图后其他视图的pill左移的bug。优化字段默认宽度的逻辑

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/520?initial=true
This commit is contained in:
马广威
2023-11-13 15:08:44 +08:00
committed by Coding
2 changed files with 20 additions and 7 deletions

View File

@@ -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;

View File

@@ -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 = '';