You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Form.js 11 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-01-29 17:31
  5. * 描 述:教师信息管理
  6. */
  7. var acceptClick;
  8. var keyValue = request('keyValue');
  9. if (!!keyValue) {
  10. NewEmpId = keyValue;
  11. }
  12. var isTeacher = request('isTeacher');
  13. var bootstrap = function ($, learun) {
  14. "use strict";
  15. var ue;
  16. var page = {
  17. init: function () {
  18. $('.lr-form-wrap').lrscroll();
  19. page.bind();
  20. page.initData();
  21. page.hide();
  22. },
  23. hide: function () {
  24. if (isTeacher == "1") {
  25. $("#EmpNo").parent().hide();
  26. //$("#EmpName").parent().hide();
  27. $("#F_CompanyId").parent().hide();
  28. $("#F_DepartmentId").parent().hide();
  29. $("#SpellBrief").parent().hide();
  30. //$("#IdentityCardNo").parent().hide();
  31. $("#ProvinceNo").parent().hide();
  32. $("#CityNo").parent().hide();
  33. $("#RegionNo").parent().hide();
  34. $("#LocusOfArchives").parent().hide();
  35. $("#OverseasChineseNo").parent().hide();
  36. $("#HealthStatusNo").parent().hide();
  37. $("#CultureDegreeNo").parent().hide();
  38. //$("#DegreeNo").parent().hide();
  39. $("#FamilyOriginNo").parent().hide();
  40. $("#GraduateSchoolName").parent().hide();
  41. $("#SubjectSpeciesNo").parent().hide();
  42. $("#ForeignLanguageNo").parent().hide();
  43. $("#EmpSortNo").parent().hide();
  44. $("#EmpFullTimeNo").parent().hide();
  45. $("#DeptNo").parent().hide();
  46. $("#TitleOfTechPostNo").parent().hide();
  47. $("#InSchoolDate").parent().hide();
  48. $("#resume").parent().hide();
  49. //$("#Photo").parent().hide();
  50. }
  51. },
  52. bind: function () {
  53. //选项卡
  54. $("#PM_EducationExperience").attr("src", "/EducationalAdministration/PM_EducationExperience/Index?empId=" + NewEmpId);
  55. $("#PM_TechnicalPost").attr("src", "/EducationalAdministration/PM_TechnicalPost/Index?empId=" + NewEmpId);
  56. $("#PM_WorkerTechnology").attr("src", "/EducationalAdministration/PM_WorkerTechnology/Index?empId=" + NewEmpId);
  57. $("#PM_Resume").attr("src", "/EducationalAdministration/PM_Resume/Index?empId=" + NewEmpId);
  58. $("#PM_FamilySituation").attr("src", "/EducationalAdministration/PM_FamilySituation/Index?empId=" + NewEmpId);
  59. $('#lr_form_tabs').lrFormTab();
  60. $('#lr_form_tabs ul li').eq(0).trigger('click');
  61. //校区
  62. $('#F_CompanyId').lrDataSourceSelect({
  63. code: 'company', value: 'f_companyid', text: 'f_fullname',
  64. select: function (item) {
  65. if (!!item) {
  66. // 部门
  67. $('#F_DepartmentId').lrselectRefresh({
  68. type: 'tree',
  69. // 是否允许搜索
  70. allowSearch: true,
  71. // 访问数据接口地址
  72. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
  73. // 访问数据接口参数
  74. param: { companyId: item.f_companyid, parentId: '0' }
  75. });
  76. }
  77. }
  78. });
  79. $('#F_DepartmentId').lrselect();
  80. $('#GenderNo').lrDataItemSelect({ code: 'usersexbit' });
  81. $('#IsHasLesson').lrDataItemSelect({ code: 'YesOrNoBit' });
  82. $('#NationalityNo').lrDataSourceSelect({ code: 'BCdNationality', value: 'nationalityno', text: 'nationality' });
  83. $('#PartyFaceNo').lrDataSourceSelect({ code: 'BCdPartyFace', value: 'partyfaceno', text: 'partyface' });
  84. $('#ProvinceNo').lrDataSourceSelect({
  85. code: 'DIC_PROVINCE', value: 'pcode', text: 'pname',
  86. select: function (item) {
  87. if (!!item) {
  88. $('#CityNo').lrselectRefresh({
  89. url: "/DIC_CITY/GetListByProvinceCode",
  90. param: { ProvinceCode: item.pcode },
  91. value: 'CCODE',
  92. text: 'CNAME'
  93. });
  94. $('#RegionNo').lrselectRefresh({
  95. url: "",
  96. data: []
  97. });
  98. }
  99. }
  100. });
  101. $('#CityNo').lrselect({
  102. select: function (item) {
  103. if (!!item) {
  104. $('#RegionNo').lrselectRefresh({
  105. url: top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode",
  106. param: { cityCode: item.CCODE },
  107. value: 'ACODE',
  108. text: 'ANAME'
  109. });
  110. }
  111. }
  112. });
  113. $('#RegionNo').lrselect();
  114. $('#OverseasChineseNo').lrDataSourceSelect({ code: 'BCdOverseasChinese', value: 'overseaschineseno', text: 'overseaschinesename' });
  115. $('#HealthStatusNo').lrDataSourceSelect({ code: 'BCdHealthStatus', value: 'healthstatusno', text: 'healthstatus' });
  116. $('#CultureDegreeNo').lrDataSourceSelect({ code: 'BCdCultureDegree', value: 'culturedegreeno', text: 'culturedegree' });
  117. $('#DegreeNo').lrDataSourceSelect({ code: 'BCdDegree', value: 'degreeno', text: 'degreename' });
  118. $('#FamilyOriginNo').lrDataSourceSelect({ code: 'BCdFamilyOrigin', value: 'familyoriginno', text: 'familyorigin' });
  119. $('#SubjectSpeciesNo').lrDataSourceSelect({ code: 'BCdSubjectSpecies', value: 'subjectspeciesno', text: 'subjectspecies' });
  120. $('#ForeignLanguageNo').lrDataSourceSelect({ code: 'BCdForeignLanguage', value: 'foreignlanguageno', text: 'foreignlanguagename' });
  121. $('#EmpSortNo').lrDataItemSelect({ code: 'jsgw' });
  122. $('#EmpFullTimeNo').lrDataItemSelect({ code: 'EmpFullTime' });
  123. $('#ObtainWay').lrDataItemSelect({ code: 'ObtainWay' });
  124. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  125. $('#PostRank').lrDataSourceSelect({ code: 'BCdTitleOfTechPost', value: 'titleoftechpostno', text: 'titleoftechpost' });
  126. $('#Photo').lrUploader();
  127. $('#HighestRecord').lrDataSourceSelect({ code: 'BCdCultureDegree', value: 'culturedegreeno', text: 'culturedegree' });
  128. $('#ObtainWayOfHighestRecord').lrDataItemSelect({ code: 'ObtainWay' });
  129. $('#InitialDegree').lrDataSourceSelect({ code: 'BCdDegree', value: 'degreeno', text: 'degreename' });
  130. $('#ObtainWayOfInitialDegree').lrDataItemSelect({ code: 'ObtainWayOfDegree' });
  131. $('#ObtainWayOfHighestDegree').lrDataItemSelect({ code: 'ObtainWayOfDegree' });
  132. $('#PositionLevel').lrDataItemSelect({ code: 'PositionLevel' });
  133. $('#JobRank').lrDataItemSelect({ code: 'TechnicalPost' });
  134. $('#WorkLevel').lrDataItemSelect({ code: 'TechnicalLevelOfWorker' });
  135. $('#CompilationCategory').lrDataItemSelect({ code: 'CompilationCategory' });
  136. $('#IsInActiveStatus').lrDataItemSelect({ code: 'JobStatus' });
  137. //内容编辑器
  138. ue = UE.getEditor('editor');
  139. //监听身份证号,绑定出生日期
  140. $("#IdentityCardNo").blur(function () {
  141. var cardNo = $(this).val().trim();
  142. if (cardNo) {
  143. var date = cardNo.slice(6, 10) + "-" + cardNo.slice(10, 12) + "-" + cardNo.slice(12, 14);
  144. $("#Birthday").val(date);
  145. }
  146. });
  147. },
  148. initData: function () {
  149. if (!!keyValue) {
  150. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/EmpInfo/GetFormData?keyValue=' + keyValue, function (data) {
  151. for (var id in data) {
  152. if (!!data[id].length && data[id].length > 0) {
  153. $('#' + id).jfGridSet('refreshdata', data[id]);
  154. }
  155. else {
  156. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  157. }
  158. ue.ready(function () {
  159. ue.setContent(data[id].resume);
  160. });
  161. }
  162. $("#EmpNo").attr("disabled", "disabled");
  163. });
  164. }
  165. }
  166. };
  167. // 保存数据
  168. acceptClick = function (callBack) {
  169. if (!$('body').lrValidform()) {
  170. return false;
  171. }
  172. var postData = $('body').lrGetFormData();
  173. postData["resume"] = ue.getContent(null, null, true);
  174. postData["EmpId"] = NewEmpId;
  175. var postDatas = {
  176. strEntity: JSON.stringify(postData)
  177. };
  178. //姓名重复提示
  179. var EmpName = $('#EmpName').val();
  180. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/EmpInfo/GetEmpInfoEntitiesByEmpName?empName=' + EmpName, function (data) {
  181. if (!!data.length && data.length > 0) {
  182. var num = data.length;
  183. if (!!keyValue) {
  184. for (var i = 0; i < data.length; i++) {
  185. if (data[i].EmpId == keyValue) {
  186. num = num - 1;
  187. break;
  188. }
  189. }
  190. }
  191. if (num > 0) {
  192. learun.layerConfirm('系统中姓名为' + EmpName + '的教师已经有' + num + '名,是否确认保存?', function (res) {
  193. if (res) {
  194. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/EmpInfo/SaveForm?keyValue=' + keyValue, postDatas, function (res) {
  195. // 保存成功后才回调
  196. if (!!callBack) {
  197. callBack();
  198. }
  199. });
  200. }
  201. });
  202. return;
  203. }
  204. }
  205. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/EmpInfo/SaveForm?keyValue=' + keyValue, postDatas, function (res) {
  206. // 保存成功后才回调
  207. if (!!callBack) {
  208. callBack();
  209. }
  210. });
  211. });
  212. };
  213. page.init();
  214. }