new_nofile_talentInfo_info.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var TalentInfoInfoDlg = {
  6. talentInfoInfoData: {},
  7. validateFields: {
  8. source_county: {validators: {notEmpty: {message: '入选来源县市区不能为空'}}},
  9. talent_type: {validators: {notEmpty: {message: '人才类型不能为空'}}},
  10. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  11. card_type: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  12. card_number: {
  13. validators: {
  14. notEmpty: {message: '证件号码不能为空'},
  15. regexp: {
  16. regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  17. message: "身份证号码格式不正确"
  18. }
  19. }
  20. },
  21. sex: {validators: {notEmpty: {message: '性别不能为空'}}},
  22. birthday: {validators: {notEmpty: {message: '出生日期不能为空'}}},
  23. nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
  24. province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
  25. city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
  26. nation: {validators: {notEmpty: {message: '民族不能为空'}}},
  27. politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
  28. experience: {validators: {notEmpty: {message: '工作简历不能为空'}}},
  29. education: {validators: {notEmpty: {message: '教育背景不能为空'}}},
  30. apply_year: {validators: {notEmpty: {message: '申报年度不能为空'}}},
  31. import_way: {validators: {notEmpty: {message: '引进方式不能为空'}}},
  32. cur_entry_time: {validators: {notEmpty: {message: '本单位入职时间不能为空'}}},
  33. position: {validators: {notEmpty: {message: '本单位现任职务不能为空'}}},
  34. source: {validators: {notEmpty: {message: '申报来源不能为空'}}},
  35. talent_arrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  36. talent_condition: {validators: {notEmpty: {message: '认定条件不能为空'}}},
  37. highest_degree: {validators: {notEmpty: {message: '最高学历不能为空'}}},
  38. graduate_school: {validators: {notEmpty: {message: '毕业院校不能为空'}}},
  39. major: {validators: {notEmpty: {message: '专业不能为空'}}},
  40. bank: {
  41. validators: {
  42. notEmpty: {
  43. message: '开户银行不能为空'
  44. },
  45. regexp: {
  46. regexp: /^[\u4e00-\u9fa5]*银行$/,
  47. message: "开户银行格式不正确"
  48. }
  49. }
  50. },
  51. bank_number: {
  52. validators: {
  53. notEmpty: {
  54. message: '银行行号不能为空'
  55. },
  56. regexp: {
  57. regexp: /^\d+$/,
  58. message: "银行行号格式不正确"
  59. }
  60. }
  61. },
  62. bank_branch_name: {
  63. validators: {
  64. notEmpty: {
  65. message: '开户银行网点不能为空'
  66. },
  67. regexp: {
  68. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  69. message: "开户银行格式不正确"
  70. }
  71. }
  72. },
  73. bank_account: {
  74. validators: {
  75. notEmpty: {
  76. message: '银行账号不能为空'
  77. },
  78. regexp: {
  79. regexp: /^\d+$/,
  80. message: "银行账号格式不正确"
  81. }
  82. }
  83. },
  84. phone: {
  85. validators: {
  86. notEmpty: {
  87. message: '手机号码不能为空'
  88. },
  89. regexp: {
  90. regexp: /0?(13|14|15|16|17|18|19)[0-9]{9}/,
  91. message: "手机号码格式不正确"
  92. }
  93. }
  94. },
  95. email: {
  96. validators: {
  97. notEmpty: {
  98. message: '电子邮箱不能为空'
  99. },
  100. emailAddress: {
  101. message: "电子邮箱格式不正确"
  102. }
  103. }
  104. }
  105. }
  106. };
  107. /**
  108. * 清除数据
  109. */
  110. TalentInfoInfoDlg.clearData = function () {
  111. this.talentInfoInfoData = {};
  112. }
  113. /**
  114. * 设置对话框中的数据
  115. *
  116. * @param key 数据的名称
  117. * @param val 数据的具体值
  118. */
  119. TalentInfoInfoDlg.set = function (key, val) {
  120. var dis = $("#" + key).attr("disabled");
  121. if (dis == "disabled") {
  122. $("#" + key).removeAttr("disabled");
  123. }
  124. this.talentInfoInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  125. if (dis == "disabled") {
  126. $("#" + key).prop("disabled", true);
  127. }
  128. return this;
  129. }
  130. /**
  131. * 设置对话框中的数据
  132. *
  133. * @param key 数据的名称
  134. * @param val 数据的具体值
  135. */
  136. TalentInfoInfoDlg.get = function (key) {
  137. return $("#" + key).val();
  138. }
  139. /**
  140. * 关闭此对话框
  141. */
  142. TalentInfoInfoDlg.close = function () {
  143. parent.layer.close(window.parent.TalentInfo.layerIndex);
  144. }
  145. /**
  146. * 收集数据
  147. */
  148. TalentInfoInfoDlg.collectData = function () {
  149. this
  150. .set('id')
  151. .set('type')
  152. .set('talent_type')
  153. .set('tax_insurance_month')
  154. .set('labor_contract_rangetime')
  155. .set('pre_import_type')
  156. .set('salary_pay_way')
  157. .set('salary_pay_month')
  158. .set('enterprise_id')
  159. .set('name')
  160. .set('photo')
  161. .set('card_type')
  162. .set('card_number')
  163. .set('sex')
  164. .set('birthday')
  165. .set('nationality')
  166. .set('province')
  167. .set('city')
  168. .set('county')
  169. .set('nation')
  170. .set('politics')
  171. .set('talent_arrange')
  172. .set('talent_condition')
  173. .set('highest_degree')
  174. .set('graduate_school')
  175. .set('major')
  176. .set('professional')
  177. .set('bank')
  178. .set('bank_number')
  179. .set('bank_branch_name')
  180. .set('bank_account')
  181. .set('study_abroad')
  182. .set('abroad_school')
  183. .set('abroad_major')
  184. .set('phone')
  185. .set('email')
  186. .set('apply_year')
  187. .set('import_way')
  188. .set('fst_work_time')
  189. .set('cur_entry_time')
  190. .set('position')
  191. .set('source')
  192. .set('fujian_highcert_pubtime')
  193. .set('fujian_highcert_exptime')
  194. .set('quanzhou_highcert_pubtime')
  195. .set('quanzhou_highcert_exptime');
  196. if ($("#province").val() != null && $("#province").val() != '') {
  197. this.talentInfoInfoData["province_name"] = $("#province").find("option:selected").text();
  198. }
  199. if ($("#city").val() != null && $("#city").val() != '') {
  200. this.talentInfoInfoData["city_name"] = $("#city").find("option:selected").text();
  201. }
  202. if ($("#county").val() != null && $("#county").val() != '') {
  203. this.talentInfoInfoData["county_name"] = $("#county").find("option:selected").text();
  204. }
  205. if ($("#source_city").val() != null && $("#source_city").val() != '') {
  206. this.talentInfoInfoData["source_city_name"] = $("#source_city").find("option:selected").text();
  207. }
  208. if ($("#source_county").val() != null && $("#source_county").val() != '') {
  209. this.talentInfoInfoData["source_county_name"] = $("#source_county").find("option:selected").text();
  210. }
  211. }
  212. /**
  213. * 验证数据
  214. */
  215. TalentInfoInfoDlg.validate = function () {
  216. $('#talentInfoForm').data("bootstrapValidator").resetForm();
  217. $('#talentInfoForm').bootstrapValidator('validate');
  218. return $("#talentInfoForm").data('bootstrapValidator').isValid();
  219. }
  220. /**
  221. * 提交添加
  222. */
  223. TalentInfoInfoDlg.addSubmit = function () {
  224. this.clearData();
  225. this.collectData();
  226. /*if (!TalentInfoInfoDlg.validate()) {
  227. return;
  228. }*/
  229. var id = $('#id').val();
  230. if (id != null && id != '') {
  231. if (!TalentInfoInfoDlg.validateIsEdit())
  232. return;
  233. }
  234. $("select").each(function () {
  235. $(this).removeAttr("disabled");
  236. });
  237. if (locked) {
  238. return;
  239. }
  240. locked = true;
  241. $("#talentInfoForm").attr("action", "/enterprise/talent/apply");
  242. $("#talentInfoForm")[0].submit();
  243. }
  244. //回调
  245. TalentInfoInfoDlg.infoCallback = function (data) {
  246. locked = false;
  247. TalentInfoInfoDlg.setNoChangeField();
  248. Feng.info(data.msg);
  249. if (data.code == 200) {
  250. window.parent.TalentInfo.table.refresh();
  251. $("#id").val(data.obj.id);
  252. $("#fileLi").removeAttr("style");
  253. $("#checkState").val(data.obj.checkState);
  254. }
  255. return;
  256. }
  257. TalentInfoInfoDlg.getLayerCatdByLayer = function () {
  258. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  259. $("#talent_condition").html("<option>---请选择---</option>");
  260. $("#annual_salary").parents("td").css("display", "none");
  261. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  262. var level = $("#talent_arrange").val();
  263. Feng.addAjaxSelect({
  264. "id": "talent_arrange_category",
  265. "displayCode": "code",
  266. "displayName": "name",
  267. "type": "GET",
  268. "url": Feng.ctxPath + "/common/api/getLayerCatsByLayer/level/" + level
  269. });
  270. $("#talent_condition").trigger("chosen:updated");
  271. }
  272. /**
  273. * 获取人才认定
  274. */
  275. TalentInfoInfoDlg.getIdentifyCondition = function () {
  276. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  277. $("#annual_salary").parents("td").css("display", "none");
  278. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  279. var level = $("#talent_arrange").val();
  280. var cat = $("#talent_arrange_category").val();
  281. var id = $('#id').val();
  282. Feng.addAjaxSelect({
  283. "id": "talent_condition",
  284. "displayCode": "id",
  285. "displayName": "name",
  286. "type": "GET",
  287. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel/level/" + level + "/cat/" + cat + "/id/" + id
  288. });
  289. $("#talent_condition").trigger('chosen:updated');
  290. }
  291. TalentInfoInfoDlg.getIdentifyNeedsFileTypes = function () {
  292. $("#annual_salary").parents("td").css("display", "none");
  293. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  294. var source = $("#source").val();
  295. if (source == "" || typeof source == "undefined") {
  296. layer.alert("请先选择申报来源");
  297. $("#talent_condition").val("");
  298. $("#talent_condition").trigger('chosen:updated');
  299. return;
  300. }
  301. TalentInfoInfoDlg.ajaxGetConditionFile(source);
  302. }
  303. TalentInfoInfoDlg.ajaxGetConditionFile = function (source) {
  304. var condition = $("#talent_condition option:selected").val();
  305. if (condition != "") {
  306. var ajax = new $ax("/common/api/getTalentCondtionUploadFile", function (data) {
  307. if (data == null || data.length == 0) {
  308. return;
  309. }
  310. if (typeof data.info != "undefined" && data.info.isSalary == 1) {
  311. $("#annual_salary").parents("td").css("display", "table-cell");
  312. $('#talentInfoForm').bootstrapValidator('addField', "annual_salary", {validators: {
  313. notEmpty: {message: '年薪不能放空'},
  314. callback: {
  315. message: "年薪只能填写数字",
  316. callback: function (value, validator) {
  317. if (!isNaN(value) && isFinite(value)) {
  318. return true;
  319. }
  320. return false;
  321. }
  322. }
  323. }
  324. });
  325. }
  326. if (source != "5") {
  327. return;
  328. }
  329. }, function (data) {
  330. Feng.error("查询失败!" + data.responseJSON.message + "!");
  331. });
  332. var queryData = {};
  333. queryData["mainId"] = $("#id").val();
  334. queryData['project'] = CONFIG.project_rcrd;
  335. queryData["source"] = source;
  336. queryData['type'] = $("#type").val();
  337. queryData["talent_condition"] = condition;
  338. ajax.set(queryData);
  339. ajax.start();
  340. }
  341. }
  342. TalentInfoInfoDlg.bankChange = function () {
  343. var bank = $("#bank").val();
  344. if ($.trim(bank) == '中国工商银行') {
  345. $("#bank_number").val('102391050013');
  346. } else {
  347. $("#bank_number").val('');
  348. }
  349. }
  350. TalentInfoInfoDlg.changeStudyAbroad = function () {
  351. var is_abroad = $("#study_abroad").val();
  352. if (is_abroad == 1) {
  353. $(".abroad_need_this").css("display", "table-row");
  354. $('#talentInfoForm').bootstrapValidator('addField', "abroad_school", {validators: {notEmpty: {message: '留学毕业院校不能为空'}}});
  355. $('#talentInfoForm').bootstrapValidator('addField', "abroad_major", {validators: {notEmpty: {message: '留学专业不能为空'}}});
  356. } else {
  357. $(".abroad_need_this").css("display", "none");
  358. $("#abroad_school").val("");
  359. $("#abroad_major").val("");
  360. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_school");
  361. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_major");
  362. }
  363. }
  364. /**
  365. * 加载市
  366. */
  367. TalentInfoInfoDlg.afterSelectProvince = function () {
  368. var province = $("#province").val();
  369. $("#city").empty();
  370. $("#county").empty();
  371. if (province == null || province == '') {
  372. return;
  373. }
  374. Feng.addAjaxSelect({
  375. "id": "city",
  376. "displayCode": "code",
  377. "displayName": "name",
  378. "type": "GET",
  379. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  380. });
  381. }
  382. /**
  383. * 加载县
  384. */
  385. TalentInfoInfoDlg.afterSelectCity = function () {
  386. var city = $("#city").val();
  387. $("#county").empty();
  388. if (city == null || city == '') {
  389. return;
  390. }
  391. Feng.addAjaxSelect({
  392. "id": "county",
  393. "displayCode": "code",
  394. "displayName": "name",
  395. "type": "GET",
  396. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  397. });
  398. }
  399. TalentInfoInfoDlg.isAgeChecked = false;
  400. TalentInfoInfoDlg.birthdayChange = function () {
  401. let birthday = parseInt($("#birthday").val().substring(0, 4));
  402. let currentYear = parseInt(new Date().getFullYear());
  403. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  404. let option = $("[data-rel=birthday]");
  405. let limitAge = option.data("option");
  406. if (age >= limitAge) {
  407. option.css("display", "table-row");
  408. option.next("tr.detail-view").css("display", "table-row");
  409. if (!TalentInfoInfoDlg.isAgeChecked) {
  410. layer.alert("由于您的年龄大于70岁(含),要求提供人社局的允许申报的批文,请线下前往人社局办理。如已办理,请将该批文作为附件上传至对应附件栏中。");
  411. TalentInfoInfoDlg.isAgeChecked = true;
  412. return false;
  413. }
  414. } else {
  415. TalentInfoInfoDlg.isAgeChecked = false;
  416. option.css("display", "none");
  417. option.next("tr.detail-view").css("display", "none");
  418. }
  419. return true;
  420. }
  421. TalentInfoInfoDlg.initBirthday = function () {
  422. let birthday = parseInt($("#birthday").val().substring(0, 4));
  423. let currentYear = parseInt(new Date().getFullYear());
  424. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  425. let option = $("[data-rel=birthday]");
  426. let isFileExists = option.next("tr.detail-view").find("ul.imgs").find("li").length > 3 ? true : false;
  427. let limitAge = option.data("option");
  428. if (!isNaN(birthday)) {
  429. if (age >= limitAge && isFileExists) {
  430. TalentInfoInfoDlg.isAgeChecked = true;
  431. }
  432. TalentInfoInfoDlg.birthdayChange();
  433. }
  434. }
  435. TalentInfoInfoDlg.talentTypeChange = function () {
  436. var talent_type = $("#talent_type").val();
  437. //$("#tax_insurance_month").val("").parent().css("display", "none");
  438. //$("#labor_contract_rangetime").val("").parent().css("display", "none");
  439. $(".talentType1-2").css("display", "none");
  440. $(".talentType3").css("display", "none");
  441. var text = "";
  442. switch (talent_type) {
  443. case "1":
  444. TalentInfoInfoDlg.talentTypeOneTwo = true;
  445. $("#tipsBlock").css('display', 'block');
  446. $("#typeTips").html("含经晋江市认定且还在晋江市就业创业的人才,或在晋江市就业创业但未曾申报过晋江市现代产业体系人才的人才。");
  447. //$("#desc_talent_type").html("请上传社会保险或个人所得税缴费佐证材料");
  448. $(".talentType1-2").css("display", "table-cell");
  449. $("#talentType_first").css('display', "none");
  450. $('#talentInfoForm').bootstrapValidator('addField', "tax_insurance_month", {
  451. validators: {
  452. notEmpty: {message: '在我市缴交社会保险或个人所得税月份不能为空'}
  453. }
  454. });
  455. $('#talentInfoForm').bootstrapValidator('addField', "labor_contract_rangetime", {validators: {notEmpty: {message: '劳动合同起止时间'}}});
  456. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_way", {validators: {notEmpty: {message: '请选择工资发放渠道'}}});
  457. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_month", {validators: {notEmpty: {message: '请选择工资发放月份'}}});
  458. if (TalentInfoInfoDlg.talentTypeFlag) {
  459. TalentInfoInfoDlg.talentTypeFlag = false;
  460. $('#talentInfoForm').bootstrapValidator('removeField', "pre_import_type");
  461. }
  462. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/首次/, "近三年") : "";
  463. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'table-cell') : "";
  464. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'table-cell') : "";
  465. break;
  466. case "2":
  467. TalentInfoInfoDlg.talentTypeOneTwo = true;
  468. $("#tipsBlock").css('display', 'block');
  469. $("#typeTips").html("含本办法出台后首次从晋江市以外引进认定的人才,或者流出晋江市满3年后又返回晋江市就业创业(不含企业集团内部人员调动)的人才。")
  470. //$("#desc_talent_type").html("请上传社会保险或个人所得税缴费佐证材料与来我市前工作情况证明,例如原工作单位出具的工作证明、离职证明或原创(领)办企业的营业执照复印件、经市场监管部门备案的公司章程复印件等证明材料");
  471. $(".talentType1-2").css("display", "table-cell");
  472. $("#talentType_first").css('display', "inline");
  473. $('#talentInfoForm').bootstrapValidator('addField', "tax_insurance_month", {
  474. validators: {
  475. notEmpty: {message: '在我市缴交社会保险或个人所得税月份不能为空'}
  476. }
  477. });
  478. $('#talentInfoForm').bootstrapValidator('addField', "labor_contract_rangetime", {validators: {notEmpty: {message: '劳动合同起止时间'}}});
  479. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_way", {validators: {notEmpty: {message: '请选择工资发放渠道'}}});
  480. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_month", {validators: {notEmpty: {message: '请选择工资发放月份'}}});
  481. if (TalentInfoInfoDlg.talentTypeFlag) {
  482. TalentInfoInfoDlg.talentTypeFlag = false;
  483. $('#talentInfoForm').bootstrapValidator('removeField', "pre_import_type");
  484. }
  485. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  486. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'table-cell') : "";
  487. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'none') : "";
  488. break;
  489. case "3":
  490. TalentInfoInfoDlg.talentTypeFlag = true;
  491. $("#tipsBlock").css('display', 'block');
  492. $("#typeTips").html("含已经与晋江市用人单位达成就业意向且签订预引进意向合作协议(合同)的人才,或拟来我市创业且提交企业名称预先核准的人才。")
  493. //$("#desc_talent_type").html("请先提供意向合作协议(合同)或企业名称预先核准材料,落地我市后再补齐上述材料");
  494. $(".talentType3").css("display", "table-cell");
  495. $("#talentType_first").css('display', "none");
  496. $('#talentInfoForm').bootstrapValidator('addField', "pre_import_type", {validators: {notEmpty: {message: '请选择预引进类型'}}});
  497. if (TalentInfoInfoDlg.talentTypeOneTwo) {
  498. TalentInfoInfoDlg.talentTypeOneTwo = false;
  499. $('#talentInfoForm').bootstrapValidator('removeField', "labor_contract_rangetime");
  500. $('#talentInfoForm').bootstrapValidator('removeField', "tax_insurance_month");
  501. $('#talentInfoForm').bootstrapValidator('removeField', "salary_pay_way");
  502. $('#talentInfoForm').bootstrapValidator('removeField', "salary_pay_month");
  503. }
  504. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  505. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'none') : "";
  506. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'none') : "";
  507. break;
  508. default:
  509. $("#tipsBlock").css('display', 'none');
  510. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  511. break;
  512. }
  513. $("#fst_work_time").prev("label").html(text);
  514. for (var i = 0; i < $("[data-rel=talent_type]").length; i++) {
  515. let option = $("[data-rel=talent_type]").eq(i);
  516. let options = option.data("option").toString().split(",");
  517. if (options.indexOf(talent_type) > -1) {
  518. option.css("display", "table-row");
  519. option.next("tr.detail-view").css("display", "table-row");
  520. } else {
  521. option.css("display", "none");
  522. option.next("tr.detail-view").css("display", "none");
  523. }
  524. }
  525. }
  526. TalentInfoInfoDlg.sourceChange = function () {
  527. var source = $("#source").val();
  528. $("#source_batch").val("").parents("td").css("display", "none");
  529. $(".fujian_highcert").css("display", "none");
  530. $(".quanzhou_highcert").css("display", "none");
  531. $("#source_city").val("").parents("td").css("display", "none");
  532. $("#source_county").val("").parents("td").css("display", "none");
  533. $('#talentInfoForm').bootstrapValidator('removeField', "source_batch");
  534. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_pubtime");
  535. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_exptime");
  536. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_pubtime");
  537. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_exptime");
  538. $('#talentInfoForm').bootstrapValidator('removeField', "source_city");
  539. $('#talentInfoForm').bootstrapValidator('removeField', "source_county");
  540. switch (source) {
  541. case "1":
  542. case "3":
  543. $("#source_batch").parents("td").css("display", "table-cell");
  544. $(".fujian_highcert").css("display", "table-cell");
  545. $("#quanzhou_highcert_pubtime").val("");
  546. $("#quanzhou_highcert_exptime").val("");
  547. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  548. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_pubtime", {validators: {notEmpty: {message: '福建省高层次人才证书发证日期不能为空'}}});
  549. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_exptime", {validators: {notEmpty: {message: '福建省高层次人才证书有效期不能为空'}}});
  550. break;
  551. case "2":
  552. case "4":
  553. $("#source_batch").parents("td").css("display", "table-cell");
  554. $(".quanzhou_highcert").css("display", "table-cell");
  555. $("#fujian_highcert_pubtime").val("");
  556. $("#fujian_highcert_exptime").val("");
  557. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  558. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_pubtime", {validators: {notEmpty: {message: '泉州高层次人才证书发证日期不能为空'}}});
  559. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_exptime", {validators: {notEmpty: {message: '泉州高层次人才证书有效期不能为空'}}});
  560. break;
  561. default:
  562. $("#source_batch").val("");
  563. $("#quanzhou_highcert_pubtime").val("");
  564. $("#quanzhou_highcert_exptime").val("");
  565. $("#fujian_highcert_pubtime").val("");
  566. $("#fujian_highcert_exptime").val("");
  567. break;
  568. }
  569. if (source == 3) {
  570. //显示入选来源地级市除泉
  571. $("#source_city").parents("td").css("display", "table-cell");
  572. Feng.addAjaxSelect({
  573. "id": "source_city",
  574. "displayCode": "code",
  575. "displayName": "name",
  576. "type": "GET",
  577. "url": "/common/tool/findChildAreaByCode/code/35/no/350500"
  578. });
  579. $('#talentInfoForm').bootstrapValidator('addField', "source_city", {validators: {notEmpty: {message: '入选来源地级市不能为空'}}});
  580. }
  581. if (source == 4) {
  582. //显示入选来源县市区除晋
  583. $("#source_county").parents("td").css("display", "table-cell");
  584. Feng.addAjaxSelect({
  585. "id": "source_county",
  586. "displayCode": "code",
  587. "displayName": "name",
  588. "type": "GET",
  589. "url": "/common/tool/findChildAreaByCode/code/3505/no/350582"
  590. });
  591. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  592. }
  593. if (source != 5) {
  594. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  595. } else {
  596. TalentInfoInfoDlg.ajaxGetConditionFile(source);
  597. }
  598. }
  599. //校验是否保存基础信息
  600. TalentInfoInfoDlg.validId = function () {
  601. var id = $("#id").val();
  602. if (id != null && id != '') {
  603. $("#fileLi").removeAttr("style");
  604. } else {
  605. $("#fileLi").attr("style", "pointer-events: none");
  606. }
  607. }
  608. /**
  609. * 提交审核
  610. */
  611. TalentInfoInfoDlg.submitToCheck = function () {
  612. /*if (!TalentInfoInfoDlg.validate()) {
  613. return;
  614. }*/
  615. var id = $("#id").val();
  616. /*if (id == null || id == "") {
  617. Feng.info("请先填写基础信息并上传附件");
  618. return;
  619. }*/
  620. if (!TalentInfoInfoDlg.validateIsEdit())
  621. return;
  622. var operation = function () {
  623. TalentInfoInfoDlg.clearData();
  624. TalentInfoInfoDlg.collectData();
  625. /*if (!TalentInfoInfoDlg.validate()) {
  626. return;
  627. }*/
  628. var id = $('#id').val();
  629. if (id != null && id != '') {
  630. if (!TalentInfoInfoDlg.validateIsEdit())
  631. return;
  632. }
  633. $("select,input[type=radio]").each(function () {
  634. $(this).removeAttr("disabled");
  635. });
  636. if (locked) {
  637. return;
  638. }
  639. locked = true;
  640. $("#talentInfoForm").attr("action", "/enterprise/talent/submitToCheck");
  641. $("#talentInfoForm")[0].submit();
  642. return;
  643. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submit", function (data) {
  644. if (data.code == 200) {
  645. Feng.success(data.msg);
  646. // $("#checkState").val(data.obj);
  647. window.parent.TalentInfo.table.refresh();
  648. TalentInfoInfoDlg.close();
  649. } else {
  650. Feng.error(data.msg);
  651. }
  652. }, function (data) {
  653. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  654. });
  655. ajax.set("id", id);
  656. ajax.start();
  657. }
  658. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  659. }
  660. //回调
  661. TalentInfoInfoDlg.submitCallback = function (data) {
  662. locked = false;
  663. TalentInfoInfoDlg.setNoChangeField();
  664. if (data.code == 200) {
  665. Feng.success(data.msg);
  666. // $("#checkState").val(data.obj);
  667. window.parent.TalentInfo.table.refresh();
  668. TalentInfoInfoDlg.close();
  669. } else {
  670. Feng.error(data.msg);
  671. }
  672. }
  673. /**
  674. * 校验是否可以修改/提交审核
  675. */
  676. TalentInfoInfoDlg.validateIsEdit = function () {
  677. var checkState = $("#checkState").val();
  678. if (checkState != 0 && checkState != 8) {
  679. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  680. Feng.error("您的申报审核不通过,无法再修改");
  681. return false;
  682. } else if (checkState == 28) {
  683. Feng.error("申报已完成");
  684. return false;
  685. } else if (checkState == 14) {
  686. Feng.error("您的申报已审核通过,无法再修改");
  687. return false;
  688. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  689. Feng.error("该申报已终止");
  690. return false;
  691. } else {
  692. Feng.error("您的申报正在审核中,请耐心等待");
  693. return false;
  694. }
  695. }
  696. return true;
  697. }
  698. TalentInfoInfoDlg.downloadFile = function (id, type) {
  699. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type=" + type;
  700. }
  701. //设置不可修改的字段
  702. TalentInfoInfoDlg.setNoChangeField = function () {
  703. var checkState = $("#checkState").val();
  704. var fields = $("#fields").val();
  705. var realState = $("#realState").val();
  706. if (realState == 11) {
  707. $("input,textarea").each(function () {
  708. $(this).attr("readonly", "readonly");
  709. });
  710. $("select,input[type=radio]").each(function () {
  711. $(this).attr("disabled", "disabled");
  712. });
  713. if (fields != null && fields != '') {
  714. var arr = fields.split(",");
  715. for (var key in arr) {
  716. if (arr[key] != "") {
  717. var name = $("#" + arr[key]).prop("tagName");
  718. if (name == 'select' || name == 'SELECT') {
  719. $("#" + arr[key]).removeAttr("disabled");
  720. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  721. $("#" + arr[key]).removeAttr("readonly");
  722. } else {
  723. if (typeof name == "undefined") {
  724. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly");
  725. }
  726. }
  727. }
  728. }
  729. }
  730. }
  731. }
  732. $("#card_type").change(function () {
  733. async_padding($("#card_number").val().trim(), $(this).val());
  734. })
  735. $("#card_number").blur(function () {
  736. async_padding($(this).val().trim(), $("#card_type").val());
  737. })
  738. function async_padding(card_number, card_type) {
  739. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  740. var year = card_number.substring(6, 10);
  741. var month = card_number.substring(10, 12);
  742. var day = card_number.substring(12, 14);
  743. var birthday = year + "-" + month + "-" + day;
  744. var rule = /\d{4}-\d{2}-\d{2}/;
  745. if (rule.test(birthday))
  746. $("#birthday").val(birthday);
  747. var num = card_number.substring(17, 1);
  748. if (num % 2 == 0) {
  749. $("#sex").val(2);
  750. } else {
  751. $("#sex").val(1);
  752. }
  753. }
  754. }
  755. $(function () {
  756. //Feng.initValidatorTip("talentInfoForm", TalentInfoInfoDlg.validateFields);
  757. var id = $("#id").val();
  758. var checkState = $("#checkState").val();
  759. //批量加载字典表数据
  760. var arr = [
  761. {"name": "nation", "code": "nation"},
  762. {"name": "talent_arrange", "code": "talent_arrange"},
  763. {"name": "nationality", "code": "nationality"},
  764. {"name": "politics", "code": "politics"},
  765. {"name": "highest_degree", "code": "highest_degree"},
  766. {"name": "source", "code": "source"},
  767. {"name": "import_way", "code": "import_way"}];
  768. Feng.findChildDictBatch(JSON.stringify(arr))
  769. //加载省份
  770. Feng.addAjaxSelect({
  771. "id": "province",
  772. "displayCode": "code",
  773. "displayName": "name",
  774. "type": "GET",
  775. "url": "/common/tool/getProvinceSelect"
  776. });
  777. //批量加载时间控件
  778. $(".date").each(function () {
  779. laydate.render({
  780. elem: this
  781. , type: 'date'
  782. , trigger: 'click'
  783. });
  784. });
  785. $(".rangedate").each(function () {
  786. laydate.render({
  787. elem: this,
  788. type: "date",
  789. range: true,
  790. trigger: "click"
  791. })
  792. })
  793. $(".rangemonth").each(function () {
  794. laydate.render({
  795. elem: this,
  796. type: "month",
  797. range: true,
  798. trigger: "click"
  799. })
  800. })
  801. if (id != null && id != '') {
  802. //select初始化
  803. $("select").each(function () {
  804. $(this).val($(this).attr("value")).trigger("change");
  805. });
  806. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  807. }
  808. $("#talent_type").val($("#talent_type").attr("value"));
  809. $("#card_type").val($("#card_type").attr("value"));
  810. $("#sex").val($("#sex").attr("value"));
  811. $("#enterprise_tag").val($("#enterprise_tag").attr("value"));
  812. $("#address").val($("#address").attr("value"));
  813. $("#nation").val($("#nation").attr("value"));
  814. $("#nationality").val($("#nationality").attr("value"));
  815. $("#industry_field").val($("#industry_field").attr("value"));
  816. $("#province").val($("#province").attr("value"));
  817. TalentInfoInfoDlg.afterSelectProvince();
  818. $("#city").val($("#city").attr("value"));
  819. TalentInfoInfoDlg.afterSelectCity();
  820. $("#county").val($("#county").attr("value"));
  821. TalentInfoInfoDlg.getIdentifyCondition();
  822. $("#politics").val($("#politics").attr("value"));
  823. $("#tax_insurance_month").val($("#tax_insurance_month").attr("value"));
  824. $("#labor_contract_rangetime").val($("#labor_contract_rangetime").attr("value"));
  825. $("#source_batch").val($("#source_batch").attr("value"));
  826. $("#source_city").val($("#source_city").attr("value"));
  827. $("#source_county").val($("#source_county").attr("value"));
  828. $("#quanzhou_highcert_pubtime").val($("#quanzhou_highcert_pubtime").attr("value"));
  829. $("#quanzhou_highcert_exptime").val($("#quanzhou_highcert_exptime").attr("value"));
  830. $("#fujian_highcert_pubtime").val($("#fujian_highcert_pubtime").attr("value"));
  831. $("#fujian_highcert_exptime").val($("#fujian_highcert_exptime").attr("value"));
  832. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  833. TalentInfoInfoDlg.getLayerCatdByLayer();
  834. $("#talent_arrange_category").val($("#talent_arrange_category").attr("value"));
  835. TalentInfoInfoDlg.getIdentifyCondition();
  836. TalentInfoInfoDlg.validId();
  837. $("#photo").change(function (e) {
  838. var tag = e.target;
  839. var file = tag.files[0];
  840. var imgSrc;
  841. var reader = new FileReader();
  842. reader.readAsDataURL(file);
  843. reader.onload = function () {
  844. imgSrc = this.result;
  845. $("#photoImg").attr("src", imgSrc);
  846. };
  847. });
  848. TalentInfoInfoDlg.setNoChangeField();
  849. $("#talent_condition").on('chosen:ready', function (e, params) {
  850. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  851. });
  852. $("#talent_condition").val($("#talent_condition").attr("value"));
  853. $("#talent_condition").chosen({
  854. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  855. disable_search: false,
  856. width: "calc(100%)",
  857. enable_split_word_search: true,
  858. rtl: true
  859. });
  860. if ($("#annual_salary").val() != "") {
  861. $("#annual_salary").parents("td").css("display", "table-cell");
  862. $('#talentInfoForm').bootstrapValidator('addField', "annual_salary", {validators: {
  863. notEmpty: {message: '年薪不能放空'},
  864. callback: {
  865. message: "年薪只能填写数字",
  866. callback: function (value, validator) {
  867. if (!isNaN(value) && isFinite(value)) {
  868. return true;
  869. }
  870. return false;
  871. }
  872. }
  873. }
  874. });
  875. }
  876. var is_abroad = $("#study_abroad").val();
  877. if (is_abroad == "1") {
  878. TalentInfoInfoDlg.changeStudyAbroad();
  879. }
  880. TalentInfoInfoDlg.initBirthday();
  881. $(".uitd_showTip").bind("mouseover", function () {
  882. var htm = $(this).html();
  883. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  884. });
  885. });