integralInfo.js 56 KB

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