talentInfo_info.js 50 KB

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