new_talentInfo_info.js 55 KB

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