需求:客户需要将科研预算项目执行情况开发成WEB报表
思路:
1.开发后台按项目取出项目预算执行情况数据。
2.前端WEB搭建一张单据,增加项目F7字段、人员F7字段,用于过滤项目成员包含该用户,添加按钮查询后端数据。
/**************************提示:只允许修改开发区域,其他区域会被覆盖!********************************/
mod.definePage("extend/cp/bc/js/YSBillEdit",function(waf){
//@beginUseModule
//@endUseModule
var _public = {},_private = {},me=_self;
//@beginPublic
waf.extend(_public,{
//控件事件描述:
sleectProject:function(event,value){
return _private.sleectProject(event,value);
}
,
//页面事件描述:项目过滤
PrjectFilter:function(e){
return _private.PrjectFilter(e);
}
});
_self.subscribeEvent("pageOnLoadEvent",_public.PrjectFilter,"after");
//@endPublic
//@beginTemplateFunctions
//@endTemplateFunctions
/**************************开发区域开始**********************************************/
//@beginPrivate
waf.extend(_private,{
sleectProject:function(event,value){
//删除行
var counts=waf("#editgrid").wafGrid("getRowCount");
for(var i=counts;i>0;i--){
var RowId= waf("#editgrid").wafGrid("getRowId",i);
waf("#editgrid").wafGrid("delRow",RowId);
}
//选择项目
var project= waf("#projectBill").wafPromptBox("getValue");
var projectNumbr= project.number;
//调用逻辑
waf.doPost({
action:'YS',
data:{//向后台传递的参数
projectNumbr:projectNumbr
},
success:function(data){//成功后返回的数据
if(data){
var list =data;
for (var i = 1; i <=list.length; i++) {
waf("#editgrid").wafGrid("addRow");
var RowId= waf("#editgrid").wafGrid("getRowId",i);
var myMap =list[i-1];
for (var key in myMap) {
var KMNUMBER=myMap["KMNUMBER"];
var KMNAME=myMap["KMNAME"];
var YSAMOUNT=myMap["YSAMOUNT"];
var SJAMOUNT=myMap["SJAMOUNT"];
waf("#editgrid").wafGrid("setCell", RowId, "kmbm",KMNUMBER);
waf("#editgrid").wafGrid("setCell", RowId, "kmmc",KMNAME);
waf("#editgrid").wafGrid("setCell", RowId, "ysAmount",YSAMOUNT);
waf("#editgrid").wafGrid("setCell", RowId, "actAmount",SJAMOUNT);
waf("#editgrid").wafGrid("setCell", RowId, "yrAmount",YSAMOUNT-SJAMOUNT);
}
}
}
}
});
}
,
PrjectFilter:function(e){
var person= waf("#applier").wafPromptBox("getValue");
if(person!=null){
var id=person.id;
waf("#projectBill").wafPromptStandard("option","filteritem","id in ( select fparentid from CT_BD_Entry where CFPersonID ='"+id+"') ");//通用f7
}
}
});//@endPrivate
/**************************开发区域结束**********************************************/
return _public;
});