new_talentInfo_info.js 57 KB

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