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

update 日历视图逻辑

上级 9c9f16d8
...@@ -428,8 +428,17 @@ import moment from 'moment'; ...@@ -428,8 +428,17 @@ import moment from 'moment';
this.evendata = {<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>:[],</#list></#if>} this.evendata = {<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>:[],</#list></#if>}
<#if ctrl.getPSSysCalendarItems()??> <#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendaritem> <#list ctrl.getPSSysCalendarItems() as calendaritem>
let ${calendaritem.getItemType()?lower_case}Item = [];
if(this.calendarItems.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>){ if(this.calendarItems.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>){
this.calendarItems.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>.forEach((item:any) => { this.calendarItems.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>.forEach((item:any) => {
if(${calendaritem.getItemType()?lower_case}Item.length == 0){
${calendaritem.getItemType()?lower_case}Item.push({time:item.create_date.substring(0, 10),evens:[item]});
}else{
${calendaritem.getItemType()?lower_case}Item.forEach((sig:any)=>{
if(sig.time.substring(0, 10) != item.create_date.substring(0, 10)){
${calendaritem.getItemType()?lower_case}Item.push({time:item.create_date.substring(0, 10),evens:[item]});
}
})}
if(item.<#if calendaritem.getBeginTimePSAppDEField()?? && calendaritem.getBeginTimePSAppDEField().getName()??>${calendaritem.getBeginTimePSAppDEField().getName()?lower_case}<#else>start</#if>){ if(item.<#if calendaritem.getBeginTimePSAppDEField()?? && calendaritem.getBeginTimePSAppDEField().getName()??>${calendaritem.getBeginTimePSAppDEField().getName()?lower_case}<#else>start</#if>){
Object.assign(this.eventsDate,{[item.<#if calendaritem.getBeginTimePSAppDEField()?? && calendaritem.getBeginTimePSAppDEField().getName()??>${calendaritem.getBeginTimePSAppDEField().getName()?lower_case}<#else>start</#if>.substring(0,10)]:"——"}); Object.assign(this.eventsDate,{[item.<#if calendaritem.getBeginTimePSAppDEField()?? && calendaritem.getBeginTimePSAppDEField().getName()??>${calendaritem.getBeginTimePSAppDEField().getName()?lower_case}<#else>start</#if>.substring(0,10)]:"——"});
if (this.evendata.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>.length > 0) { if (this.evendata.<#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}</#if>.length > 0) {
...@@ -456,7 +465,7 @@ import moment from 'moment'; ...@@ -456,7 +465,7 @@ import moment from 'moment';
} }
</#list> </#list>
</#if> </#if>
this.setSign(); this.setSign(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}Item</#if>,</#list></#if>);
} }
/** /**
...@@ -465,9 +474,17 @@ import moment from 'moment'; ...@@ -465,9 +474,17 @@ import moment from 'moment';
* @param any * @param any
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public setSign(){ public setSign(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}Item: any</#if>,</#list></#if>){
this.sign.push(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>...JSON.parse(JSON.stringify(this.evendata.${calendaritem.getItemType()?lower_case}))</#if>,</#list></#if>); this.sign.push(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>...JSON.parse(JSON.stringify(this.evendata.${calendaritem.getItemType()?lower_case}))</#if>,</#list></#if>);
this.sign.forEach((item:any) => { this.sign.push(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>...${calendaritem.getItemType()?lower_caseItem}</#if>,</#list></#if>);
let obj: any = {}
//去重
this.sign = this.sign.reduce((cur: any ,next: any) => {
obj[next.time] ? "" : obj[next.time] = true && cur.push(next);
return cur;
},[]);
// 格式化数据
this.sign.forEach((item:any,index:number) => {
if(item.time.length == 10){ if(item.time.length == 10){
let year = item.time.split('-')[0]; let year = item.time.split('-')[0];
let month = item.time.split('-')[1]; let month = item.time.split('-')[1];
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册