提交 14910254 编写于 作者: zcdtk's avatar zcdtk

添加删除功能,修复更新功能

上级 feace0e7
......@@ -80,23 +80,70 @@
let response: any;
switch (itemType) {
<#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendarItem>
<#if calendarItem.getPSAppDataEntity()??>
<#assign _appde = calendarItem.getPSAppDataEntity() />
<#if _appde.getId() == appde.getId()>
<#list ctrl.getPSSysCalendarItems() as calendarItem>
<#if calendarItem.getPSAppDataEntity()?? && calendarItem.getUpdatePSAppDEAction()??>
<#assign _deAction = calendarItem.getUpdatePSAppDEAction() />
<#assign _appde = calendarItem.getPSAppDataEntity() />
<#if _appde.getId() == appde.getId()>
case "${calendarItem.getItemType()}":
response = await this.service.Update(context, data);
response = await this.service.${_deAction.getCodeName()}(context, data);
break;
<#else>
<#else>
case "${calendarItem.getItemType()}":
response = await this.getService('${_appde.getCodeName()?lower_case}').then((s: any) => s.Update(context, data));
context _service: any = await this.getService('${_appde.getCodeName()?lower_case}');
if (_service && _service[${_deAction.getCodeName()}] && _service[${_deAction.getCodeName()}] instanceof Function) {
response = await _service[${_deAction.getCodeName()}](context, data);
}
break;
</#if>
</#if>
</#if>
</#list>
</#list>
</#if>
}
if (!response || !response.isError()) {
response = this.handleResponse("", response);
}
await this.onAfterAction('', context, response);
return new HttpResponse(response.status, response.data);
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isLoading]
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public async delete(itemType: string, context: any = {}, data: any = {}, isLoading?: boolean): Promise<any> {
await this.onBeforeAction('', context, data, isLoading);
data = this.handleRequestData('', context, data);
let response: any;
switch (itemType) {
<#if ctrl.getPSSysCalendarItems()??>
<#list ctrl.getPSSysCalendarItems() as calendarItem>
<#if calendarItem.getPSAppDataEntity()?? && calendarItem.getRemovePSAppDEAction()??>
<#assign _deAction = calendarItem.getRemovePSAppDEAction() />
<#assign _appde = calendarItem.getPSAppDataEntity() />
<#if _appde.getId() == appde.getId()>
case "${calendarItem.getItemType()}":
response = await this.service.${_deAction.getCodeName()}(context, data);
break;
<#else>
case "${calendarItem.getItemType()}":
context _service: any = await this.getService('${_appde.getCodeName()?lower_case}');
if (_service && _service[${_deAction.getCodeName()}] && _service[${_deAction.getCodeName()}] instanceof Function) {
response = await _service[${_deAction.getCodeName()}](context, data);
}
break;
</#if>
</#if>
</#list>
</#if>
}
if (!response.isError()) {
if (!response || !response.isError()) {
response = this.handleResponse("", response);
}
await this.onAfterAction('', context, response);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册