new_talentInfo_info.js 58 KB

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