优化gantt的间隔为变量
This commit is contained in:
@@ -684,10 +684,11 @@ export default AbstractRenderer.extend(WidgetAdapterMixin, {
|
||||
const stopDate = this.state.stopDate;
|
||||
let day = this.state.startDate;
|
||||
const dates = [];
|
||||
const shift_time = 8;
|
||||
if (this.state.scale == "day") {
|
||||
while (day <= stopDate) {
|
||||
dates.push(day);
|
||||
day = day.clone().add(8, token);
|
||||
day = day.clone().add(shift_time, token);
|
||||
}
|
||||
} else {
|
||||
while (day <= stopDate) {
|
||||
|
||||
@@ -463,19 +463,20 @@ var GanttRow = Widget.extend({
|
||||
this.pills.forEach(function (pill) {
|
||||
let widthPill;
|
||||
let margin;
|
||||
const shift_time = 8;
|
||||
switch (self.state.scale) {
|
||||
case 'day':
|
||||
// left = pill.startDate.diff(pill.startDate.clone().startOf('hour'), 'minutes');
|
||||
left = pill.startDate.diff(pill.startDate.clone().startOf('day'), 'minutes') % (8 * 60);
|
||||
left = pill.startDate.diff(pill.startDate.clone().startOf('day'), 'minutes') % (shift_time * 60);
|
||||
|
||||
console.log('left', left)
|
||||
pill.leftMargin = (left / 480) * 100;
|
||||
pill.leftMargin = (left / (shift_time * 60)) * 100;
|
||||
console.log('pill.leftMargin', pill.leftMargin)
|
||||
diff = pill.stopDate.diff(pill.startDate, 'minutes');
|
||||
console.log('diff', diff)
|
||||
var gapSize = pill.stopDate.diff(pill.startDate, 'hours') - 8; // Eventually compensate border(s) width
|
||||
var gapSize = pill.stopDate.diff(pill.startDate, 'hours') - shift_time; // Eventually compensate border(s) width
|
||||
console.log('gapSize', gapSize)
|
||||
widthPill = (diff / 480) * 100;
|
||||
widthPill = (diff / (shift_time * 60)) * 100;
|
||||
console.log('widthPill', widthPill)
|
||||
margin = pill.aggregatedPills ? 0 : 4;
|
||||
console.log('margin', margin)
|
||||
|
||||
Reference in New Issue
Block a user