educationSchool_info.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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|16|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('housePlace')
  93. .set('address')
  94. .set('phone')
  95. .set('cName')
  96. .set('cSex')
  97. .set('cIdcard')
  98. .set('cBirthday')
  99. .set('stuNumber')
  100. .set('cRelation')
  101. .set('nowSchool')
  102. .set('nowGrade')
  103. .set('applySchool')
  104. .set('companyStreet')
  105. .set('houseStreet')
  106. .set('checkState');
  107. }
  108. /**
  109. * 校验字段
  110. */
  111. EducationSchoolInfoDlg.validate = function(){
  112. $('#educationSchoolForm').data("bootstrapValidator").resetForm();
  113. $('#educationSchoolForm').bootstrapValidator('validate');
  114. return $("#educationSchoolForm").data('bootstrapValidator').isValid();
  115. }
  116. /**
  117. * 申报人变更
  118. * @param content
  119. */
  120. EducationSchoolInfoDlg.nameChange = function(content){
  121. var talentId = $(content).val();
  122. if(Feng.isEmptyStr(talentId)){
  123. $("#talentId,#pSex,#pIdcard,#talentArrange,#certificateNo,#nativePlace").val("");
  124. return ;
  125. }
  126. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/detail/"+talentId, function(data){
  127. $("#pName").val(data.name);
  128. $("#pSex").val(data.sex);
  129. $("#pIdcard").val(data.idCard);
  130. $("#talentArrange").val(data.talentArrange);
  131. $("#certificateNo").val(data.certificateNO);
  132. $("#nativePlace").val(data.provinceName+data.cityName+data.countyName);
  133. $("#address").val(data.streetName);
  134. $("#phone").val(data.phone);
  135. },function(data){
  136. Feng.error("查询失败!" + data.responseJSON.message + "!");
  137. });
  138. ajax.start();
  139. }
  140. /**
  141. * 项目选择变更
  142. * @param content
  143. */
  144. EducationSchoolInfoDlg.projectChange = function(content){
  145. var project = $(content).val();
  146. if(Feng.isEmptyStr(project)){
  147. $("#applySchool").val("").parent().css("display","none");
  148. }
  149. if(project == CONFIG.education_school){
  150. $("#applySchool").val("").parent().css("display","block");
  151. }
  152. if(project == CONFIG.education_score){
  153. $("#applySchool").val("").parent().css("display","none");
  154. }
  155. }
  156. /**
  157. * 提交添加
  158. */
  159. EducationSchoolInfoDlg.addSubmit = function() {
  160. this.clearData();
  161. this.collectData();
  162. if(!EducationSchoolInfoDlg.validate()){
  163. return ;
  164. }
  165. if(!validateIsEdit())return;
  166. var ajax = new $ax(Feng.ctxPath + "/person/education/apply", function(data){
  167. if(data.code == 200){
  168. Feng.success(data.msg);
  169. window.parent.EducationSchool.table.refresh();
  170. $("#fileLi").removeAttr("style");
  171. $("#id").val(data.obj.id);
  172. $("#checkState").val(data.obj.checkState);
  173. }else{
  174. Feng.info(data.msg);
  175. }
  176. },function(data){
  177. Feng.error("添加失败!" + data.responseJSON.message + "!");
  178. });
  179. ajax.set(this.educationSchoolInfoData);
  180. ajax.start();
  181. }
  182. /**
  183. * 提交审核
  184. */
  185. EducationSchoolInfoDlg.submitToCheck = function () {
  186. var id = $("#id").val();
  187. if(id==null || id==""){
  188. Feng.info("请先填写基础信息并上传附件");
  189. return ;
  190. }
  191. if(!validateIsEdit())return;
  192. var operation = function() {
  193. var ajax = new $ax(Feng.ctxPath + "/person/education/submitToCheck", function (data) {
  194. if(data.code==200){
  195. Feng.success(data.msg);
  196. // $("#checkState").val(data.obj);
  197. window.parent.EducationSchool.table.refresh();
  198. EducationSchoolInfoDlg.close();
  199. }else{
  200. Feng.error(data.msg);
  201. }
  202. }, function (data) {
  203. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  204. });
  205. ajax.set("id", id);
  206. ajax.start();
  207. }
  208. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  209. }
  210. /**
  211. * 校验是否可以操作
  212. */
  213. function validateIsEdit () {
  214. var checkState = $("#checkState").val();
  215. if(checkState == 1){
  216. Feng.error("您的申报正在审核中,无法操作");
  217. return false;
  218. }if(checkState == 3){
  219. Feng.error("您的申报已审核通过,无法操作");
  220. return false;
  221. }if(checkState == 9){
  222. Feng.error("您的申报正在审核中,无法操作");
  223. return false;
  224. }
  225. return true;
  226. }
  227. /**
  228. * 校验是否显示按钮
  229. * @param type 类型 1-上传按钮,2-修改删除按钮
  230. * @param row
  231. * @returns {string}
  232. */
  233. function validUploadButton(type,row,fileId){
  234. var checkState = $("#checkState").val();
  235. if(Feng.isEmptyStr(checkState)|| checkState ==-2 ||checkState==2){
  236. if(type == 1){ //上传
  237. return "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  238. "<i class=\"fa fa-upload\"></i>上传" +
  239. "</button>" ;
  240. }else{
  241. return "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  242. "<i class=\"fa fa-paste\"></i>修改" +
  243. "</button>" +
  244. "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_school+"')\" class=\"btn btn-xs btn-danger\">" +
  245. "<i class=\"fa fa-times\"></i>删除" +
  246. "</button>";
  247. }
  248. }else{
  249. return type == 1?"":"";
  250. }
  251. }
  252. $(function() {
  253. Feng.initValidatorTip("educationSchoolForm",EducationSchoolInfoDlg.validateFields);
  254. //批量加载字典表数据
  255. var arr = [
  256. {"name":"companyStreet","code":"street"},
  257. {"name":"houseStreet","code":"street"},
  258. {"name":"talentArrange","code":"talent_arrange"},
  259. {"name":"cRelation","code":"education_relation"},
  260. {"name":"nowGrade","code":"education_grade"},
  261. {"name":"project","code":"education_project"},
  262. {"name":"applySchool","code":"education_school_pool"}];
  263. Feng.findChildDictBatch(JSON.stringify(arr));
  264. //批量加载时间控件
  265. $(".date").each(function(){laydate.render({elem: ".date",type: "date",trigger: 'click'});});
  266. var type = $("#type").val();
  267. var talentArrange = $("#talentArrange").val();
  268. if(type == 2){
  269. $("#project").val(1).attr("style","pointer-events: none;background-color: #eee;").trigger("change");
  270. }
  271. if(talentArrange != 1 && talentArrange != 2 && talentArrange != 3){
  272. $("#project").val(1).attr("style","pointer-events: none;background-color: #eee;").trigger("change");
  273. }
  274. $("select").each(function () {
  275. if (Feng.isNotEmptyStr($(this).attr("value"))){
  276. $(this).val($(this).attr("value")).trigger("change");
  277. }
  278. });
  279. $("#applySchool").on('chosen:ready', function(e, params) {
  280. $(".chosen-container-single .chosen-single").css("padding","3px 0px 0px 2px");
  281. });
  282. $("#applySchool").chosen({
  283. search_contains:true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  284. disable_search: false,
  285. width:"100%",
  286. enable_split_word_search: true
  287. });
  288. var id = $("#id").val();
  289. if(Feng.isNotEmptyStr(id)){
  290. $("#fileLi").removeAttr("style");
  291. Feng.getCheckLog("logTable",{"type":CONFIG.project_school,"mainId":id,"typeFileId":"","active":1})
  292. }else{
  293. $("#fileLi").attr("style","pointer-events: none");
  294. }
  295. });