new_talentInfo_info.js 60 KB

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