new_talentInfo_info.js 57 KB

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