new_talentInfo_info.js 63 KB

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