new_talentInfo_info.js 58 KB

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