NewStudentEdit.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //加载
  2. $(function () {
  3. //非负浮点数(/^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/)
  4. var reg = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/;
  5. var learnSystem = $("#LearnSystem").val();
  6. if (learnSystem == "" || learnSystem == null) {
  7. $("#LearnSystem").val("");
  8. }
  9. else {
  10. if (!reg.test(learnSystem)) {
  11. $("#LearnSystem").val("");
  12. }
  13. else {
  14. $("#LearnSystem").val(parseFloat(learnSystem).toFixed(1));
  15. }
  16. }
  17. var score = $("#Score").val();
  18. if (score == "" || score == null) {
  19. $("#Score").val("");
  20. }
  21. else {
  22. if (!reg.test(score)) {
  23. $("#Score").val("");
  24. }
  25. else {
  26. $("#Score").val(parseFloat(score).toFixed(1));
  27. }
  28. }
  29. $("#specialtyExpander").closest("tr")
  30. .next().css("display", "")
  31. .next().css("display", "")
  32. .next().css("display", "")
  33. .next().css("display", "");
  34. $("#specialtyExpander").attr("expanded", "1");
  35. $("#otherExpander").closest("tr")
  36. .next().css("display", "none")
  37. .next().css("display", "")
  38. .next().css("display", "none")
  39. .next().css("display", "none")
  40. .next().css("display", "")
  41. .next().css("display", "");
  42. $("#otherExpander").attr("expanded", "1");
  43. });
  44. //点击收缩(专业信息)
  45. function swapSpecialty() {
  46. if ($("#specialtyExpander").attr("expanded") == "1") {
  47. $("#specialtyExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  48. $("#specialtyExpander").closest("tr")
  49. .next().css("display", "")
  50. .next().css("display", "none")
  51. .next().css("display", "none")
  52. .next().css("display", "none");
  53. $("#specialtyExpander").attr("expanded", "0");
  54. } else {
  55. $("#specialtyExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  56. $("#specialtyExpander").closest("tr")
  57. .next().css("display", "")
  58. .next().css("display", "")
  59. .next().css("display", "")
  60. .next().css("display", "");
  61. $("#specialtyExpander").attr("expanded", "1");
  62. }
  63. }
  64. //点击收缩(其它信息)
  65. function swapOther() {
  66. if ($("#otherExpander").attr("expanded") == "1") {
  67. $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  68. $("#otherExpander").closest("tr")
  69. .next().css("display", "")
  70. .next().css("display", "")
  71. .next().css("display", "")
  72. .next().css("display", "")
  73. .next().css("display", "")
  74. .next().css("display", "");
  75. $("#otherExpander").attr("expanded", "0");
  76. } else {
  77. $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  78. $("#otherExpander").closest("tr")
  79. .next().css("display", "none")
  80. .next().css("display", "")
  81. .next().css("display", "none")
  82. .next().css("display", "none")
  83. .next().css("display", "")
  84. .next().css("display", "");
  85. $("#otherExpander").attr("expanded", "1");
  86. }
  87. }
  88. //保存
  89. function NewStudent_Save() {
  90. var certificatesType = $("#CertificatesType").combogridX("getValue");
  91. var iDNumber = $.trim($("#IDNumber").val());
  92. if (iDNumber != "") {
  93. if (certificatesType == "" || certificatesType == "-1" || certificatesType == null) {
  94. $.messager.alert("系统提示", "请选择对应的证件类型。");
  95. return;
  96. }
  97. }
  98. $(document.forms[0]).submit();
  99. }
  100. //删除照片(单个删除)
  101. function delPhoto() {
  102. var newStudentID = $("#NewStudentID").val();
  103. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/NewStudent/DeletePhoto', { newStudentID: newStudentID }, function (data) {
  104. if (data.IsSuccess) {
  105. $.messager.alert("系统提示", data.Message);
  106. $("#imgPhoto").attr('src', '');
  107. } else {
  108. $.messager.alert("系统提示", data.Message);
  109. }
  110. });
  111. }
  112. //联动
  113. function querySpecialty(data) {
  114. var specialtyID = $("#SpecialtyID").combogridX("getValue");
  115. if (specialtyID == "" || specialtyID == "-1" || specialtyID == null) {
  116. $("#Code").val("");
  117. $("#EducationID").combogridX("setValue", "-1");
  118. $("#LearningformID").combogridX("setValue", "-1");
  119. $("#LearnSystem").val("");
  120. }
  121. else {
  122. $("#Code").val(data.Code);
  123. $("#EducationID").combogridX("setValue", data.EducationID);
  124. $("#LearningformID").combogridX("setValue", data.LearningformID);
  125. $("#LearnSystem").val(data.LearnSystem);
  126. }
  127. }