提交 2236426b 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 4ce89950
......@@ -12,6 +12,28 @@
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 建立数据
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
// 准备上下文参数
const tempContext = {...context};
if (xData && xData.context) {
Object.assign(tempContext, xData.context);
}
const data = args[0];
const appEntityService: ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
if (data.hasOwnProperty(appEntityService.APPDEKEY.toLowerCase())) {
delete data[appEntityService.APPDEKEY.toLowerCase()];
}
try {
appEntityService.Create(tempContext, Data).then((response: any) => {
if (!response.status || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行建立数据逻辑[执行行为异常]' });
}
})
} catch (error: any) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行建立数据逻辑[执行行为异常]' });
}
<#else>
this.$Notice.error({ title: '错误', desc: '建立数据行未配置实体' });
</#if>
}
</#macro>
\ No newline at end of file
......@@ -12,6 +12,33 @@
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 删除数据
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
// 准备上下文参数
const tempContext = {...context};
if (xData && xData.context) {
Object.assign(tempContext, xData.context);
}
const data = args[0];
const appEntityService: ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
const key = appEntityService.APPDEKEY.toLowerCase();
const name = appEntityService.APPDENAME.toLowerCase();
if (data.hasOwnProperty(name)) {
Object.assign(tempContext, { [name]: data[name] });
}
if (data.hasOwnProperty(key)) {
Object.assign(tempContext, { [name]: data[key] });
}
try {
appEntityService.Remove(tempContext, Data).then((response: any) => {
if (!response.status || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行删除数据逻辑[执行行为异常]' });
}
})
} catch (error: any) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行删除数据逻辑[执行行为异常]' });
}
<#else>
this.$Notice.error({ title: '错误', desc: '删除数据行未配置实体' });
</#if>
}
</#macro>
\ No newline at end of file
......@@ -12,6 +12,42 @@
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 保存变更
<#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 appEntityService: ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
const key = appEntityService.APPDEKEY.toLowerCase();
const name = appEntityService.APPDENAME.toLowerCase();
if (data.hasOwnProperty(key) || data.hasOwnProperty(name)) {
if (data.hasOwnProperty(key)) {
Object.assign(context, { [name]: data[key] });
} else {
Object.assign(context, { [name]: data[name] });
}
action = 'Update';
} else {
action = 'Create';
}
try {
if (action) {
appEntityService[action](tempContext, Data).then((response: any) => {
if (!response.status || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
})
} else {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
} catch (error: any) {
this.$Notice.error({ title: '错误', desc: '当前环境无法执行保存变更逻辑[执行行为异常]' });
}
<#else>
this.$Notice.error({ title: '错误', desc: '建立数据行为配置实体' });
</#if>
}
</#macro>
\ No newline at end of file
......@@ -12,6 +12,14 @@
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 同步数据
if (xData) {
if (xData.refresh && (xData.refresh instanceof Function)) {
xData.refresh();
} else if (xData.refreshDataArea && (xData.refreshDataArea instanceof Function)) {
xData.refreshDataArea();
} else {
this.$Notice.error({ title: '错误', desc: '同步数据行为未实现' });
}
}
}
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册