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
<#-- 删除数据 -->
<#macro dataRemoveObject item>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public async ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
// 准备上下文参数
const tempContext = {...context};
if (xData && xData.context) {
Object.assign(tempContext, xData.context);
}
const data = args[0];
const service = await window.entityServiceRegister.getService('${item.getPSAppDataEntity().getCodeName()?lower_case}');
if (service) {
const key = service.APPDEKEY.toLowerCase();
const name = service.APPLYDEKEY.toLowerCase();
if (data.hasOwnProperty(key)) {
Object.assign(tempContext, { [name]: data[key] });
}
service.Remove(tempContext, data).then((response: any) => {
if (!response.status || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行删除数据逻辑[执行行为异常]' });
}
const parentRef: any = actionContext.$parent;
if (parentRef.closeView && (parentRef.closeView instanceof Function)) {
parentRef.closeView(args);
} else if (actionContext.closeView && (actionContext.closeView instanceof Function)) {
actionContext.closeView(args);
}
}).catch((error: any) => {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行删除数据逻辑[执行行为异常]' });
})
}
<#else>
actionContext.$Notice.error({ title: '错误', desc: '删除数据行未配置实体' });
</#if>
}
</#macro>