talentInfo_info.js 53 KB

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