提交 4fe08e27 编写于 作者: Neuromancer255's avatar Neuromancer255

解决日历部件事件标识重复问题

上级 14f444c3
...@@ -465,6 +465,7 @@ import moment from 'moment'; ...@@ -465,6 +465,7 @@ import moment from 'moment';
public setSign(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}Item: any</#if>,</#list></#if>){ public setSign(<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>${calendaritem.getItemType()?lower_case}Item: any</#if>,</#list></#if>){
let signData: any[] = [<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>...${calendaritem.getItemType()?lower_case}Item</#if>,</#list></#if>]; let signData: any[] = [<#if ctrl.getPSSysCalendarItems()??><#list ctrl.getPSSysCalendarItems() as calendaritem><#if calendaritem.getItemType()??>...${calendaritem.getItemType()?lower_case}Item</#if>,</#list></#if>];
let obj: any = {} let obj: any = {}
this.sign.length = 0;
// 格式化数据 // 格式化数据
signData.forEach((item:any,index:number) => { signData.forEach((item:any,index:number) => {
if(item.time.length == 10){ if(item.time.length == 10){
...@@ -482,30 +483,10 @@ import moment from 'moment'; ...@@ -482,30 +483,10 @@ import moment from 'moment';
if(!obj[item.time]){ if(!obj[item.time]){
Object.assign(obj,{[item.time]:item.evens}) Object.assign(obj,{[item.time]:item.evens})
}else{ }else{
Object.assign(obj,{[item.time]:[...obj[item.time],...item.evens]}) obj[item.time].push(item.evens[0])
} }
}); });
for (const key in obj) { for (const key in obj) {
<#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendaritem>
<#if calendaritem.getItemType()??>
let ${calendaritem.getItemType()?lower_case} = false;
</#if>
</#list>
</#if>
obj[key].forEach((item:any,index:number) => {
<#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendaritem>
<#if calendaritem.getItemType()??>
if(item.itemType=="${calendaritem.getItemType()?lower_case}" && ${calendaritem.getItemType()?lower_case}){
obj[key].splice(0,index);
}else{
${calendaritem.getItemType()?lower_case} = true;
}
</#if>
</#list>
</#if>
});
this.sign.push({time:key,evens:obj[key]}); this.sign.push({time:key,evens:obj[key]});
} }
} }
...@@ -525,11 +506,12 @@ import moment from 'moment'; ...@@ -525,11 +506,12 @@ import moment from 'moment';
if (dataItem.length == 0) { if (dataItem.length == 0) {
dataItem.push({ time: item[mark].substring(0, 10), evens: [item] }); dataItem.push({ time: item[mark].substring(0, 10), evens: [item] });
} else { } else {
dataItem.forEach((sig: any) => { let flag = dataItem.every((currentValue:any)=>{
if (sig.time.substring(0, 10) != item[mark].substring(0, 10)) { return (currentValue.time !== item[mark].substring(0, 10))
})
if(flag){
dataItem.push({ time: item[mark].substring(0, 10), evens: [item] }); dataItem.push({ time: item[mark].substring(0, 10), evens: [item] });
} }
})
} }
if (item[mark]) { if (item[mark]) {
if (this.evendata[tag].length > 0) { if (this.evendata[tag].length > 0) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册