new_talentInfo_info.js 63 KB

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