var url = CMS_SystemConfig.VirtualDirectoryPath + "/Buildings/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgBuildingsList").cmsXDataTable("load", $.getDataGridParams("dgBuildingsList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgBuildingsList").cmsXDataTable("getSelections"), function (index) { d.push(this.BuildingsInfoID); }); return d; } //新增 function Buildings_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('建筑信息复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/Buildings/CopyAdd?buildingsInfoID=' + d[0] + '&MNU=' + mnu, 650, 400, null, null); } else { var redirectTo = url + "?MNU=" + mnu; $.popupTopWindow('建筑信息新增', redirectTo, 650, 400, null, null); } } //修改按钮 function Buildings_Update() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?buildingsInfoID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('建筑信息修改', redirectTo, 650, 400, null, null); } //查看 function edit(rowindex, rowdata) { var redirectTo = url + "?buildingsInfoID=" + rowdata.BuildingsInfoID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('建筑信息', redirectTo, 650, 400, null, null); } //删除 function Buildings_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Buildings/Delete', { buildingsInfoIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgBuildingsList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //教室明细(对应建筑信息) function editClassroomCount(rowindex, rowdata) { redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Buildings/ClassroomList?buildingsInfoID=" + rowdata.BuildingsInfoID + "&MNU=" + mnu; $.popupTopWindow('建筑信息教室明细', redirectTo, 1080, 530, null, null); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //设置相应的行颜色为红色 function SetRedGrid(rowIndex, rowData) { if (rowData.IsSpecial != true) { return "color: red;"; } else { return ""; } } //Excel导出 function Buildings_Export() { $("#formQuery").submit(); } //Excel导入 function Buildings_Import() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Buildings/Import?MNU=' + mnu; $.popupTopWindow('建筑信息导入', redirectTo, 420, 300, reload); } //联动查询 function queryCampus() { reload(); }