提交 ac589dd3 编写于 作者: Mosher's avatar Mosher

update:更新

上级 a477f21c
...@@ -502,24 +502,29 @@ import AuthService from '@/authservice/auth-service'; ...@@ -502,24 +502,29 @@ import AuthService from '@/authservice/auth-service';
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public click(item: any) { public click(item: any) {
if (item) { this.handleCtrlEvents('onselectionchange', { data: item }).then((res: boolean) => {
let navDataService = NavDataService.getInstance(); if (!res) {
if(Object.is(this.navModel,"route")){ return;
navDataService.removeNavData(this.viewtag);
} }
switch (item.appfunctag) { if (item) {
<#if ctrl.getPSAppFuncs()??> let navDataService = NavDataService.getInstance();
<#assign appFuncs = ctrl.getPSAppFuncs()> if(Object.is(this.navModel,"route")){
<#list appFuncs as singFuncs> navDataService.removeNavData(this.viewtag);
case '${singFuncs.getCodeName()}': }
this.click${singFuncs.codeName}(item); switch (item.appfunctag) {
return; <#if ctrl.getPSAppFuncs()??>
</#list> <#assign appFuncs = ctrl.getPSAppFuncs()>
</#if> <#list appFuncs as singFuncs>
default: case '${singFuncs.getCodeName()}':
console.warn('未指定应用功能'); this.click${singFuncs.codeName}(item);
return;
</#list>
</#if>
default:
console.warn('未指定应用功能');
}
} }
} })
} }
<#if ctrl.getPSAppFuncs()??> <#if ctrl.getPSAppFuncs()??>
......
...@@ -473,7 +473,7 @@ FullCalendar, ...@@ -473,7 +473,7 @@ FullCalendar,
Object.assign(arg, { viewparams: tempViewParams }); Object.assign(arg, { viewparams: tempViewParams });
// 处理events数据 // 处理events数据
let _this = this; let _this = this;
let handleEvents = ()=>{ let handleEvents = () => {
if(_this.isSelectFirstDefault){ if(_this.isSelectFirstDefault){
// 模拟$event数据 // 模拟$event数据
let tempEvent = JSON.parse(JSON.stringify(_this.events.length > 0?_this.events[0]:{})); let tempEvent = JSON.parse(JSON.stringify(_this.events.length > 0?_this.events[0]:{}));
...@@ -497,29 +497,49 @@ FullCalendar, ...@@ -497,29 +497,49 @@ FullCalendar,
api.updateSize(); api.updateSize();
} }
} }
if(JSON.stringify(arg) === JSON.stringify(this.searchArgCache)){ if (JSON.stringify(arg) === JSON.stringify(this.searchArgCache)) {
handleEvents(); handleEvents();
return; return;
}else{ } else {
this.searchArgCache = arg; this.searchArgCache = arg;
} }
const post: Promise<any> = this.service.search(this.loadAction, JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator); this.handleCtrlEvents('onbeforeload', { viewparams: arg }).then((beforeLoadRes: boolean) => {
post.then((response: any) => { if (!beforeLoadRes) {
if (!response || response.status !== 200) {
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return; return;
} }
// 默认选中第一项 const post: Promise<any> = this.service.search(this.loadAction, JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
this.events = response.data; post.then((response: any) => {
handleEvents(); if (!response || response.status !== 200) {
}, (response: any) => { this.handleCtrlEvents('onloaderror', { viewparams: arg }).then((loadErrorRes: boolean) => {
if (response && response.status === 401) { if (!loadErrorRes) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); if (response.data && response.data.message) {
}); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
});
return;
}
this.handleCtrlEvents('onloadsuccess', { data: response.data }).then((loadSuccessRes: boolean) => {
if (!loadSuccessRes) {
return;
}
// 默认选中第一项
this.events = response.data;
handleEvents();
})
}, (response: any) => {
this.handleCtrlEvents('onloaderror', { viewparams: arg }).then((loadErrorRes: boolean) => {
if (!loadErrorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
});
})
} }
/** /**
...@@ -591,75 +611,81 @@ FullCalendar, ...@@ -591,75 +611,81 @@ FullCalendar,
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public onEventClick($event: any, isOriginData:boolean = false, $event2?: any) { public onEventClick($event: any, isOriginData:boolean = false, $event2?: any) {
// 处理event数据 this.handleCtrlEvents('onselectionchange', { data: $event }).then((res: boolean) => {
let event: any = {}; if (!res) {
if(isOriginData){ return;
event = JSON.parse(JSON.stringify($event));
}else{
event = Object.assign({title: $event.event.title, start: $event.event.start, end: $event.event.end}, $event.event.extendedProps);
}
// 点击选中样式
let JSelement:any = null;
if(!isOriginData && $event.el){
JSelement = $event.el;
}else if(isOriginData && $event2 && $event2.currentTarget){
JSelement = $event2.currentTarget;
}
if(JSelement){
this.calendarClass = "calendar";
if(this.selectedEventElement){
this.selectedEventElement.classList.remove("selected-event");
} }
this.selectedEventElement = JSelement; // 处理event数据
this.selectedEventElement.classList.add("selected-event"); let event: any = {};
} if(isOriginData){
// 处理上下文数据 event = JSON.parse(JSON.stringify($event));
let _this = this; }else{
let view: any = {}; event = Object.assign({title: $event.event.title, start: $event.event.start, end: $event.event.end}, $event.event.extendedProps);
let _context: any = Object.assign({},this.context); }
let _viewparams:any = Object.assign({start:event.start,end:event.end},this.viewparams); // 点击选中样式
switch(event.itemType) { let JSelement:any = null;
if(!isOriginData && $event.el){
JSelement = $event.el;
}else if(isOriginData && $event2 && $event2.currentTarget){
JSelement = $event2.currentTarget;
}
if(JSelement){
this.calendarClass = "calendar";
if(this.selectedEventElement){
this.selectedEventElement.classList.remove("selected-event");
}
this.selectedEventElement = JSelement;
this.selectedEventElement.classList.add("selected-event");
}
// 处理上下文数据
let _this = this;
let view: any = {};
let _context: any = Object.assign({},this.context);
let _viewparams:any = Object.assign({start:event.start,end:event.end},this.viewparams);
switch(event.itemType) {
<#if ctrl.getPSSysCalendarItems()??> <#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendarItem> <#list ctrl.getPSSysCalendarItems() as calendarItem>
<#if calendarItem.getPSAppDataEntity()??> <#if calendarItem.getPSAppDataEntity()??>
<#assign _appde = calendarItem.getPSAppDataEntity() /> <#assign _appde = calendarItem.getPSAppDataEntity() />
case "${calendarItem.getItemType()}": case "${calendarItem.getItemType()}":
_context.${_appde.getCodeName()?lower_case} = event.${_appde.getCodeName()?lower_case}; _context.${_appde.getCodeName()?lower_case} = event.${_appde.getCodeName()?lower_case};
view = this.getEditView("${_appde.getCodeName()?lower_case}"); view = this.getEditView("${_appde.getCodeName()?lower_case}");
break; break;
</#if> </#if>
</#list> </#list>
</#if> </#if>
}
this.selections = [event];
// 导航栏中不需要打开视图,只要抛出选中数据
if(this.isSelectFirstDefault){
this.$emit("selectionchange",this.selections);
return;
}
// 根据打开模式打开视图
if(!view.viewname){
return;
} else if (Object.is(view.placement, 'INDEXVIEWTAB') || Object.is(view.placement, '')) {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, this.context, view.deResParameters, view.parameters, [JSON.parse(JSON.stringify(_context))] , _viewparams);
this.$router.push(routePath);
} else {
let container: Subject<any> = new Subject();
if (Object.is(view.placement, 'POPOVER')) {
container = this.$apppopover.openPop(isOriginData ? $event2 : $event.jsEvent, view,JSON.parse(JSON.stringify(_context)), _viewparams);
} else if (Object.is(view.placement, 'POPUPMODAL')) {
container = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(_context)), _viewparams);
} else if (view.placement.startsWith('DRAWER')) {
container = this.$appdrawer.openDrawer(view, JSON.parse(JSON.stringify(_context)), _viewparams);
} }
container.subscribe((result: any) => { this.selections = [event];
if (!result || !Object.is(result.ret, 'OK')) { // 导航栏中不需要打开视图,只要抛出选中数据
return; if(this.isSelectFirstDefault){
this.$emit("selectionchange",this.selections);
return;
}
// 根据打开模式打开视图
if(!view.viewname){
return;
} else if (Object.is(view.placement, 'INDEXVIEWTAB') || Object.is(view.placement, '')) {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, this.context, view.deResParameters, view.parameters, [JSON.parse(JSON.stringify(_context))] , _viewparams);
this.$router.push(routePath);
} else {
let container: Subject<any> = new Subject();
if (Object.is(view.placement, 'POPOVER')) {
container = this.$apppopover.openPop(isOriginData ? $event2 : $event.jsEvent, view,JSON.parse(JSON.stringify(_context)), _viewparams);
} else if (Object.is(view.placement, 'POPUPMODAL')) {
container = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(_context)), _viewparams);
} else if (view.placement.startsWith('DRAWER')) {
container = this.$appdrawer.openDrawer(view, JSON.parse(JSON.stringify(_context)), _viewparams);
} }
// 刷新日历 container.subscribe((result: any) => {
_this.refresh(); if (!result || !Object.is(result.ret, 'OK')) {
}); return;
} }
// 刷新日历
_this.refresh();
});
}
})
} }
/** /**
...@@ -704,20 +730,40 @@ FullCalendar, ...@@ -704,20 +730,40 @@ FullCalendar,
</#list> </#list>
</#if> </#if>
} }
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams} );
const post: Promise<any> = this.service.update(itemType, JSON.parse(JSON.stringify(_context)), arg, this.showBusyIndicator); this.handleCtrlEvents('onbeforedrop', { viewparams: arg }).then((beforeDropRes: boolean) => {
post.then((response: any) => { if (!beforeDropRes) {
if (!response || response.status !== 200) {
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return; return;
} }
}, (response: any) => { const post: Promise<any> = this.service.update(itemType, JSON.parse(JSON.stringify(_context)), arg, this.showBusyIndicator);
if (response && response.status === 401) { post.then((response: any) => {
return; if (!response || response.status !== 200) {
} this.handleCtrlEvents('ondroperror', { data: response && response.data ? response.data : [] }).then((res: boolean) => {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); if (!res) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
})
}
this.handleCtrlEvents('ondropsuccess', { data: response.data }).then((res: boolean) => {
if (!res) {
return;
}
})
}, (response: any) => {
this.handleCtrlEvents('ondroperror', { data: response && response.data ? response.data : [] }).then((res: boolean) => {
if (!res) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
})
})
}); });
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册