new_talentInfo_info.js 62 KB

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