Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
22
议题
22
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7
提交
358f0d61
提交
358f0d61
编写于
12月 15, 2020
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
适配多项数据主键逻辑(自定义批处理)
上级
44807c1b
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
65 行增加
和
2 行删除
+65
-2
LOGIC.vue.ftl
@LOGIC/@UIACTION/后台调用/LOGIC.vue.ftl
+27
-2
%DE_PKGPATH%-service-base.ts.ftl
...src/service/%DE_PKGPATH%/%DE_PKGPATH%-service-base.ts.ftl
+38
-0
未找到文件。
@LOGIC/@UIACTION/后台调用/LOGIC.vue.ftl
浏览文件 @
358f0d61
...
...
@@ -81,10 +81,35 @@ ${backend_block}
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
<#-- 多项数据主键转换数据 start -->
if(Object.is(actionTarget,"MULTIKEY")){
let tempDataArray:Array<any> = [];
if((_args.length >1) && (Object.keys(data).length >0)){
for(let i =0;i<_args.length;i++){
let tempObject:any = {};
Object.keys(data).forEach((key:string) =>{
Object.assign(tempObject,{[key]:data[key].split(',')[i]});
})
tempDataArray.push(tempObject);
}
}else{
tempDataArray.push(data);
}
data = tempDataArray;
}
<#-- 多项数据主键转换数据 end -->
context = Object.assign({},actionContext.context,context);
<#-- 构建srfparentdename和srfparentkey start -->
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
<#-- 多项数据主键转换数据 start -->
if(Object.is(actionTarget,"MULTIKEY") && data.length >0){
data.forEach((item:any) => {
Object.assign(item,parentObj);
});
}else{
Object.assign(data,parentObj);
}
<#-- 多项数据主键转换数据 end -->
Object.assign(context,parentObj);
<#-- 构建srfparentdename和srfparentkey end -->
// 直接调实体服务需要转换的数据
...
...
@@ -95,7 +120,7 @@ ${backend_block}
const backend = () => {
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()?? && item.getPSAppDEMethod?? && item.getPSAppDEMethod()??>
const curService:${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
curService.${item.getPSAppDEMethod().getCodeName()}(context,data, ${item.isShowBusyIndicator()?c}).then((response: any) => {
curService.${item.getPSAppDEMethod().getCodeName()}
<#if item.getActionTarget() == 'MULTIKEY'>Batch</#if>
(context,data, ${item.isShowBusyIndicator()?c}).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
...
...
APP/src/service/%DE_PKGPATH%/%DE_PKGPATH%-service-base.ts.ftl
浏览文件 @
358f0d61
...
...
@@ -729,6 +729,44 @@ export default class ${srfclassname('${item.getCodeName()}')}ServiceBase extends
}
</#if>
<#-- 查询数据集(post方式)end -->
<#-- 自定义行为Batch方法start -->
<#if singleAppMethod.getMethodType?? && singleAppMethod.getMethodType()?? && singleAppMethod.getMethodType() == "DEACTION" && singleAppMethod.getPSDEAction?? && singleAppMethod.getPSDEAction()?? && singleAppMethod.getPSDEServiceAPIMethod?? && singleAppMethod.getPSDEServiceAPIMethod()??>
<#assign deAction = singleAppMethod.getPSDEAction()>
<#assign singleServiceApi = singleAppMethod.getPSDEServiceAPIMethod()/>
/**
* ${singleAppMethod.getCodeName()}Batch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof ${srfclassname('${item.getCodeName()}')}ServiceBase
*/
public async ${singleAppMethod.getCodeName()}Batch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
<#if item.getPSAppDERSPathCount() gt 0 && singleServiceApi??>
<#list 1..item.getPSAppDERSPathCount() as count>
<#assign path = ''/>
<#assign condition = ''/>
<#list item.getPSAppDERSPath(count_index) as deRSPath>
<#if deRSPath.getMajorPSAppDataEntity?? && deRSPath.getMajorPSAppDataEntity()??>
<#assign _dataEntity = deRSPath.getMajorPSAppDataEntity()/>
<#assign condition>${condition}context.${_dataEntity.getCodeName()?lower_case} && </#assign>
<#assign path>${path}${srfpluralize(_dataEntity.codeName)?lower_case}/<#noparse>$</#noparse>{context.${_dataEntity.getCodeName()?lower_case}}/</#assign>
</#if>
</#list>
if(${condition}true){
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/${path}${item.codeName?lower_case}<#if singleServiceApi.getRequestPath()??>${singleServiceApi.getRequestPath()}</#if>batch`,tempData,isloading);
}
</#list>
</#if>
<#if item.isMajor()>
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/${item.codeName?lower_case}<#if singleServiceApi.getRequestPath()??>${singleServiceApi.getRequestPath()}</#if>batch`,tempData,isloading);
</#if>
}
</#if>
<#-- 自定义行为Batch方法end -->
<#-- 检查行为是否可以执行 start -->
<#-- @author zpc -->
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录