educationSchool_info.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /**
  2. * 初始化子女就学详情对话框
  3. */
  4. var EducationSchoolInfoDlg = {
  5. educationSchoolInfoData : {},
  6. validateFields: {
  7. project: {validators: {notEmpty: {message: '申报项目不能为空'}}},
  8. pName: {validators: {notEmpty: {message: '申报人姓名不能为空'}}},
  9. pSex: {validators: {notEmpty: {message: '申报人性别不能为空'}}},
  10. pIdcard: {validators: {notEmpty: {message: '申报人证件号码不能为空'}}},
  11. talentArrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  12. certificateNo: {validators: {notEmpty: {message: '人才编号不能为空'}}},
  13. nativePlace: {validators: {notEmpty: {message: '籍贯不能为空'}}},
  14. housePlace: {validators: {notEmpty: {message: '户籍地址不能为空'}}},
  15. address: {validators: {notEmpty: {message: '现居地址不能为空'}}},
  16. enterpriseName:{validators: {notEmpty: {message: '工作单位不能为空'}}},
  17. enterpriseAddress:{validators: {notEmpty: {message: '工作单位详细地址不能为空'}}},
  18. phone: {
  19. validators: {
  20. notEmpty: {
  21. message: '联系电话不能为空'
  22. },
  23. regexp: {
  24. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  25. message: "手机号码格式不正确"
  26. }
  27. }
  28. },
  29. cName: {validators: {notEmpty: {message: '子女姓名不能为空'}}},
  30. cSex: {validators: {notEmpty: {message: '子女性别不能为空'}}},
  31. cIdcard: {validators: {notEmpty: {message: '子女证件号码不能为空'}}},
  32. cBirthday: {validators: {notEmpty: {message: '子女出生日期不能为空'}}},
  33. cRelation: {validators: {notEmpty: {message: '与申报人关系不能为空'}}},
  34. nowSchool: {validators: {notEmpty: {message: '现就读学校不能为空'}}},
  35. nowGrade: {validators: {notEmpty: {message: '现就读年级不能为空'}}},
  36. companyStreet: {validators: {notEmpty: {message: '工作单位所属镇街不能为空'}}},
  37. houseStreet: {validators: {notEmpty: {message: '房产所在镇街不能为空'}}},
  38. }
  39. };
  40. /**
  41. * 清除数据
  42. */
  43. EducationSchoolInfoDlg.clearData = function() {
  44. this.educationSchoolInfoData = {};
  45. }
  46. /**
  47. * 设置对话框中的数据
  48. *
  49. * @param key 数据的名称
  50. * @param val 数据的具体值
  51. */
  52. EducationSchoolInfoDlg.set = function(key, val) {
  53. this.educationSchoolInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  54. return this;
  55. }
  56. /**
  57. * 设置对话框中的数据
  58. *
  59. * @param key 数据的名称
  60. * @param val 数据的具体值
  61. */
  62. EducationSchoolInfoDlg.get = function(key) {
  63. return $("#" + key).val();
  64. }
  65. /**
  66. * 关闭此对话框
  67. */
  68. EducationSchoolInfoDlg.close = function() {
  69. parent.layer.close(window.parent.EducationSchool.layerIndex);
  70. }
  71. /**
  72. * 收集数据
  73. */
  74. EducationSchoolInfoDlg.collectData = function() {
  75. this
  76. .set('id')
  77. .set('year')
  78. .set('talentId')
  79. .set('personId')
  80. .set('type')
  81. .set('project')
  82. .set('pName')
  83. .set('pSex')
  84. .set('pIdcard')
  85. .set('enterpriseName')
  86. .set('enterpriseAddress')
  87. .set('talentArrange')
  88. .set('certificateNo')
  89. .set('certificateStartTime')
  90. .set('qzgccrcActiveTime')
  91. .set('nativePlace')
  92. .set('address')
  93. .set('phone')
  94. .set('cName')
  95. .set('cSex')
  96. .set('cIdcard')
  97. .set('cBirthday')
  98. .set('stuNumber')
  99. .set('cRelation')
  100. .set('nowSchool')
  101. .set('nowGrade')
  102. .set('applySchool')
  103. .set('companyStreet')
  104. .set('houseStreet')
  105. .set('checkState');
  106. }
  107. /**
  108. * 校验字段
  109. */
  110. EducationSchoolInfoDlg.validate = function(){
  111. $('#educationSchoolForm').data("bootstrapValidator").resetForm();
  112. $('#educationSchoolForm').bootstrapValidator('validate');
  113. return $("#educationSchoolForm").data('bootstrapValidator').isValid();
  114. }
  115. /**
  116. * 申报人变更
  117. * @param content
  118. */
  119. EducationSchoolInfoDlg.nameChange = function(content){
  120. var talentId = $(content).val();
  121. if(Feng.isEmptyStr(talentId)){
  122. $("#talentId,#pSex,#pIdcard,#talentArrange,#certificateNo,#nativePlace").val("");
  123. return ;
  124. }
  125. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/detail/"+talentId, function(data){
  126. $("#pName").val(data.name);
  127. $("#pSex").val(data.sex);
  128. $("#pIdcard").val(data.idCard);
  129. $("#talentArrange").val(data.talentArrange);
  130. $("#certificateNo").val(data.certificateNO);
  131. $("#nativePlace").val(data.provinceName+data.cityName+data.countyName);
  132. $("#address").val(data.streetName);
  133. $("#phone").val(data.phone);
  134. },function(data){
  135. Feng.error("查询失败!" + data.responseJSON.message + "!");
  136. });
  137. ajax.start();
  138. }
  139. /**
  140. * 项目选择变更
  141. * @param content
  142. */
  143. EducationSchoolInfoDlg.projectChange = function(content){
  144. var project = $(content).val();
  145. if(Feng.isEmptyStr(project)){
  146. $("#applySchool").val("").parent().css("display","none");
  147. }
  148. if(project == CONFIG.education_school){
  149. $("#applySchool").val("").parent().css("display","block");
  150. }
  151. if(project == CONFIG.education_score){
  152. $("#applySchool").val("").parent().css("display","none");
  153. }
  154. }
  155. /**
  156. * 提交添加
  157. */
  158. EducationSchoolInfoDlg.addSubmit = function() {
  159. this.clearData();
  160. this.collectData();
  161. if(!EducationSchoolInfoDlg.validate()){
  162. return ;
  163. }
  164. if(!validateIsEdit())return;
  165. var ajax = new $ax(Feng.ctxPath + "/person/education/apply", function(data){
  166. if(data.code == 200){
  167. Feng.success(data.msg);
  168. window.parent.EducationSchool.table.refresh();
  169. $("#fileLi").removeAttr("style");
  170. $("#id").val(data.obj.id);
  171. $("#checkState").val(data.obj.checkState);
  172. }else{
  173. Feng.info(data.msg);
  174. }
  175. },function(data){
  176. Feng.error("添加失败!" + data.responseJSON.message + "!");
  177. });
  178. ajax.set(this.educationSchoolInfoData);
  179. ajax.start();
  180. }
  181. /**
  182. * 提交审核
  183. */
  184. EducationSchoolInfoDlg.submitToCheck = function () {
  185. var id = $("#id").val();
  186. if(id==null || id==""){
  187. Feng.info("请先填写基础信息并上传附件");
  188. return ;
  189. }
  190. if(!validateIsEdit())return;
  191. var operation = function() {
  192. var ajax = new $ax(Feng.ctxPath + "/person/education/submitToCheck", function (data) {
  193. if(data.code==200){
  194. Feng.success(data.msg);
  195. // $("#checkState").val(data.obj);
  196. window.parent.EducationSchool.table.refresh();
  197. EducationSchoolInfoDlg.close();
  198. }else{
  199. Feng.error(data.msg);
  200. }
  201. }, function (data) {
  202. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  203. });
  204. ajax.set("id", id);
  205. ajax.start();
  206. }
  207. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  208. }
  209. /**
  210. * 校验是否可以操作
  211. */
  212. function validateIsEdit () {
  213. var checkState = $("#checkState").val();
  214. if(checkState == 1){
  215. Feng.error("您的申报正在审核中,无法操作");
  216. return false;
  217. }if(checkState == 3){
  218. Feng.error("您的申报已审核通过,无法操作");
  219. return false;
  220. }if(checkState == 9){
  221. Feng.error("您的申报正在审核中,无法操作");
  222. return false;
  223. }
  224. return true;
  225. }
  226. /**
  227. * 校验是否显示按钮
  228. * @param type 类型 1-上传按钮,2-修改删除按钮
  229. * @param row
  230. * @returns {string}
  231. */
  232. function validUploadButton(type,row,fileId){
  233. var checkState = $("#checkState").val();
  234. if(Feng.isEmptyStr(checkState)|| checkState ==-2 ||checkState==2){
  235. if(type == 1){ //上传
  236. return "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  237. "<i class=\"fa fa-upload\"></i>上传" +
  238. "</button>" ;
  239. }else{
  240. return "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  241. "<i class=\"fa fa-paste\"></i>修改" +
  242. "</button>" +
  243. "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_school+"')\" class=\"btn btn-xs btn-danger\">" +
  244. "<i class=\"fa fa-times\"></i>删除" +
  245. "</button>";
  246. }
  247. }else{
  248. return type == 1?"":"";
  249. }
  250. }
  251. $(function() {
  252. Feng.initValidatorTip("educationSchoolForm",EducationSchoolInfoDlg.validateFields);
  253. //批量加载字典表数据
  254. var arr = [
  255. {"name":"companyStreet","code":"street"},
  256. {"name":"houseStreet","code":"street"},
  257. {"name":"talentArrange","code":"talent_arrange"},
  258. {"name":"cRelation","code":"education_relation"},
  259. {"name":"nowGrade","code":"education_grade"},
  260. {"name":"project","code":"education_project"},
  261. {"name":"applySchool","code":"education_school_pool"}];
  262. Feng.findChildDictBatch(JSON.stringify(arr));
  263. //批量加载时间控件
  264. $(".date").each(function(){laydate.render({elem: ".date",type: "date",trigger: 'click'});});
  265. var type = $("#type").val();
  266. var talentArrange = $("#talentArrange").val();
  267. if(type == 2){
  268. $("#project").val(1).attr("style","pointer-events: none;background-color: #eee;").trigger("change");
  269. }
  270. if(talentArrange != 1 && talentArrange != 2 && talentArrange != 3){
  271. $("#project").val(1).attr("style","pointer-events: none;background-color: #eee;").trigger("change");
  272. }
  273. $("select").each(function () {
  274. if (Feng.isNotEmptyStr($(this).attr("value"))){
  275. $(this).val($(this).attr("value")).trigger("change");
  276. }
  277. });
  278. $("#applySchool").on('chosen:ready', function(e, params) {
  279. $(".chosen-container-single .chosen-single").css("padding","3px 0px 0px 2px");
  280. });
  281. $("#applySchool").chosen({
  282. search_contains:true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  283. disable_search: false,
  284. width:"100%",
  285. enable_split_word_search: true
  286. });
  287. var id = $("#id").val();
  288. if(Feng.isNotEmptyStr(id)){
  289. $("#fileLi").removeAttr("style");
  290. Feng.getCheckLog("logTable",{"type":CONFIG.project_school,"mainId":id,"typeFileId":"","active":1})
  291. }else{
  292. $("#fileLi").attr("style","pointer-events: none");
  293. }
  294. });