$(function(){setContextBox();datagrid_selector.datagrid({onSelect:onSelect})});function onSelect(b,a){$("#addressm").val(a.address);$("#lnglat").val(a.gcjlng+","+a.gcjlat);geoCode()}function setContextBox(){var a=$(window).height();var b=a-80;$(".datagrid-div").css("height",b+"px");$(".easyui-panel").panel("resize")}function insertRecord(){operation="insert.do";$("#saveRecord").linkbutton({disabled:false});_myPage.prototype.reSetToComboxItem(vLibcode);openWin();if($("#addressm").val().length==0){openMessageDlg("请在地图上选中一个坐标,才能新增流通点地图");return}setValue("address",$("#addressm").val());var a=$("#lnglat").val();if(a.indexOf(",")>-1){setValue("gcjlng",a.split(",")[0]);setValue("gcjlat",a.split(",")[1])}cancelCodeDisabled();getNextOrderCode()}function saveRecord(){var a=getJsonData(null,"record");if(!a){openMessageDlg("记录异常");return}if(verifyRequiredFields()){openMessageDlg("必填字段不能为空!");return}a.loccode=getTreeChecked();if(a.loccode){if(a.loccode.split(",").length>20){openMessageDlg("馆藏地点最多只能选择20条!");return}}else{openMessageDlg("请选择馆藏地点!");return}a.codetype="1";var b=controller_url+operation;$.post(b,a,function(c){openMessageDlg(c.message);if(c.status=="0"){closeWin();loadGridData(c)}},"json")}function updateRecord(e,c){if(!c){c=getRow()}if(isHigherLibcode(c.libcode)){$("#saveRecord").linkbutton({disabled:true});_myPage.prototype.reSetToComboxItem()}else{$("#saveRecord").linkbutton({disabled:false});_myPage.prototype.reSetToComboxItem(vLibcode)}operation="update.do";var b=getRowPK();if(!b){return}openWin();var a=controller_url+"get.do";var d={pk:b};$.post(a,d,function(g){var f=g.rows[0];setTreeChecked(f.loccode+",");setJsonData(null,f);setCodeDisabled()},"json")};