new_talentInfo_info.js 59 KB

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