talentInfo_info.js 50 KB

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