提交 6a094359 编写于 作者: RedPig97's avatar RedPig97

update:选择视图数据变更

上级 992d5c67
......@@ -12,38 +12,44 @@
* @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];
let action: string | undefined = undefined;
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] });
action = 'Update';
} else {
action = 'Create';
// 选择视图保存变更
if (Object.is(this.viewType, 'DEPICKUPVIEW') || Object.is(this.viewType, 'DEMPICKUPVIEW')) {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
} else {
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
// 准备上下文参数
const tempContext = {...context};
if (xData && xData.context) {
Object.assign(tempContext, xData.context);
}
if (service[action] && service[action] instanceof Function) {
service[action](tempContext, data).then((response: any) => {
if (!response.status || response.status !== 200) {
const data = args[0];
let action: string | undefined = undefined;
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] });
action = 'Update';
} else {
action = 'Create';
}
if (service[action] && service[action] instanceof Function) {
service[action](tempContext, data).then((response: any) => {
if (!response.status || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
}).catch((error: any) => {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
}).catch((error: any) => {
})
} else {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
})
} else {
actionContext.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
}
}
<#else>
actionContext.$Notice.error({ title: '错误', desc: '保存变更行为未配置实体' });
actionContext.$Notice.error({ title: '错误', desc: '保存变更行为未配置实体' });
</#if>
}
}
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册