提交 329d3b82 编写于 作者: KK's avatar KK

优化逻辑

上级 d8756692
...@@ -232,13 +232,7 @@ import moment from 'moment'; ...@@ -232,13 +232,7 @@ import moment from 'moment';
this.formatData(new Date(year+'/'+month+'/'+'1')); this.formatData(new Date(year+'/'+month+'/'+'1'));
} }
if(this.calendarStyle == "week_timeline" || this.calendarStyle == "week"){ if(this.calendarStyle == "week_timeline" || this.calendarStyle == "week"){
if(weekIndex == 0){ this.countWeeks(year,month,weekIndex);
this.formatData(new Date(year+'/'+month+'/'+'1'));
}else if(weekIndex == 5){
this.formatData(new Date(year+'/'+(month+1)+'/'+'1'));
}else{
this.formatData(new Date(year+'/'+month+'/'+(weekIndex)*7));
}
} }
} }
...@@ -253,13 +247,7 @@ import moment from 'moment'; ...@@ -253,13 +247,7 @@ import moment from 'moment';
this.formatData(new Date(year+'/'+month+'/'+'1')); this.formatData(new Date(year+'/'+month+'/'+'1'));
} }
if(this.calendarStyle == "week_timeline" || this.calendarStyle == "week"){ if(this.calendarStyle == "week_timeline" || this.calendarStyle == "week"){
if(weekIndex == 0){ this.countWeeks(year,month,weekIndex);
this.formatData(new Date(year+'/'+month+'/'+'1'));
}else if(weekIndex == 5){
this.formatData(new Date(year+'/'+(month+1)+'/'+'1'));
}else{
this.formatData(new Date(year+'/'+month+'/'+(weekIndex)*7));
}
} }
} }
...@@ -455,8 +443,6 @@ import moment from 'moment'; ...@@ -455,8 +443,6 @@ import moment from 'moment';
} }
</#list> </#list>
</#if> </#if>
} }
...@@ -569,6 +555,21 @@ import moment from 'moment'; ...@@ -569,6 +555,21 @@ import moment from 'moment';
}); });
} }
} }
/**
* 根据周下标计算事件
*
* @param {*} $event 事件信息
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public countWeeks(year: any, month: any, week: any) {
let date = new Date(year + '/' + month + '/' + 1);
let weekline = date.getDay();
if(weekline == 0){
this.formatData(new Date(year + '/' + month + '/' + (week*7 +1)));
}else{
this.formatData(new Date(year + '/' + month + '/' + (week*7 - weekline + 1)));
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册