提交 4b73f4ff 编写于 作者: zhangpingchuan's avatar zhangpingchuan

zpc---批量修改功能

上级 dc8a397d
<#macro getres tempView>
<#compress>
<#if tempView.getPSAppDataEntity?? && tempView.getPSAppDataEntity()?? && tempView.getPSAppDataEntity().getPSDataEntity?? && tempView.getPSAppDataEntity().getPSDataEntity()??>
<#assign dataeneity = tempView.getPSAppDataEntity().getPSDataEntity() />
<#if dataeneity.getMajorPSDERs?? && dataeneity.getMajorPSDERs()??>
[<#list dataeneity.getMajorPSDERs() as psDes>'${psDes.getName()}'<#if psDes_has_next>,</#if></#list>]
</#if>
</#if>
</#compress>
</#macro>
<#if item.getPSViewLogic?? && item.getPSViewLogic()??>
<#assign viewlogic = item.getPSViewLogic()/>
/**
......@@ -14,7 +24,81 @@
this.$Notice.warning({ title: '错误', desc: '向导添加未实现' });
<#elseif viewlogic.isEnableBatchAdd()>
<#-- 批量添加 -->
this.$Notice.warning({ title: '错误', desc: '批量添加未实现' });
<#if viewlogic.getBatchAddPSAppViews?? && viewlogic.getBatchAddPSAppViews()??>
<#assign batchAddPSAppViews = viewlogic.getBatchAddPSAppViews()/>
const batchAddPSAppViews=[
<#list batchAddPSAppViews as batchAddPSAppView>
{view:{viewname:'${srffilepath2(batchAddPSAppView.getCodeName())}',height: ${batchAddPSAppView.getHeight()?c},width: ${batchAddPSAppView.getWidth()?c},title: '${batchAddPSAppView.title}'},
res:<@getres tempView=batchAddPSAppView />}<#if batchAddPSAppView_has_next>,</#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 });
}
if(batchAddPSAppViews.length == 0){
this.$Notice.warning({ title: '错误', desc: '批量添加需添加N:N关系' });
return;
}
batchAddPSAppViews.forEach((item:any,index:number) =>{
if(item.res){
item.res.forEach((curRes:any) =>{
if(Object.is(curRes,_this.srfparentdata.srfparentmode)){
item.curRes = true;
}
})
}
})
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 = {};
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);
})
});
}
let curView:any ={};
batchAddPSAppViews.forEach((item:any) =>{
if(!item.curRes){
Object.assign(curView,item.view)
}
})
const view: any = curView;
openPopupModal(view, data);
<#elseif viewlogic.isBatchAddOnly()>
this.$Notice.warning({ title: '错误', desc: '只支持批添加未实现' });
<#elseif viewlogic.getNewDataPSAppView()??>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册