new_talentInfo_info.js 63 KB

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