Student.js 16 KB

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