talentInfo_info.js 50 KB

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