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

update:选择视图数据变更

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