var url = CMS_SystemConfig.VirtualDirectoryPath + "/Staff/Edit"; var mnu = ""; //url个性化配置 var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='StaffEdit']"); if (customerUrl.attr("value")) { url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value"); } //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgStaffList").cmsXDataTable("load", $.getDataGridParams("dgStaffList")); } //获取选中的数据UserID function validChoose() { var d = []; $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) { d.push(this.UserID); }); return d; } //获取选中的数据LoginID function validChooseLoginID() { var d = []; $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) { d.push(this.StaffCode); }); return d; } //新增 function Staff_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('教师信息复制新增', url + '?newUserID=' + d[0] + '&MNU=' + mnu + '&type=copyAdd', 650, 540, null, null); } else { var redirectTo = url + "?MNU=" + mnu + "&type=add"; $.popupTopWindow('教师信息新增', redirectTo, 650, 540, null, null); } } //修改按钮 function Staff_Update() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?newUserID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('教师信息修改', redirectTo, 650, 540, null, null); } //明细查看 function edit(rowindex, rowdata) { var redirectTo = url + "?newUserID=" + rowdata.UserID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('教师信息明细', redirectTo, 650, 540, null, null); } //删除 function Staff_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Delete', { userIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgStaffList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //删除照片 function Staff_PicDelete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除照片的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息对应的照片?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Staff/PicDelete', { userIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgStaffList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //教师对应的角色信息明细 function editRoleCount(rowindex, rowdata) { redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Staff/RoleList?userID=" + rowdata.UserID + "&MNU=" + mnu; $.popupTopWindow('角色信息明细', redirectTo, 1024, 540, null, null); } //模拟登录 function Staff_SimulateLogin() { var d = validChooseLoginID(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要模拟登录的教师。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择一个教师进行模拟登录。"); return; } $.messager.confirm("系统提示", "您确定要进行模拟登录?", function (r) { if (r) { var loginID = d.toString(); $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SimulateLogin/Login', { LoginID: loginID }, function (data) { parent.location.reload(); }); } }); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //Excel导出 function Staff_Export() { $("#formQuery").submit(); } //导入照片 function Staff_PicImport() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Staff/PicImport?MNU=' + mnu; $.popupTopWindow('导入照片', redirectTo, 420, 300, reload); } //Excel导入 function Staff_Import() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Import?MNU=' + mnu; $.popupTopWindow('教师信息导入', redirectTo, 420, 300, reload); } //联动查询 function queryCampus(data) { var campusID = $("#CampusDropdown").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})"; $("#CollegeDropdown").combogridX("reload", eval(jsonString)); $("#DepartmentDropdown").combogridX("reload", eval(jsonString)); reload(); } function queryCollege(data) { var campusID = $("#CampusDropdown").combogridX("getValue"); var collegeID = $("#CollegeDropdown").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|"; jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentDropdown").combogridX("reload", eval(jsonString)); $("#CollegeDropdown").combogridX("reload", eval(jsonString)); reload(); }