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

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

上级 14f444c3
......@@ -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>){
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 = {}
this.sign.length = 0;
// 格式化数据
signData.forEach((item:any,index:number) => {
if(item.time.length == 10){
......@@ -482,30 +483,10 @@ import moment from 'moment';
if(!obj[item.time]){
Object.assign(obj,{[item.time]:item.evens})
}else{
Object.assign(obj,{[item.time]:[...obj[item.time],...item.evens]})
obj[item.time].push(item.evens[0])
}
});
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]});
}
}
......@@ -525,11 +506,12 @@ import moment from 'moment';
if (dataItem.length == 0) {
dataItem.push({ time: item[mark].substring(0, 10), evens: [item] });
} else {
dataItem.forEach((sig: any) => {
if (sig.time.substring(0, 10) != item[mark].substring(0, 10)) {
let flag = dataItem.every((currentValue:any)=>{
return (currentValue.time !== item[mark].substring(0, 10))
})
if(flag){
dataItem.push({ time: item[mark].substring(0, 10), evens: [item] });
}
})
}
if (item[mark]) {
if (this.evendata[tag].length > 0) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册