须要四个函数实现 onSelect onUnselect onSelectAll onUnselectAll
详细代码如下:
$('#yhxdg').datagrid({
//核销明细选择事宜
onSelect:function (index,row){
var rows = $('#yhxdg').datagrid('getFooterRows');
//alert(row.HXJETZ);
var row_HXJETZ = 0;
var foot_row = rows[0];
if(row.YHXJE != \"大众\"大众){
row_HXJETZ = row.HXJETZ;
}
rows[0]['YHXJE'] = (parseFloat(row.YHXJE)+parseFloat(rows[0].YHXJE)).toFixed(2);//给页脚字段赋值
rows[0]['HXJE'] = (parseFloat(row.HXJE)+parseFloat(rows[0].HXJE)).toFixed(2);
rows[0]['ZHXJE'] = (parseFloat(row.ZHXJE)+parseFloat(rows[0].ZHXJE)).toFixed(2);
rows[0]['ZWHXJE'] = (parseFloat(row.ZWHXJE)+parseFloat(rows[0].ZWHXJE)).toFixed(2);
rows[0]['HXJETZ'] = (parseFloat(row_HXJETZ)+parseFloat(rows[0].HXJETZ)).toFixed(2);
//rows[0]['salary'] = 60000;
$('#yhxdg').datagrid('reloadFooter');//重新加载页脚数据
},
onUnselect:function (index,row){
var rows = $('#yhxdg').datagrid('getFooterRows');
//alert(row.HXJETZ);
var row_HXJETZ = 0;
var foot_row = rows[0];
if(row.YHXJE != \公众\"大众){
row_HXJETZ = row.HXJETZ;
}
rows[0]['YHXJE'] = (parseFloat(rows[0].YHXJE) - parseFloat(row.YHXJE)).toFixed(2);
rows[0]['HXJE'] = (parseFloat(rows[0].HXJE) - parseFloat(row.HXJE)).toFixed(2);
rows[0]['ZHXJE'] = (parseFloat(rows[0].ZHXJE) - parseFloat(row.ZHXJE)).toFixed(2);
rows[0]['ZWHXJE'] = (parseFloat(rows[0].ZWHXJE) - parseFloat(row.ZWHXJE)).toFixed(2);
rows[0]['HXJETZ'] = (parseFloat(rows[0].HXJETZ) - parseFloat(row_HXJETZ)).toFixed(2);
//rows[0]['salary'] = 60000;
$('#yhxdg').datagrid('reloadFooter');
},
onSelectAll:function (rows){
var foot_YHXJE = 0;
var foot_HXJE = 0;
var foot_ZHXJE = 0;
var foot_ZWHXJE = 0;
var foot_HXJETZ = 0;
for(var i = 0;i < rows.length;i++){
foot_YHXJE = (parseFloat(foot_YHXJE) + parseFloat(rows[i].YHXJE)).toFixed(2);
foot_HXJE = (parseFloat(foot_HXJE) + parseFloat(rows[i].HXJE)).toFixed(2);
foot_ZHXJE = (parseFloat(foot_ZHXJE) + parseFloat(rows[i].ZHXJE)).toFixed(2);
foot_ZWHXJE = (parseFloat(foot_ZWHXJE) + parseFloat(rows[i].ZWHXJE)).toFixed(2);
foot_HXJETZ = (parseFloat(foot_HXJETZ) + parseFloat(rows[i].HXJETZ)).toFixed(2);
}
var foot_rows = $('#yhxdg').datagrid('getFooterRows');
foot_rows[0]['YHXJE'] = foot_YHXJE;
foot_rows[0]['HXJE'] = foot_HXJE;
foot_rows[0]['ZHXJE'] = foot_ZHXJE;
foot_rows[0]['ZWHXJE'] = foot_ZWHXJE;
foot_rows[0]['HXJETZ'] = foot_HXJETZ;
//rows[0]['salary'] = 60000;
$('#yhxdg').datagrid('reloadFooter');
},
onUnselectAll:function (rows){
var foot_rows = $('#yhxdg').datagrid('getFooterRows');
foot_rows[0]['YHXJE'] = \"大众0\"大众;
foot_rows[0]['HXJE'] = \公众0\"大众;
foot_rows[0]['ZHXJE'] = \"大众0\"大众;
foot_rows[0]['ZWHXJE'] = \"大众0\"大众;
foot_rows[0]['HXJETZ'] = \"大众0\"大众;
//rows[0]['salary'] = 60000;
$('#yhxdg').datagrid('reloadFooter');
}
});
})
2.JS获取路径项目绝对的判断,
function getRootPath(){
//获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
var curWwwPath=window.document.location.href;
//获取主机地址之后的目录,如: uimcardprj/share/meun.jsp
var pathName=window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
//获取主机地址,如: http://localhost:8083
var localhostPaht=curWwwPath.substring(0,pos);
//获取带\公众/\"大众的项目名,如:/uimcardprj
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
if((localhostPaht.substring(0,16) == \"大众http://localhost\"大众) ||(localhostPaht.substring(0,17) == \"大众http://127.0.0.1\"大众)){
return(localhostPaht+projectName); //如果在本地调试,返回该值
}else{
return(localhostPaht);//支配到做事器上,返回该值
}
}
3.NC发卖订单修订【修订】按钮拦截器修正
修正缘故原由:之前未对列表界面进行判断,其余,对不是最新版本的订单进行修订,可以进入修订界面,但是在保存时,会提示当前操作单据不是最新版本,
无法进行保存。