talentInfo_info.js 49 KB

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