talentInfo_info.js 52 KB

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