1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<#assign extendsClass>GridServiceBase</#assign>
<#ibizinclude>
../@MACRO/SERVICE/SERVICE_HEADER.ts.ftl
</#ibizinclude>
<#assign import_block>
<#if ctrl.getAggMode() == "ALL" && ctrl.getAggPSAppDataEntity()??>
<#assign aggAppDataEntity = ctrl.getAggPSAppDataEntity() >
import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/service/${srffilepath2(aggAppDataEntity.getCodeName())}/${srffilepath2(aggAppDataEntity.getCodeName())}-service';
</#if>
</#assign>
/**
* 合并配置的默认值
*
* @protected
* @param {*} [response={}]
* @memberof ${srfclassname(ctrl.codeName)}Service
*/
public mergeDefaults(response:any = {}): void {
if (response.data) {
<#list ctrl.getPSDEGridEditItems() as edititem><#t>
<#if edititem.getCreateDV?? && edititem.getCreateDV()??><#t>
<#if !(edititem.getCreateDV() == '')><#t>
Object.assign(response.data, { '${edititem.getCodeName()?lower_case}': '${edititem.getCreateDV()}' });
</#if>
</#if>
</#list>
}
}
<#if ctrl.getAggMode() == "ALL" && ctrl.getAggPSAppDataEntity()??>
<#assign aggAppDataEntity = ctrl.getAggPSAppDataEntity() >
/**
* 表格聚合加载数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isLoading]
* @returns {Promise<HttpResponse>}
* @memberof ${srfclassname(ctrl.codeName)}Service
*/
public async getAggData(action: string, context: any = {}, data: any = {}, isLoading?: boolean): Promise<HttpResponse> {
await this.onBeforeAction(action, context, data, isLoading);
data = this.handleRequestData(action, context, data);
const service: any = await this.getService('${aggAppDataEntity.getCodeName()?lower_case}');
let response: HttpResponse;
if (Util.isFunction(service[action])) {
response = await this.service[action](context, data);
} else {
response = null;
}
if (response.status === 200) {
response = this.handleResponse(action, response);
}
await this.onAfterAction(action, context, response);
return response;
}
</#if>
<#ibizinclude>
../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl
</#ibizinclude>