|
楼主 |
发表于 2017-4-14 10:20:32
|
显示全部楼层
实现代码如下:
Model.prototype.mainDataValueChanged = function(event) {
var self = this;
if (event.col == "fKHQ" || event.col == "fDeptID" || event.row.val("FCOSTITEM")) {
// 获取预算总额
if (event.row.val("FCOSTITEM") && event.row.val("fKHQ") && event.row.val("fKSSHIJIAN") && event.row.val("fJSSJ") && event.row.val("fYear") && event.row.val("fDeptID")) {
debugger;
this.comp("ysuuanData2").filters.clear();
this.comp("ysuuanData2").refreshData();
this.comp("ysuuanData2").setFilter(
"yusuanzonge",
"fBDKFTKGJX= '" + event.row.val("FCOSTITEM") + "' and FYEAR = '" + event.row.val("fYear") + "' and fKHQ = '" + event.row.val("fKHQ") + "' and sOrgID = '"
+ event.row.val("fDeptID") + "' and fDocumentStatus=2 and fIsNew=1");
this.comp("ysuuanData2").refreshData();
var yusuanzonge = this.comp("ysuuanData2").getValue("fTotal");
this.comp("mainData").setValue("fYSZE", yusuanzonge);
console.log("预算金额" + yusuanzonge);
if (yusuanzonge == '' || yusuanzonge == null || yusuanzonge == undefined) {
justep.Util.hint("预算金额为空,请确保最新版的预算申请,审批完成后再添加!");
}
var param = new biz.Request.ActionParam();
param.setString('khq', event.row.val("fKHQ"));
param.setString('year', event.row.val("fYear"));
param.setString('org', event.row.val("fDeptID"));
param.setString('fyfl', event.row.val("FCOSTITEM"));
param.setString('fid', this.comp("mainData").getCurrentRowID());
biz.Request.sendBizRequest({
contentType : "application/json",
dataType : "application/json",
process : "/aojing/gp/process/gp_sampleApply/gp_sampleApplyProcess",
activity : "sampleApplyPage",
action : "getSampleYSAction",
directExecute : true,
parameters : param,
callback : function(evtData) {
if (evtData.state) {
debugger;
var rows = evtData.response;
self.comp("mainData").setValue("fSPZZE", rows.spzje);
self.comp("mainData").setValue("fYTGSPZE", rows.hyspje);
self.comp("mainData").setValue("fSYTBZE", getDiff(rows.ysje, rows.hyspje, rows.spzje));
} else {
}
// evtData.ignoreError = false;
}
});
}
}
// 计算剩余填报总额
function getDiff(arg1, arg2, arg3) {
if (arg1 && arg2 && arg3) {
return Number(arg1) - Number(arg2) - Number(arg3);
} else
return "";
}
};
|
|