NewStudentEnter.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/NewStudentEnter/Edit";
  2. var mnu = "";
  3. //url个性化配置
  4. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='NewStudentEnterEdit']");
  5. if (customerUrl.attr("value")) {
  6. url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value");
  7. }
  8. //加载
  9. $(function () {
  10. mnu = $.SystemGeneral.getUrlParam("MNU");
  11. })
  12. //刷新
  13. function reload() {
  14. $("#dgNewStudentEnterList").cmsXDataTable("load", $.getDataGridParams("dgNewStudentEnterList"));
  15. }
  16. //获取选中的数据
  17. function validChoose() {
  18. var d = [];
  19. $.each($("#dgNewStudentEnterList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.NewStudentID);
  21. });
  22. return d;
  23. }
  24. //获取选中的状态
  25. function validChooseStatus() {
  26. var d = [];
  27. $.each($("#dgNewStudentEnterList").cmsXDataTable("getSelections"), function (index) {
  28. d.push(this.RecordStatus);
  29. });
  30. return d;
  31. }
  32. //查看
  33. function detail(rowindex, rowdata) {
  34. var redirectTo = url + "?newNewStudentID=" + rowdata.NewStudentID + "&MNU=" + mnu + "&type=detail";
  35. $.popupTopWindow('录取名单信息', redirectTo, 650, 550, null, null);
  36. }
  37. //新增
  38. function NewStudentEnter_Add() {
  39. var d = validChoose();
  40. if (d.length > 0) {
  41. $.popupTopWindow('录取名单复制新增', url + '?newNewStudentID=' + d[0] + '&MNU=' + mnu + '&type=copyAdd', 650, 550, null, null);
  42. } else {
  43. var redirectTo = url + "?MNU=" + mnu + "&type=add";
  44. $.popupTopWindow('录取名单新增', redirectTo, 650, 550, null, null);
  45. }
  46. }
  47. //修改
  48. function NewStudentEnter_Edit() {
  49. var d = validChoose();
  50. if (d == "") {
  51. $.messager.alert("系统提示", "请选择您要修改的信息。");
  52. return;
  53. }
  54. if (d.length > 1) {
  55. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  56. return;
  57. }
  58. var r = validChooseStatus();
  59. if (r[0] == submitted) {
  60. $.messager.alert("系统提示", "无法对已提交状态的信息进行修改。");
  61. return;
  62. }
  63. var redirectTo = url + "?newNewStudentID=" + d + "&MNU=" + mnu + "&type=edit";
  64. $.popupTopWindow('录取名单修改', redirectTo, 650, 550, null, null);
  65. }
  66. //批量修改
  67. SystemBatchModifyControl.OnSubmit = function () {
  68. var status = validChooseStatus().join(',');
  69. for (var i = 0; i < status.split(',').length; i++) {
  70. if (status.split(',')[i] == submitted) {
  71. $.messager.alert("系统提示", "无法对已提交状态的信息进行修改。");
  72. return false;
  73. }
  74. }
  75. }
  76. //删除
  77. function NewStudentEnter_Delete() {
  78. var d = validChoose().join(',');
  79. if (d == "") {
  80. $.messager.alert("系统提示", "请选择您要删除的信息。");
  81. return;
  82. }
  83. var r = validChooseStatus();
  84. if ($.grep(r, function (v, i) { return v == submitted; }).length > 0) {
  85. $.messager.alert("系统提示", "无法对已提交状态的信息进行删除。");
  86. return;
  87. }
  88. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  89. if (r) {
  90. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/Delete', { newStudentIDs: d }, function (data) {
  91. if (data.IsSuccess = true) {
  92. $.messager.alert("系统提示", data.Message);
  93. $("#dgNewStudentEnterList").cmsXDataTable('load');
  94. }
  95. else {
  96. $.messager.alert("系统提示", data.Message);
  97. }
  98. });
  99. }
  100. });
  101. }
  102. //删除照片
  103. function NewStudentEnter_PicDelete() {
  104. var d = validChoose().join(',');
  105. if (d == "") {
  106. $.messager.alert("系统提示", "请选择您要删除照片的信息。");
  107. return;
  108. }
  109. var r = validChooseStatus();
  110. if ($.grep(r, function (v, i) { return v == submitted; }).length > 0) {
  111. $.messager.alert("系统提示", "无法对已提交状态的信息进行删除照片。");
  112. return;
  113. }
  114. $.messager.confirm("系统提示", "您确定要删除选择的信息对应的照片?", function (r) {
  115. if (r) {
  116. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/PicDelete', { newStudentIDs: d }, function (data) {
  117. if (data.IsSuccess) {
  118. $.messager.alert("系统提示", data.Message);
  119. $("#dgNewStudentEnterList").cmsXDataTable('load');
  120. } else {
  121. $.messager.alert("系统提示", data.Message);
  122. }
  123. });
  124. }
  125. });
  126. }
  127. //取消分配(未分配)
  128. function NewStudentEnter_CancelAssignCollege() {
  129. var d = validChoose().join(',');
  130. if (d == "") {
  131. $.messager.alert("系统提示", "请选择您要取消分配的信息。");
  132. return;
  133. }
  134. $.messager.confirm("系统提示", "您确定要对选择的信息取消分配?", function (r) {
  135. if (r) {
  136. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/CancelAssignCollege', { newStudentIDs: d }, function (data) {
  137. if (data.IsSuccess = true) {
  138. $.messager.alert("系统提示", data.Message);
  139. $("#dgNewStudentEnterList").cmsXDataTable('load');
  140. }
  141. else {
  142. $.messager.alert("系统提示", data.Message);
  143. }
  144. });
  145. }
  146. });
  147. }
  148. //导入照片
  149. function NewStudentEnter_PicImport() {
  150. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/PicImport?MNU=' + mnu;
  151. $.popupTopWindow('导入照片', redirectTo, 420, 300, reload);
  152. }
  153. //导入标识
  154. function NewStudentEnter_DoubtImport() {
  155. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/DoubtImport?MNU=' + mnu;
  156. $.popupTopWindow('导入标识', redirectTo, 420, 300, reload);
  157. }
  158. //标识名单
  159. function NewStudentEnter_DoubtList() {
  160. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/NewStudentEnter/DoubtList" + "?MNU=" + mnu;;
  161. $.popupTopWindow('标识名单信息', redirectTo, 950, 540, reload);
  162. }
  163. //初始化(班级信息、学号)
  164. function NewStudentEnter_Init() {
  165. var d = validChoose().join(',');
  166. if (d == "") {
  167. $.messager.alert("系统提示", "请选择您要初始化的信息。");
  168. return;
  169. }
  170. $.messager.confirm("系统提示", "您确定要对选择的信息初始化?", function (r) {
  171. if (r) {
  172. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/Init', { newStudentIDs: d }, function (data) {
  173. if (data.IsSuccess = true) {
  174. $.messager.alert("系统提示", data.Message);
  175. $("#dgNewStudentEnterList").cmsXDataTable('load');
  176. }
  177. else {
  178. $.messager.alert("系统提示", data.Message);
  179. }
  180. });
  181. }
  182. });
  183. }
  184. //生成学号
  185. function NewStudentEnter_AssignClass() {
  186. var d = validChoose();
  187. if (d == "") {
  188. $.messager.alert("系统提示", "请选择您要生成学号的信息。");
  189. return;
  190. }
  191. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/NewStudentEnter/AssignClass?MNU=" + mnu;
  192. $.popupTopWindow('生成学号', redirectTo, 750, 325, reload, d);
  193. }
  194. //自动生成学号
  195. function NewStudentEnter_AutoAssignClass() {
  196. var d = validChoose().join(',');
  197. if (d == "") {
  198. $.messager.alert("系统提示", "请选择您要自动生成学号的信息。");
  199. return;
  200. }
  201. $.messager.confirm("系统提示", "您确定要对选择的信息自动生成学号?", function (r) {
  202. if (r) {
  203. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/AutoAssignClass', { newStudentIDs: d }, function (data) {
  204. if (data.IsSuccess = true) {
  205. $.messager.alert("系统提示", data.Message);
  206. $("#dgNewStudentEnterList").cmsXDataTable('load');
  207. }
  208. else {
  209. $.messager.alert("系统提示", data.Message);
  210. }
  211. });
  212. }
  213. });
  214. }
  215. //获取列表字段查询对应比较符
  216. function GetDynamicConditionString() {
  217. var conditionString = "";
  218. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  219. var condition = $("[name='Condition']").val();
  220. var value = $.trim($("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val());
  221. if (document.getElementsByName(attribute + "_QueryDictionaryDropDownList")[0] != null) {
  222. if (value == "-1") {
  223. conditionString = "";
  224. } else {
  225. conditionString = "WHERE " + attribute + "=" + value;
  226. }
  227. } else {
  228. if (value != "") {
  229. if (condition == "左") {
  230. conditionString = "WHERE " + attribute + " LIKE '" + value + "%'";
  231. } else if (condition == "右") {
  232. conditionString = "WHERE " + attribute + " LIKE '%" + value + "'";
  233. } else if (condition == "中") {
  234. conditionString = "WHERE " + attribute + " LIKE '%" + value + "%'";
  235. } else {
  236. conditionString = "WHERE " + attribute + condition + "'" + value + "'";
  237. }
  238. } else {
  239. conditionString = "";
  240. }
  241. }
  242. return conditionString;
  243. }
  244. //录取通知书打印
  245. function NewStudentEnter_AdmissionLetter() {
  246. var campusID = $("#CampusDropdown").combogridX("getValue");
  247. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  248. var gradeID = $("#DictionaryGrade").combogridX("getValue"); //combobox
  249. var standardID = $("#DictionaryStandard").combogridX("getValue");
  250. var educationID = $("#DictionaryEducation").combogridX("getValue");
  251. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  252. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  253. var grademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  254. var classmajorID = $("#ClassmajorComboGrid").combogridX("getValue");
  255. var isDoubt = $("#DictionaryGeneralPurpose").combobox("getValue");
  256. var isStudentNo = $("#DictionaryGeneralExist").combobox("getValue");
  257. var recordStatus = $("#DictionaryNewStudentEnterStatus").combobox("getValue");
  258. var newStudentIDs = validChoose().join(',');
  259. var conditionString = GetDynamicConditionString();
  260. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/AdmissionLetterReport?MNU=' + mnu;
  261. $.popupTopWindow('录取通知书打印', redirectTo, 720, 550, null, {
  262. CampusID: campusID,
  263. CollegeID: collegeID,
  264. GradeID: gradeID,
  265. StandardID: standardID,
  266. EducationID: educationID,
  267. LearningformID: learningformID,
  268. LearnSystem: learnSystem,
  269. GrademajorID: grademajorID,
  270. ClassmajorID: classmajorID,
  271. IsDoubt: isDoubt,
  272. IsStudentNo: isStudentNo,
  273. RecordStatus: recordStatus,
  274. NewStudentIDs: newStudentIDs,
  275. ConditionString: conditionString
  276. });
  277. }
  278. //提交
  279. function NewStudentEnter_Submit() {
  280. var d = validChoose().join(',');
  281. if (d == "") {
  282. $.messager.alert("系统提示", "请选择您要提交的信息。");
  283. return;
  284. }
  285. $.messager.confirm("系统提示", "您确定要提交选择的信息?", function (r) {
  286. if (r) {
  287. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudentEnter/Submit', { newStudentIDs: d }, function (data) {
  288. if (data.IsSuccess = true) {
  289. $.messager.alert("系统提示", data.Message);
  290. $("#dgNewStudentEnterList").cmsXDataTable('load');
  291. }
  292. else {
  293. $.messager.alert("系统提示", data.Message);
  294. }
  295. });
  296. }
  297. });
  298. }
  299. //设置列颜色为红色
  300. function SetRedColumn(index, row, value) {
  301. return " <span style=\"color: red;\">" + value + "</span>";
  302. }
  303. //设置相应的行字体颜色为红色
  304. function SetRowGrid(rowIndex, rowData) {
  305. if (rowData.IsDoubt == true) {
  306. return "color: red;";
  307. } else {
  308. return "";
  309. }
  310. }
  311. //设置相应的行背景颜色
  312. function SetRowBackgroundGrid(rowIndex, rowData) {
  313. if (rowData.IsDoubt == true) {
  314. return "background-color: yellow;";
  315. } else {
  316. return "";
  317. }
  318. }
  319. //Excel导出
  320. function NewStudentEnter_Export() {
  321. $("#formQuery").submit();
  322. }
  323. //联动查询
  324. function queryCampus(data) {
  325. var campusID = $("#CampusDropdown").combogridX("getValue");
  326. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  327. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  328. queryClass();
  329. }
  330. function queryCollege(data) {
  331. var campusID = $("#CampusDropdown").combogridX("getValue");
  332. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  333. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  334. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  335. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  336. queryClass();
  337. }
  338. function queryGrade(data) {
  339. queryClass();
  340. }
  341. function queryStandard(data) {
  342. queryClass();
  343. }
  344. function queryLearnSystem(data) {
  345. queryClass();
  346. }
  347. function queryGrademajor(data) {
  348. queryClass();
  349. }
  350. function queryClass() {
  351. var jsonString = "";
  352. var parameterString = "";
  353. var campusID = $("#CampusDropdown").combogridX("getValue");
  354. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  355. var gradeID = $("#DictionaryGrade").combogridX("getValue");
  356. var standardID = $("#DictionaryStandard").combogridX("getValue");
  357. var educationID = $("#DictionaryEducation").combogridX("getValue");
  358. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  359. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  360. //年级专业
  361. var grademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  362. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  363. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  364. if (gradeID != nonSelect) parameterString += "DictionaryGrade|*|" + gradeID + "|@|";
  365. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  366. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  367. if (learningformID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningformID + "|@|";
  368. if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
  369. //年级专业
  370. if (grademajorID != nonSelect) parameterString += "GrademajorComboGrid|*|" + grademajorID + "|@|";
  371. if (parameterString != "") {
  372. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  373. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  374. $("#ClassmajorComboGrid").combogridX("reload", eval(jsonString));
  375. }
  376. else {
  377. $("#GrademajorComboGrid").combogridX("reload");
  378. $("#ClassmajorComboGrid").combogridX("reload");
  379. }
  380. reload();
  381. }