提交 34e24c21 编写于 作者: zhangpingchuan's avatar zhangpingchuan

zpc---增加批量添加功能和修复数据关系分页部件参数传递bug

上级 e9af2abd
...@@ -177,6 +177,20 @@ ...@@ -177,6 +177,20 @@
} }
Object.assign(this.selection, item); Object.assign(this.selection, item);
} }
<#-- 定义宏 -->
<#macro getParentmode PSDEDataRelation dritemName>
<#compress>
<#if PSDEDataRelation.getPSDEDRDetails?? && PSDEDataRelation.getPSDEDRDetails()??>
<#assign deDrDetails = PSDEDataRelation.getPSDEDRDetails() />
<#list deDrDetails as deDrDetail>
<#if deDrDetail.getName() == dritemName && deDrDetail.getPSDEDRItem?? && deDrDetail.getPSDEDRItem()?? && deDrDetail.getPSDEDRItem().getParentDataJO()??>
${deDrDetail.getPSDEDRItem().getParentDataJO()}
</#if>
</#list>
</#if>
</#compress>
</#macro>
<#list ctrl.getRootItem().getAllItems() as dritem> <#list ctrl.getRootItem().getAllItems() as dritem>
...@@ -217,7 +231,7 @@ ...@@ -217,7 +231,7 @@
viewcontainer2: true, viewcontainer2: true,
}, },
props: { props: {
viewdata: JSON.stringify({ srfparentdata: this.selection.data}), viewdata: JSON.stringify({ srfparentdata: Object.assign(this.selection.data,<@getParentmode ctrl.getPSDEDataRelation() '${dritem.getId()}'/>)}),
}, },
key: this.$util.createUUID(), key: this.$util.createUUID(),
}) })
......
...@@ -13,7 +13,68 @@ ...@@ -13,7 +13,68 @@
<#if viewlogic.isEnableWizardAdd()> <#if viewlogic.isEnableWizardAdd()>
this.$Notice.warning({ title: '错误', desc: '向导添加未实现' }); this.$Notice.warning({ title: '错误', desc: '向导添加未实现' });
<#elseif viewlogic.isEnableBatchAdd()> <#elseif viewlogic.isEnableBatchAdd()>
this.$Notice.warning({ title: '错误', desc: '批量添加未实现' }); <#-- 批量添加 -->
<#if viewlogic.getBatchAddPSAppViews?? && viewlogic.getBatchAddPSAppViews()??>
<#assign batchAddPSAppViews = viewlogic.getBatchAddPSAppViews()/>
<#list batchAddPSAppViews as batchAddPSAppView>
<#if batchAddPSAppView_index == 0>
<#assign batchappView = batchAddPSAppView />
</#if>
</#list>
</#if>
const data: any = {};
if (args && args.length > 0 && args[0].srfsourcekey) {
Object.assign(data, { srfsourcekey: args[0].srfsourcekey })
}
const _this: any = this;
if (_this.srfparentdata) {
Object.assign(data, { srfparentdata: _this.srfparentdata });
}
const openPopupModal = (view: any, data: any) => {
let container: Subject<any> = this.$appmodal.openModal(view, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
// 处理参数
if(result.datas && result.datas.length == 0){
return;
}
let keys = '';
const viewParam:any = {};
console.log(_this.srfparentdata);
if (_this.srfparentdata) {
Object.assign(viewParam,{ srfparentdata: _this.srfparentdata});
}
result.datas.forEach((record:any) => {
let key = record.srfkey;
if (!Object.is(keys, '')) {
keys += ';';
}
keys += key;
});
Object.assign(viewParam,{srfkeys:keys});
// 发送批处理请求
const url:string ="${app.getPKGCodeName()?lower_case}/${de.getPSSystemModule().codeName?lower_case}/${de.codeName?lower_case}/addbatch";
this.$http.post(url,viewParam).then((response:any) =>{
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '批处理操作失败' });
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
})
});
}
const view: any = {
viewname: '${srffilepath2(batchappView.getCodeName())}',
height: ${batchappView.getHeight()?c},
width: ${batchappView.getWidth()?c},
title: '${batchappView.title}',
};
openPopupModal(view, data);
<#elseif viewlogic.isBatchAddOnly()> <#elseif viewlogic.isBatchAddOnly()>
this.$Notice.warning({ title: '错误', desc: '只支持批添加未实现' }); this.$Notice.warning({ title: '错误', desc: '只支持批添加未实现' });
<#elseif viewlogic.getNewDataPSAppView()??> <#elseif viewlogic.getNewDataPSAppView()??>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册