new_talentInfo_info.js 58 KB

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