Преглед изворни кода

甘特图月视图当前日期显示

fujunwen пре 4 година
родитељ
комит
0b359816af
2 измењених фајлова са 5 додато и 2 уклоњено
  1. 1 1
      src/utils/ganttChart/GanttChart_day.js
  2. 4 1
      src/utils/ganttChart/GanttChart_month.js

+ 1 - 1
src/utils/ganttChart/GanttChart_day.js

@@ -294,7 +294,7 @@ GanttChartDay.prototype.drawTimeZone = function() {
   // 绘制第二级
   let nowAtStr = moment().format('YYYY-MM-DD')
   this.timeZoneLineEls = []
-  for (let i = 0; i < this.daysCount; i++) {
+  for (let i = 1; i <= this.daysCount; i++) {
     let tempAt = startSecond.add(1, 'days')
     let timeText = tempAt.format('DD');
     if(timeText == '01'){

+ 4 - 1
src/utils/ganttChart/GanttChart_month.js

@@ -406,10 +406,13 @@ GanttChartMonth.prototype.postDrawTasksCallBack = function(){
   if(true){
     let todayAt = new Date()
     if(this.startAt < todayAt && this.endAt > todayAt){
+      let duraStartAt = new Date() - new Date(this.startAt.format('YYYY-MM-DD'));
+      let secondsStartAt = duraStartAt/1000
+      this.todayTimeLineOffsetPos = secondsStartAt*this.timePerPix
       this.todayTimeLineEl = this.gCanvas.addShape('rect',{
         attrs: {
           x: this.todayTimeLineOffsetPos,
-          y: 40,
+          y: 50,
           width: 4,
           height: this.cHeight,
           fill: '#CDE9FF',