var CurrQueryID = 47; var CurrQueryDs = null; var CurrDs = null; $(function () { CurrQueryDs = GetQueryCol(CurrQueryID); GetGrid(); }) $(window).resize(function () { $(window).unbind("onresize"); //$("#gridTable").setGridHeight($(window).height() - 190); doResize(); $(window).bind("onresize", this); }); function doResize() { var ss = getPageSize(); $("#gridTable").jqGrid('setGridWidth', ss.WinW - 10).jqGrid('setGridHeight', ss.WinH - 100); } function getPageSize() { //http://www.blabla.cn/js_kb/javascript_pagesize_windowsize_scrollbar.html var winW, winH; if (window.innerHeight) {// all except IE winW = window.innerWidth; winH = window.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode winW = document.documentElement.clientWidth; winH = document.documentElement.clientHeight; } else if (document.body) { // other winW = document.body.clientWidth; winH = document.body.clientHeight; } // for small pages with total size less then the viewport return { WinW: winW, WinH: winH }; } //加载表格 function GetGrid() { var condition = GetCondition(); CurrDs = RDForQueryIndexONameArgsForDb(CurrQueryID, condition, $("#currdbname").val()); if (CurrDs.hasOwnProperty("resultcode")) { alert("调用发生错误,错误信息为:" + CurrDs["errorinfo"]); return; } $("#gridTable").jqGrid({ datatype: "local", data: CurrDs, height: $(window).height() - 149, autowidth: true, colModel: GetTableColStr(CurrQueryDs), pager: "#gridPager", sortname: '', sortorder: 'desc', rownumbers: true, shrinkToFit: false, gridview: true, }); } //获取用户设置的查询条件 function GetCondition() { //var condition = ""; //var tempstr = $("#FCode").val(); //if (tempstr != "") { // condition += " and a.FCode='" + tempstr + "'"; //} //tempstr = $("#FDateS").val(); //var tempstre = $("#FDateE").val(); //if (tempstr != "" && tempstre != "") { // condition += " and a.fdate between to_date('" + tempstr + " 00:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('" + tempstre + " 23:59:59','YYYY-MM-DD HH24:MI:SS')"; //} //var tt = "@(LeaRun.Utilities.ManageProvider.Provider.Current().Code)"; //condition += " and a.pmc01='" + tt + "'"; //return condition; return ""; } //根据条件查询 function btn_Search() { $("#gridTable").clearGridData(); var condition = GetCondition(); CurrDs = RDForQueryIndexONameArgsForDb(CurrQueryID, condition, $("#currdbname").val()); if (CurrDs.hasOwnProperty("resultcode")) { alert("调用发生错误,错误信息为:" + CurrDs["errorinfo"]); return; } $("#gridTable").jqGrid('setGridParam', { datatype: "local", data: CurrDs }).trigger('reloadGrid'); } //编辑 function btn_edit() { //var KeyValue = GetJqGridRowValue("#gridTable", "ID"); //if (IsChecked(KeyValue)) { // ShowSgoodsMstBase(KeyValue); //} doResize(); } //新增 function btn_add() { ShowSgoodsMstBase(0); } function ShowSgoodsMstBase(id) { var url = "/OilModule/SGoodsMst/SGoodsMstBaseNew?KeyValue=" + id; AddTabMenu("SGoodsMstBase111", url, "送货单维护", "application_side_expand.png", true, true, true); } function btn_delete() { confirmDialog("提示", "您确定要删除您选择的数据吗?", function (r) { if (r) { var detailKeyValue = GetJqGridRowValue("#gridTable", "ID"); var Nurl = '/OilModule/SGoodsMst/DelSGoodsMst'; var PostDdata = '{ "ID": "' + detailKeyValue + '}'; var parm = { json: PostDdata }; AjaxJson(Nurl, parm, DetailDelete); } }); } function DetailDelete(json) { json = JSON.parse(json); if (json.hasOwnProperty("state")) { alert("调用发生错误,错误信息为:" + json.message); return; } var result = json[0].ID; if (result > 0) { alert("删除成功!"); btn_Search(); } }