Student.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Students/Edit";
  2. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='StudentEdit']");
  3. if (customerUrl.attr("value")) {
  4. url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value");
  5. }
  6. var bathval = "";
  7. var mnu;
  8. var WindowID;
  9. $(function () {
  10. mnu = $.SystemGeneral.getUrlParam("MNU");
  11. WindowID = $.SystemGeneral.getUrlParam("WindowID");
  12. });
  13. function User_Export() {
  14. $('#loading').show();
  15. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/Students/Excel");
  16. $(document.forms[0]).submit();
  17. $('#loading').hide();
  18. }
  19. function Student_InfoExport() {
  20. var selectedIDs = validChoose().join(',');
  21. selectedIDs = selectedIDs.toString();
  22. var StudentSelect = $.getDataGridParams("dgStudentList");
  23. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/InfoExport?MNU=' + mnu + '&selectedIDs=' + selectedIDs;
  24. $.popupTopWindow('上报导出', redirectTo, 900, 600, null, StudentSelect);
  25. }
  26. function QueryPhotoUrltmentDropdownList(data) {
  27. reload();
  28. }
  29. function QuerygraduationtmentDropdownList(date) {
  30. reload();
  31. }
  32. //新增
  33. function Student_Add() {
  34. var d = validChoose();
  35. if (d.length > 1) {
  36. $.messager.alert("系统提示", "只能选择单个记录进行复制新增。");
  37. return;
  38. }
  39. var redirectTo = url + '?MNU=' + mnu;
  40. if (d.length != 0) {
  41. redirectTo = url + '?userIds=' + d + '&type=copyAdd' + '&MNU=' + mnu;
  42. $.popupTopWindow('学生信息复制新增', redirectTo, 700, 550, null, null);
  43. }
  44. else {
  45. $.popupTopWindow('学生信息新增', redirectTo, 700, 550, null, null);
  46. }
  47. }
  48. //修改按钮
  49. function Student_Update() {
  50. var d = validChoose();
  51. if (d.length == 0) {
  52. $.messager.alert("系统提示", "请选择您要修改的学生信息。");
  53. return;
  54. }
  55. if (d.length > 1) {
  56. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  57. return;
  58. }
  59. var redirectTo = url + '?userIds=' + d + '&type=copyEdit' + '&MNU=' + mnu;
  60. $.popupTopWindow('学生信息修改', redirectTo, 700, 500, null, null);
  61. }
  62. //获取选中的数据
  63. function validChoose() {
  64. var d = [];
  65. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  66. d.push(this.UserID);
  67. });
  68. return d;
  69. }
  70. function validChooseLoginID() {
  71. var d = [];
  72. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  73. d.push(this.LoginID);
  74. });
  75. return d;
  76. }
  77. //点击列表更新
  78. function edit(rowindex, rowdata) {
  79. var redirectTo = url + '?userIds=' + rowdata.UserID + '&type=copyEdit' + '&isView=1&MNU=' + mnu;
  80. $.popupTopWindow('学生信息', redirectTo, 700, 500, null, null);
  81. }
  82. //删除
  83. function Student_Delete() {
  84. var d = validChoose().join(',');
  85. if (d == "") {
  86. $.messager.alert("系统提示", "请选择您要删除的学生信息。");
  87. return;
  88. }
  89. $.messager.confirm("系统提示", "您确定要删除该学生信息?", function (r) {
  90. if (r) {
  91. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Students/Delete', { userIDs: d }, function (data) {
  92. if (data == "删除成功!") {
  93. $.messager.alert("系统提示", data);
  94. reload();
  95. } else {
  96. $.messager.alert("系统提示", data);
  97. }
  98. });
  99. }
  100. });
  101. }
  102. //导出Excel
  103. function Student_Export() {
  104. var d = validChoose().join(',')
  105. if (d != "") {
  106. document.getElementById("UserIDs").value = d;
  107. }
  108. else {
  109. document.getElementById("UserIDs").value = "";
  110. }
  111. $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/Students/Excel");
  112. $("#formQuery").submit();
  113. }
  114. function Student_Import() {
  115. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/Import?MNU=' + mnu;
  116. $.popupTopWindow('导入学生', redirectTo, 400, 300, null, null);
  117. }
  118. function Student_PicImport() {
  119. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/PicImport?MNU=' + mnu;
  120. $.popupTopWindow('导入照片', redirectTo, 400, 300, null, null);
  121. }
  122. function Student_GraduatePicImport() {
  123. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/GraduatePicImport?MNU=' + mnu;
  124. $.popupTopWindow('导入毕业相片', redirectTo, 400, 300, null, null);
  125. }
  126. //获取列表字段查询对应比较符
  127. function GetDynamicCondition() {
  128. var reg = "/(^/s*)|(/s*$)/g";
  129. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  130. var conditionString = $("[name='Condition']").val();
  131. var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val();
  132. value = $.trim(value);
  133. var sql = "";
  134. if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") {
  135. sql = attribute + conditionString + value;
  136. } else if (conditionString == "左") {
  137. sql = attribute + " like '" + value + "%'";
  138. } else if (conditionString == "右") {
  139. sql = attribute + " like '%" + value + "'";
  140. } else if (conditionString == "中") {
  141. sql = attribute + " like '%" + value + "%'";
  142. }
  143. return sql;
  144. }
  145. function Student_Report() {
  146. var d = [];
  147. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  148. d.push(this.LoginID);
  149. });
  150. var s = [];
  151. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  152. s.push(this.UserID);
  153. });
  154. var sql = GetDynamicCondition();
  155. var attribute = document.getElementsByName("Attribute")[0].value.split("\"Value\":\"")[1].split("\"")[0]; //获取自定义查询的当前字段
  156. var campusID = $("#CampusDropdown").combogridX("getValue");
  157. var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue");
  158. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  159. var standardID = $("#StandardDictionaryDropDown").combogridX("getValue");
  160. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  161. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  162. var inSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
  163. var isGraduation = $("#GeneralPurposeDictionaryDropDown").combobox("getValue");
  164. var isPhotos = $("#YesOrNoStatusDictionaryDropDown").combobox("getValue");
  165. var reportStatusID = $("#ReportStatusDictionaryDropDown").combobox("getValue");
  166. var education = $("#DictionaryEducation").combobox("getValue");
  167. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  168. var loginID = d;
  169. var conditionString = sql;
  170. var condition = document.getElementsByName("Condition")[0].value;
  171. var value = (document.getElementsByName(attribute + "_QueryTextBox")[0] != null ? document.getElementsByName(attribute + "_QueryTextBox")[0].value : document.getElementsByName(attribute + "_QueryDictionaryDropDownList")[0].value)
  172. var ids = s.join(',');
  173. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/ClassStudentReport?MNU=' + mnu;
  174. var StudentCardName = $(CMS_SystemConfig.GetConfig()).find("configuration>reportServer>customReportName[name='StudentCardView']").attr("customName");
  175. if (StudentCardName == "HBGDStudentCardView") {
  176. $.popupTopWindow('学生信息报表', redirectTo, 700, 550, null, {
  177. Attribute: attribute,
  178. CampusID: campusID,
  179. SchoolYearID: schoolYearID,
  180. CollegeID: collegeID,
  181. StandardID: standardID,
  182. LearningFormID: learningFormID,
  183. ClassmajorID: classmajorID,
  184. InSchoolStatus: inSchoolStatus,
  185. IsGraduation: isGraduation,
  186. IsPhotos: isPhotos,
  187. LoginID: loginID,
  188. ConditionString: conditionString,
  189. Condition: condition,
  190. Value: value,
  191. ReportStatusID: reportStatusID,
  192. Education: education,
  193. LearnSystem:learnSystem,
  194. Ids: ids
  195. });
  196. } else {
  197. $.popupTopWindow('学生信息报表', redirectTo, 1100, 550, null, {
  198. Attribute: attribute,
  199. CampusID: campusID,
  200. SchoolYearID: schoolYearID,
  201. CollegeID: collegeID,
  202. StandardID: standardID,
  203. LearningFormID: learningFormID,
  204. ClassmajorID: classmajorID,
  205. InSchoolStatus: inSchoolStatus,
  206. IsGraduation: isGraduation,
  207. IsPhotos: isPhotos,
  208. LoginID: loginID,
  209. ConditionString: conditionString,
  210. Condition: condition,
  211. Value: value,
  212. ReportStatusID: reportStatusID,
  213. Education: education,
  214. Ids: ids
  215. });
  216. }
  217. }
  218. function reload() {
  219. $("#dgStudentList").cmsXDataTable("load", $.getDataGridParams("dgStudentList"));
  220. }
  221. function queryCollege(data) {
  222. // var campusID = $("#CampusDropdown").combogridX("getValue");
  223. // var collegeID = $("#CollegeDropdown").combogridX("getValue");
  224. // var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  225. // jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  226. // $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  227. // $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
  228. // if (campusID != nonSelect) {
  229. // var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  230. // $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  231. // }
  232. queryClass();
  233. reload();
  234. }
  235. function queryStandard(data) {
  236. queryClass();
  237. }
  238. function queryClass() {
  239. var jsonString = "";
  240. var parameterString = "";
  241. var campusID = $("#CampusDropdown").combogridX("getValue");
  242. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  243. var educationID = $("#DictionaryEducation").combobox("getValue");
  244. var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue");
  245. var standardID = $("#StandardDictionaryDropDown").combogridX("getValue");
  246. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  247. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  248. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  249. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  250. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  251. if (schoolYearID != nonSelect) parameterString += "DictionarySchoolyear|*|" + schoolYearID + "|@|";
  252. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  253. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  254. if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|";
  255. if (parameterString != "") {
  256. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  257. $("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
  258. $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
  259. } else {
  260. $("#ClassmajorDropdown").combogridX("reload");
  261. $("#StandardDictionaryDropDown").combogridX("reload");
  262. }
  263. reload();
  264. }
  265. function Student_ExportPicture() {
  266. var selectedIDs = validChoose().join(',');
  267. $("[name='SelectedIDs']").val(validChoose().join(','));
  268. //selectedIDs = selectedIDs.toString();
  269. $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/Students/ExportPictures");
  270. $("#formQuery").submit();
  271. //var StudentSelect = $.getDataGridParams("dgStudentList");
  272. //var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Students/ExportPictures?selectedIDs=" + selectedIDs + "&MNU=" + mnu;
  273. //$.popupTopWindow('照片命名方式', redirectTo, 400, 200, null, StudentSelect);
  274. }
  275. function Student_SimulateLogin() {
  276. var d = validChooseLoginID();
  277. if (d.length == 0) {
  278. $.messager.alert("系统提示", "请选择您要登录的学生。");
  279. return;
  280. }
  281. if (d.length > 1) {
  282. $.messager.alert("系统提示", "只能选择一个学生进行登录。");
  283. return;
  284. }
  285. $.messager.confirm("系统提示", "您确定要进行模拟登录?", function (r) {
  286. if (r) {
  287. var loginID = d.toString();
  288. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SimulateLogin/Login', { LoginID: loginID }, function (data) {
  289. parent.location.reload();
  290. });
  291. }
  292. });
  293. }
  294. function Student_ProofReport() {
  295. var d = [];
  296. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  297. d.push(this.LoginID);
  298. });
  299. var s = [];
  300. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  301. s.push(this.UserID);
  302. });
  303. var sql = GetDynamicCondition();
  304. var attribute = document.getElementsByName("Attribute")[0].value.split("\"Value\":\"")[1].split("\"")[0]; //获取自定义查询的当前字段
  305. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Students/StudentProofReport?MNU=' + mnu;
  306. var campusID = $("#CampusDropdown").combogridX("getValue");
  307. var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue");
  308. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  309. var standardID = $("#StandardDictionaryDropDown").combogridX("getValue");
  310. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  311. var education = $("#DictionaryEducation").combobox("getValue");
  312. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  313. var inSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
  314. var isGraduation = $("#GeneralPurposeDictionaryDropDown").combobox("getValue");
  315. var isPhotos = $("#YesOrNoStatusDictionaryDropDown").combobox("getValue");
  316. var reportStatusID = $("#ReportStatusDictionaryDropDown").combobox("getValue");
  317. var loginID = d;
  318. var conditionString = sql;
  319. var condition = document.getElementsByName("Condition")[0].value;
  320. var value = (document.getElementsByName(attribute + "_QueryTextBox")[0] != null ? document.getElementsByName(attribute + "_QueryTextBox")[0].value : document.getElementsByName(attribute + "_QueryDictionaryDropDownList")[0].value)
  321. var ids = s.join(',');
  322. $.popupTopWindow('学生证明报表', redirectTo, 700, 550, null, {
  323. Attribute: attribute,
  324. CampusID: campusID,
  325. SchoolYearID: schoolYearID,
  326. CollegeID: collegeID,
  327. StandardID: standardID,
  328. LearningFormID: learningFormID,
  329. ClassmajorID: classmajorID,
  330. InSchoolStatus: inSchoolStatus,
  331. IsGraduation: isGraduation,
  332. IsPhotos: isPhotos,
  333. LoginID: loginID,
  334. ConditionString: conditionString,
  335. Condition: condition,
  336. Value: value,
  337. ReportStatusID: reportStatusID,
  338. Ids: ids
  339. });
  340. }
  341. function Student_Synch() {
  342. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Students/Synchr?MNU=" + mnu;
  343. $.popupTopWindow('学生信息同步', redirectTo, 700, 250, Student_SynchCallback);
  344. }
  345. function Student_SynchCallback(isSuccess) {
  346. if (isSuccess) {
  347. reload();
  348. }
  349. }