var commonGridObj_orderlist; var comboCUSTOMERNAME; //委托单位 var comboVESSEL; //船名 var comboOP; //操作人员 var sortName = ""; var sortIndex = ""; var newHeaderArgs; var newWidthArgs; var newColAlignArgs; var newColSortArgs; var newColTypeArgs; var s0 = ""; function $(id) { return document.getElementById(id); } function createGrid(type) { //获取自定义列表样式 //if (document.getElementById("origopseailcl") == null) { var url = "../UserSettings/UserGridSource/OrigOpSeaiLCLGrid.js?uid=" + newGuid(); var loader = dhtmlxAjax.getSync(url); var jsVal = loader.xmlDoc.responseText; var oHead = document.getElementsByTagName('head').item(0); var oScript = document.createElement("script"); oScript.language = "javascript"; oScript.type = "text/javascript"; oScript.id = "origopseailcl"; oScript.defer = true; oScript.text = jsVal; oHead.appendChild(oScript); //} // var searchJson = ""; if (type == 2) { var _begintime = $("txt_beginetd").value.trim(); if (_begintime.trim() != "") { if (!validateDateTime(_begintime)) { alert("起始时间格式错误"); return; } } var _endtime = $("txt_endetd").value.trim(); if (_endtime.trim() != "") { if (!validateDateTime(_endtime)) { alert("结束时间格式错误"); return; } } var _customer = $("h_customer").value.trim(); var _vessel = $("h_vessel").value.trim(); var _op = $("h_operator").value.trim(); var _checkno = $("txt_no").value.trim(); var searchJson = ""; //begin searchJson += "{"; searchJson += "["; //如果查询条件设置了起始时间和结束时间则判断结束时间是否大于起始时间 if (_begintime != "" && _endtime != "") { if (_begintime.length > 9 && _endtime.length > 9) { var status = DateTimeEqual(_begintime, _endtime); if (status == 0) { searchJson += "\"btime\":\"" + _begintime + "\"," searchJson += "\"etime\":\"" + _endtime + "\"," } else if (status == -1) { alert("时间设置错误,起始时间不能大于结束时间,请修改!"); return; } // else if (status == -2) { // alert("时间设置错误,起始时间不能等于结束时间,请修改!"); // return; // } } else { alert("时间格式有问题,长度应大于9个字符,请修改!"); return; } } else { searchJson += "\"btime\":\"" + _begintime + "\"," searchJson += "\"etime\":\"" + _endtime + "\"," } searchJson += "\"cus\":\"" + _customer + "\","; searchJson += "\"vessel\":\"" + _vessel + "\","; searchJson += "\"op\":\"" + _op + "\","; searchJson += "\"no\":\"" + _checkno + "\""; searchJson += "]"; searchJson += "}"; } commonGridObj_orderlist = new TGridCommon("mygrid_container_seai", "form1", headerArgs_orderlist, widthArgs_orderlist, colAlignArgs_orderlist, colSortArgs_orderlist, colTypeArgs_orderlist); commonGridObj_orderlist.setResponseUrl("SeaImportLCLListGridSource.aspx"); commonGridObj_orderlist.setSortValue("etd", "desc"); var searchcacheName = $("h_searchcache").value; if (commonGridObj_orderlist.sortValue.length > 1 && commonGridObj_orderlist.sortType.length > 1) { if (searchcacheName != "") { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=" + commonGridObj_orderlist.sortValue + "&sortindex=" + commonGridObj_orderlist.sortType + "&searchcachename=" + searchcacheName); } else { if (searchJson.trim() != "") { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&search=" + escape(searchJson) + "&uid=" + commonGridObj_orderlist.newGuid() + "&sort=" + commonGridObj_orderlist.sortValue + "&sortindex=" + commonGridObj_orderlist.sortType); } else { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=" + commonGridObj_orderlist.sortValue + "&sortindex=" + commonGridObj_orderlist.sortType); } } } else { if (searchcacheName != "") { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=etd&sortindex=desc&searchcachename=" + searchcacheName); } else { if (searchJson.trim() != "") { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&search=" + escape(searchJson) + "&uid=" + commonGridObj_orderlist.newGuid() + "&sort=etd&sortindex=desc"); } else { commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=etd&sortindex=desc"); } } } if (searchcacheName != "") { commonGridObj_orderlist.setMultiple("&searchcachename=" + searchcacheName); } commonGridObj_orderlist.setSourceType("json"); commonGridObj_orderlist.setSkin("xp"); commonGridObj_orderlist.setImageUrl("../images/"); commonGridObj_orderlist.loadafter = true; commonGridObj_orderlist.after = function () { var url = "../UserSettings/UserGridSource/OrigOpSeaiLCLGrid.js?uid=" + newGuid(); var loader = dhtmlxAjax.getSync(url); var jsVal = loader.xmlDoc.responseText; var oHead = document.getElementsByTagName('head').item(0); var oScript = document.createElement("script"); oScript.language = "javascript"; oScript.type = "text/javascript"; oScript.id = "origopseailcl"; oScript.defer = true; oScript.text = jsVal; oHead.appendChild(oScript); // var arg = new Array(); if (newColSortArgs.length == colSortArgs_orderlist.length) { for (var i = 0; i < colSortArgs_orderlist.length; i++) { var oIndex = i; var nIndex = 0; var iCount = 0; if (colSortArgs_orderlist[i] != newColSortArgs[i]) { for (var k = 0; k < colSortArgs_orderlist.length; k++) { if (colSortArgs_orderlist[k] == newColSortArgs[i]) { nIndex = k; commonGridObj_orderlist.getGridObj().moveColumn(nIndex, oIndex); var title = headerArgs_orderlist[nIndex]; var width = widthArgs_orderlist[nIndex]; var sort = colSortArgs_orderlist[nIndex]; var colType = colTypeArgs_orderlist[nIndex]; var align = colAlignArgs_orderlist[nIndex]; //var index = i; headerArgs_orderlist[nIndex] = headerArgs_orderlist[oIndex]; widthArgs_orderlist[nIndex] = widthArgs_orderlist[oIndex]; colSortArgs_orderlist[nIndex] = colSortArgs_orderlist[oIndex]; colTypeArgs_orderlist[nIndex] = colTypeArgs_orderlist[oIndex]; colAlignArgs_orderlist[nIndex] = colAlignArgs_orderlist[oIndex]; headerArgs_orderlist[oIndex] = title; widthArgs_orderlist[oIndex] = width; colSortArgs_orderlist[oIndex] = sort; colTypeArgs_orderlist[oIndex] = colType; colAlignArgs_orderlist[oIndex] = align; commonGridObj_orderlist.getGridObj().moveColumn(oIndex + 1, nIndex + 1); var tempWidth = widthArgs_orderlist[nIndex]; commonGridObj_orderlist.getGridObj().setColWidth(nIndex, tempWidth); iCount++; break; } } } else { var tempWidth = newWidthArgs[i]; commonGridObj_orderlist.getGridObj().setColWidth(i, tempWidth); } } } finishLoading(); }; commonGridObj_orderlist.initGrid(); setTimeout(function() { initLoading(); commonGridObj_orderlist.bind(); }, 500); commonGridObj_orderlist.isSort = true; commonGridObj_orderlist.setSearch(searchJson); commonGridObj_orderlist.initPageByHandle("list"); commonGridObj_orderlist.isDBClickEvent = true; commonGridObj_orderlist.sortEventFun(); commonGridObj_orderlist.getGridObj().attachEvent("onRowDblClicked", function(rId, cInd) { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "../SeaiInfoLCL/SeaImportLCLEdit.aspx?handle=edit&id=" + rId; window.open(openUrl, openType, openSet); }); commonGridObj_orderlist.clickEvent = function() { commonGridObj_orderlist.getGridObj().attachEvent("onRowDblClicked", function(rId, cInd) { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "../SeaiInfoLCL/SeaImportLCLEdit.aspx?handle=edit&id=" + rId; window.open(openUrl, openType, openSet); }); } // commonGridObj_orderlist.sortEventFun = function() { // commonGridObj_orderlist.getGridObj().attachEvent("onBeforeSorting", function(ind, type, direction) { // if (type == "na" || type == "checkboxs") { // return false; // } else { // //alert(type);alert(direction);alert(ind); // commonGridObj_orderlist.setSortValue(type, direction); // commonGridObj_orderlist.getGridObj().clearAll(); // commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=" + type + "&sortindex=" + direction); // if (commonGridObj_orderlist.loadafter) { // commonGridObj_orderlist.loadafter = false; // commonGridObj_orderlist.after = function() { // } // } // commonGridObj_orderlist.bind(); // return true; // } // }); // } // commonGridObj_orderlist.getGridObj().attachEvent("onBeforeSorting", function(ind, type, direction) { // if (type == "na" || type == "checkboxs") { // return false; // } else { // //alert(type);alert(direction);alert(ind); // commonGridObj_orderlist.setSortValue(type, direction); // commonGridObj_orderlist.getGridObj().clearAll(); // commonGridObj_orderlist.setRequest("SeaImportLCLListGridSource.aspx?handle=list&show_page=15&cur_page=1&uid=" + commonGridObj_orderlist.newGuid() + "&sort=" + type + "&sortindex=" + direction); // if (commonGridObj_orderlist.loadafter) { // commonGridObj_orderlist.loadafter = false; // commonGridObj_orderlist.after = function() { // } // } // commonGridObj_orderlist.bind(); // return true; // } // }); } function initCombo() { CustomerCombo(); VesselCombo(); OperatorCombo(); } function CustomerCombo() { comboCustomer = new TCombo("sel_customer", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCONTROLLER", true, true, false, true, "h_customer"); comboCustomer.initComboEvent(); comboCustomer.bind(); } function VesselCombo() { comboVessel = new TCombo("sel_vessel", "../FeeCodes/TCodeVesselAdapter.aspx?mask=0&pos=0", true, false, false, true, "h_vessel"); comboVessel.initComboEvent(); comboVessel.bind(); } function OperatorCombo() { var strUserID = $("h_uid").value.trim(); comboOperator = new TCombo("sel_op", "../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isOperator&userID=" + strUserID, true, true, false, true, "h_operator"); comboOperator.initComboEvent(); comboOperator.bind(); } function initSearch() { $("h_customer").value = ""; comboCustomer.setText($("h_customer").value); $("h_vessel").value = ""; comboVessel.setText($("h_vessel").value); $("h_operator").value = ""; comboOperator.setText($("h_operator").value); $("txt_beginetd").value = ""; $("txt_endetd").value = ""; $("txt_no").value = ""; if ($("h_searchcache").value != "") { $("h_searchcache").value = ""; } createGrid(1); } function ShowDetailSelect() { createGrid(); } function GetRange() { var loader; var dates; var strR = ""; var getstrgid = commonGridObj_orderlist.getGridObj(); var strgid = getstrgid.getSelectedRowId(); if ($("hdRangeV").value != $("hdRangeO").value) { if ($("hdRangeO").value == "1") {//分公司 loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=1&strGID=" + strgid + "&RangeName=modSeaImportLCLList&val=" + newGuid()); //海运进口海运进口委托管理列表 dates = loader.xmlDoc.responseText; if (dates == "") { alert("您没有操作此数据的权限!"); return 0; } } if ($("hdRangeO").value == "2") {//分公司 loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=2&strGID=" + strgid + "&RangeName=modSeaImportLCLList&val=" + newGuid()); //海运进口委托管理列表 dates = loader.xmlDoc.responseText; if (dates == "") { alert("您没有操作此数据的权限!"); return 0; } } else if ($("hdRangeO").value == "3") {//个人 loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=3&strGID=" + strgid + "&RangeName=modSeaImportLCLList&val=" + newGuid()); //海运进口委托管理列表 dates = loader.xmlDoc.responseText; if (dates == "") { alert("您没有操作此数据的权限!"); return 0; } } } } function newGuid() { var guid = ""; for (var i = 1; i <= 32; i++) { var n = Math.floor(Math.random() * 16.0).toString(16); guid += n; if ((i == 8) || (i == 12) || (i == 16) || (i == 20)) guid += "-"; } return guid.toUpperCase(); } function deleteOrder() { var ii = GetRange(); if (ii == 0) { return; } // var orderGridObj = commonGridObj_orderlist.getGridObj(); var selRowID = orderGridObj.getCheckedRows(0); //所有选中的grid的id编号 //var selRowID = orderGridObj.getSelectedRowId(); var selGroup = new Array(); if (selRowID.indexOf(",") > 0) { selGroup = selRowID.split(","); } else { if (selRowID != null) { selGroup.push(selRowID); } } //查看是否有被选中的费用项 if (selGroup.length > 0) { if (selGroup.length > 1) { var delCount = 0; if (window.confirm("您确定删除已选中的委托信息")) { while (delCount < selGroup.length) { var rowIndex = orderGridObj.getRowIndex(selGroup[delCount]); var feeName = orderGridObj.cellByIndex(rowIndex, 1).getValue(); var cusName = orderGridObj.cellByIndex(rowIndex, 2).getValue(); var urlVal = "SeaImportLCLListGridSource.aspx?handle=delete&bsno=" + selGroup[delCount] + "&val=" + commonGridObj_orderlist.newGuid() + "&tbNO=" + escape($("txt_no").value) + "&VESSEL=" + escape($("h_vessel").value) + "&tbETD=" + $("txt_beginetd").value + "&tbETD2=" + $("txt_endetd").value + "&CUSTOMERNAME=" + escape($("h_customer").value) + "&ddlOP=" + escape($("h_op").value); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if (loadVal > 0) { //alert("删除成功"); } else { if (loadVal == -1 || loadVal == -2) { alert("删除失败!"); } if (loadVal == -3) { alert("当前业务为锁定状态,不允许删除此业务!"); //业务封帐 } // if (loadVal == -4) { // alert("您不是当前业务的操作,无删除此业务的权限!"); // } if (loadVal == -5) { alert("当前业务有与海运进口委托相关联的费用信息,不允许删除!"); } } delCount++; } createGrid(1); } } else { var delCount = 0; while (delCount < selGroup.length) { var rowIndex = orderGridObj.getRowIndex(selGroup[delCount]); var feeName = orderGridObj.cellByIndex(rowIndex, 1).getValue(); var cusName = orderGridObj.cellByIndex(rowIndex, 2).getValue(); if (window.confirm("您确定要将所选委托信息删除")) { var urlVal = "SeaImportLCLListGridSource.aspx?handle=delete&bsno=" + selGroup[delCount] + "&val=" + commonGridObj_orderlist.newGuid() + "&tbNO=" + escape($("txt_no").value) + "&VESSEL=" + escape($("h_vessel").value) + "&tbETD=" + $("txt_beginetd").value + "&tbETD2=" + $("txt_endetd").value + "&CUSTOMERNAME=" + escape($("h_customer").value) + "&ddlOP=" + escape($("h_op").value); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if (loadVal > 0) { //alert("删除成功"); createGrid(1); } else { if (loadVal == -1 || loadVal == -2) { alert("删除失败!"); } if (loadVal == -3) { alert("当前业务为锁定状态,不允许删除此业务!"); //业务封帐 } // if (loadVal == -4) { // alert("您不是当前业务的操作,无删除此业务的权限!"); // } if (loadVal == -5) { alert("当前业务有与海运进口委托相关联的费用信息,不允许删除!"); } } } delCount++; } } } else { alert("请选择您要删除的委托信息"); } } function refreshOrder() { window.location.href = window.location.href; } function addOrder() { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "../SeaiInfoLCL/SeaImportLCLEdit.aspx?handle=add"; window.open(openUrl, openType, openSet); } function addFullOrder() { var orderGridObj = commonGridObj_orderlist.getGridObj(); var selRowID = orderGridObj.getSelectedRowId(); if (selRowID == null || selRowID == "") { alert("请先选择要操作的数据!"); } else { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "../SeaiInfoLCL/SeaImportLCLEdit.aspx?handle=addfull&id=" + selRowID; var tempWin = window.open("about:blank", openType, openSet); tempWin.location = openUrl; } } //校验时间格式 function validateDateTime(dateTimeObj) { var isValid = false; var parseToObj = new Date(dateTimeObj.replace(/-/g, "/")); if (!isNaN(parseToObj)) { isValid = true; } return isValid; } function DateTimeEqual(beginObj, endObj) { var isEqual = 0; var begin = new Date(beginObj.replace(/-/g, "/")); var end = new Date(endObj.replace(/-/g, "/")); if (Date.parse(begin) - Date.parse(end) > 0) { isEqual = -1; //起始时间大于结束时间 } else if (Date.parse(begin) - Date.parse(end) == 0) { isEqual = -2; //起始时间与结束时间相等 } return isEqual; } //根据条件查询付费申请信息 function search() { createGrid(2); } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } function searchMultiple() { printMessageBox(event); } function editOpseai() { var selArg = new Array(); var iCount = 0; for (var i = 0; i < commonGridObj_orderlist.getGridObj().getRowsNum(); i++) { var checkState = commonGridObj_orderlist.getGridObj().cellByIndex(i, 0).getValue(); var rId = commonGridObj_orderlist.getGridObj().getRowId(i); if (checkState == 1) { iCount++; selArg.push(rId); } } if (iCount == 1) { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "../SeaiInfoLCL/SeaImportLCLEdit.aspx?handle=edit&id=" + selArg[0]; window.open(openUrl, openType, openSet); } else { alert("每次只能编辑一个海运进口委托信息"); } } function checkAll(id) { if ($(id).checked) { for (var i = 0; i < commonGridObj_orderlist.getGridObj().getRowsNum(); i++) { commonGridObj_orderlist.getGridObj().cellByIndex(i, 0).setValue(1); } } else { for (var i = 0; i < commonGridObj_orderlist.getGridObj().getRowsNum(); i++) { commonGridObj_orderlist.getGridObj().cellByIndex(i, 0).setValue(0); } } } function editGridSetting() { var openSet = "height=500, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = "../UserSettings/UserGridEdit.aspx?handle=usergrid&templatetype=opseailcl"; window.open(openUrl, openType, openSet); } var isIe = (document.all) ? true : false; //设置select的可见状态 function setSelectState(state) { var objl = document.getElementsByTagName('select'); for (var i = 0; i < objl.length; i++) { objl[i].style.visibility = state; } } function mousePosition(ev) { if (ev.pageX || ev.pageY) { return { x: ev.pageX, y: ev.pageY }; } return { x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, y: ev.clientY + document.body.scrollTop - document.body.clientTop }; } //弹出方法 function showMessageBox(wTitle, content, pos, wWidth) { closeWindow(); var bWidth = parseInt(document.documentElement.scrollWidth); var bHeight = parseInt(document.documentElement.scrollHeight); if (isIe) { setSelectState('hidden'); } var back = document.createElement("div"); back.id = "back"; var styleStr = "top:0px;left:0px;position:absolute;background:#666;width:" + bWidth + "px;height:" + bHeight + "px;"; styleStr += (isIe) ? "filter:alpha(opacity=0);" : "opacity:0;"; back.style.cssText = styleStr; document.body.appendChild(back); showBackground(back, 50); var mesW = document.createElement("div"); mesW.id = "mesWindow"; mesW.className = "mesWindow"; mesW.innerHTML = "
" + wTitle + " | " + " |