talentInfo_wj_info.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var TalentInfoInfoDlg = {
  6. talentInfoInfoData: {},
  7. validateFields: {
  8. enterpriseId: {validators: {notEmpty: {message: '所属医院不能为空'}}},
  9. type: {validators: {notEmpty: {message: '人才类别不能为空'}}},
  10. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  11. sex: {validators: {notEmpty: {message: '性别不能为空'}}},
  12. nation: {validators: {notEmpty: {message: '民族不能为空'}}},
  13. politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
  14. card_type: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  15. card_number: {validators: {notEmpty: {message: '证件号码不能为空'}}},
  16. birthday: {validators: {notEmpty: {message: '出生日期不能为空'}}},
  17. talent_type: {validators: {notEmpty: {message: '人才类型不能为空'}}},
  18. highest_degree: {validators: {notEmpty: {message: '最高学历不能为空'}}},
  19. graduate_school: {validators: {notEmpty: {message: '毕业学校不能为空'}}},
  20. major: {validators: {notEmpty: {message: '专业不能为空'}}},
  21. position: {validators: {notEmpty: {message: '职务不能为空'}}},
  22. cur_entry_time: {validators: {notEmpty: {message: '入职时间不能为空'}}},
  23. labor_contract_rangetime: {validators: {notEmpty: {message: '工作合同时间不能为空'}}},
  24. talent_arrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  25. talent_arrange_category: {validators: {notEmpty: {message: '人才条款不能为空'}}},
  26. talent_condition: {validators: {notEmpty: {message: '认定条件不能为空'}}},
  27. phone: {
  28. validators: {
  29. regexp: {
  30. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  31. message: "手机号码格式不正确"
  32. }
  33. }
  34. },
  35. email: {
  36. validators: {
  37. emailAddress: {
  38. message: "电子邮箱格式不正确"
  39. }
  40. }
  41. },
  42. bank: {
  43. validators: {
  44. notEmpty: {
  45. message: '开户银行不能为空'
  46. },
  47. regexp: {
  48. regexp: /^[\u4e00-\u9fa5]*银行$/,
  49. message: "开户银行格式不正确"
  50. }
  51. }
  52. },
  53. bank_account: {validators: {notEmpty: {message: '银行账号不能为空'}}},
  54. bank_number: {validators: {notEmpty: {message: '银行行号不能为空'}}},
  55. bank_branch_name: {
  56. validators: {
  57. notEmpty: {
  58. message: '开户银行网点不能为空'
  59. },
  60. regexp: {
  61. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  62. message: "开户银行格式不正确"
  63. }
  64. }
  65. },
  66. }
  67. };
  68. /**
  69. * 清除数据
  70. */
  71. TalentInfoInfoDlg.clearData = function () {
  72. this.talentInfoInfoData = {};
  73. }
  74. /**
  75. * 设置对话框中的数据
  76. *
  77. * @param key 数据的名称
  78. * @param val 数据的具体值
  79. */
  80. TalentInfoInfoDlg.set = function (key, val) {
  81. this.talentInfoInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  82. return this;
  83. }
  84. /**
  85. * 设置对话框中的数据
  86. *
  87. * @param key 数据的名称
  88. * @param val 数据的具体值
  89. */
  90. TalentInfoInfoDlg.get = function (key) {
  91. return $("#" + key).val();
  92. }
  93. /**
  94. * 关闭此对话框
  95. */
  96. TalentInfoInfoDlg.close = function () {
  97. parent.layer.close(window.parent.TalentInfo.layerIndex);
  98. }
  99. /**
  100. * 收集数据
  101. */
  102. TalentInfoInfoDlg.collectData = function () {
  103. this
  104. .set('id')
  105. .set('enterprise_id')
  106. .set('type')
  107. .set('card_number')
  108. .set('card_type')
  109. .set('name')
  110. .set('sex')
  111. .set('nation')
  112. .set('nationality')
  113. .set('province')
  114. .set('city')
  115. .set('county')
  116. .set('birthday')
  117. .set('address')
  118. .set('politics')
  119. .set('highest_degree')
  120. .set('graduate_school')
  121. .set('major')
  122. .set('position')
  123. .set('phone')
  124. .set('email')
  125. .set('bank')
  126. .set('bank_branch_name')
  127. .set('bank_account')
  128. .set('bank_number')
  129. .set('cur_entry_time')
  130. .set('labor_contract_rangetime')
  131. .set('talent_arrange')
  132. .set('talent_condition')
  133. .set('identifyGetTime')
  134. .set('identifyConditionName')
  135. .set('breakFaith')
  136. .set('education')
  137. .set('experience')
  138. .set('industryField')
  139. .set('title')
  140. .set('pro_qua')
  141. .set('study_abroad')
  142. .set('studyAbroadCountry')
  143. .set('studyAbroadTime')
  144. .set('description');
  145. //this.talentInfoInfoData["provinceName"] = $("#province").find("option:selected").text();
  146. //this.talentInfoInfoData["cityName"] = $("#city").find("option:selected").text();
  147. //this.talentInfoInfoData["countyName"] = $("#county").find("option:selected").text();
  148. }
  149. /**
  150. * 验证数据
  151. */
  152. TalentInfoInfoDlg.validate = function () {
  153. $('#talentInfoForm').data("bootstrapValidator").resetForm();
  154. $('#talentInfoForm').bootstrapValidator('validate');
  155. return $("#talentInfoForm").data('bootstrapValidator').isValid();
  156. }
  157. /**
  158. * 提交添加
  159. */
  160. TalentInfoInfoDlg.addSubmit = function () {
  161. this.clearData();
  162. this.collectData();
  163. if (!TalentInfoInfoDlg.validate()) {
  164. return;
  165. }
  166. var id = $('#id').val();
  167. if (id != null && id != '') {
  168. if (!TalentInfoInfoDlg.validateIsEdit())
  169. return;
  170. }
  171. $("select").each(function () {
  172. $(this).removeAttr("disabled");
  173. });
  174. if (locked) {
  175. return;
  176. }
  177. locked = true;
  178. $("#talentInfoForm")[0].submit();
  179. }
  180. //回调
  181. TalentInfoInfoDlg.infoCallback = function (data) {
  182. locked = false;
  183. TalentInfoInfoDlg.setNoChangeField();
  184. Feng.info(data.msg);
  185. if (data.code == 200) {
  186. window.parent.TalentInfo.table.refresh();
  187. $("#id").val(data.obj.id);
  188. $("#fileLi").removeAttr("style");
  189. $("#checkState").val(data.obj.checkState);
  190. }
  191. }
  192. /**
  193. * 获取人才认定
  194. */
  195. TalentInfoInfoDlg.getIdentifyCondition = function () {
  196. var level = $("#talent_arrange").val();
  197. var cat = $("#talent_arrange_category").val();
  198. var id = $('#id').val();
  199. Feng.addAjaxSelect({
  200. "id": "talent_condition",
  201. "displayCode": "id",
  202. "displayName": "name",
  203. "type": "GET",
  204. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel/level/" + level + "/cat/" + cat + "/id/" + id
  205. });
  206. $("#talent_condition").trigger('chosen:updated');
  207. }
  208. TalentInfoInfoDlg.getLayerCatdByLayer = function () {
  209. $("#talent_condition").html("<option value=''>---请选择---</option>");
  210. var level = $("#talent_arrange").val();
  211. Feng.addAjaxSelect({
  212. "id": "talent_arrange_category",
  213. "displayCode": "code",
  214. "displayName": "name",
  215. "type": "GET",
  216. "url": Feng.ctxPath + "/common/api/getLayerCatsByLayer/level/" + level
  217. });
  218. $("#talent_condition").trigger("chosen:updated");
  219. }
  220. TalentInfoInfoDlg.bankChange = function () {
  221. var bank = $("#bank").val();
  222. if ($.trim(bank) == '中国工商银行') {
  223. $("#bank_number").val('102391050013');
  224. } else {
  225. $("#bank_number").val('');
  226. }
  227. }
  228. TalentInfoInfoDlg.changeStudyAbroad = function () {
  229. var is_abroad = $("#study_abroad").val();
  230. if (is_abroad == 1) {
  231. $("#abroad_school").parent().css("display", "block");
  232. $("#abroad_major").parent().css("display", "block");
  233. } else {
  234. $("#abroad_school").val("").parent().css("display", "none");
  235. $("#abroad_major").val("").parent().css("display", "none");
  236. }
  237. }
  238. //初始化附件类别表单
  239. TalentInfoInfoDlg.initFileTable = function () {
  240. var queryData = {};
  241. queryData['project'] = CONFIG.project_rcrd;
  242. queryData['type'] = $("#type").val();
  243. queryData['checkState'] = $("#checkState").val();
  244. queryData['isMix'] = 1;
  245. $("#fileTable").bootstrapTable({
  246. url: Feng.ctxPath + "/common/api/findCommonFileType",
  247. method: 'POST',
  248. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  249. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  250. showRefresh: false, // 是否显示刷新按钮
  251. clickToSelect: true, // 是否启用点击选中行
  252. singleSelect: true, // 设置True 将禁止多选
  253. striped: true, // 是否显示行间隔色
  254. escape: true,
  255. pagination: false, // 设置为 true 会在表格底部显示分页条
  256. paginationHAlign: "left",
  257. paginationDetailHAlign: "right",
  258. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  259. showColumns: false,
  260. detailView: true, //是否显示父子表
  261. pageList: [10, 30, 50],
  262. queryParams: function (params) {
  263. return $.extend(queryData, params)
  264. },
  265. rowStyle: function (row, index) {
  266. return {classes: "info"};
  267. },
  268. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  269. onPostBody: function () {
  270. $("td.uitd_showTip").bind("mouseover", function () {
  271. var htm = $(this).html();
  272. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  273. });
  274. },
  275. onLoadSuccess: function (data) {
  276. $("#fileTable").bootstrapTable('expandAllRows');
  277. },
  278. onExpandRow: function (index, row, $detail) {
  279. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  280. if (data == null || data.length == 0) {
  281. return;
  282. }
  283. var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
  284. var files = $("#files").val();
  285. var checkState = $("#checkState").val();
  286. var realState = $("#realState").val();
  287. for (var key in data) {
  288. var btn = "";
  289. if (Feng.isEmptyStr(checkState) || (checkState == 8 && (realState == 8 || Feng.isEmptyStr(realState))) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(row.id) != -1)) {
  290. btn = "<button type=\'button\' onclick=\"TalentInfoInfoDlg.checkFile(this,'" + row.fState + "','" + row.id + "','" + data[key].id + "')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  291. "<i class=\"fa fa-paste\"></i>修改" +
  292. "</button>" +
  293. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  294. "<i class=\"fa fa-times\"></i>删除" +
  295. "</button>";
  296. } else {
  297. btn = "";
  298. }
  299. var sn = data[key].url.lastIndexOf(".");
  300. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  301. var imgStr = "";
  302. if (suffix == "pdf" || suffix == "PDF") {
  303. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + data[key].url + "','" + data[key].id + "','" + data[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  304. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  305. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + data[key].url + "','" + data[key].id + "','" + data[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  306. } else {
  307. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  308. }
  309. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  310. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  311. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  312. '<li style="width: 10%;padding-top: 2px;">' + btn + '</li>';
  313. }
  314. html = html + '</ul>';
  315. $detail.html(html);
  316. $(".imgs").viewer({fullscreen: false});
  317. }, function (data) {
  318. Feng.error("查询失败!" + data.responseJSON.message + "!");
  319. });
  320. var queryData = {};
  321. queryData["mainId"] = $("#id").val();
  322. queryData["fileTypeId"] = row.id;
  323. ajax.set(queryData);
  324. ajax.start();
  325. }
  326. });
  327. }
  328. //校验是否保存基础信息
  329. TalentInfoInfoDlg.validId = function () {
  330. var id = $("#id").val();
  331. if (id != null && id != '') {
  332. $("#fileLi").removeAttr("style");
  333. } else {
  334. $("#fileLi").attr("style", "pointer-events: none");
  335. }
  336. }
  337. //选择附件并显示附件名
  338. TalentInfoInfoDlg.checkFile = function (content, state, fileTypeId, fileId) {
  339. if (!TalentInfoInfoDlg.validateIsEdit())
  340. return;
  341. $("#upload_file").unbind("change");
  342. $("#upload_file").change(function () {
  343. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  344. return;
  345. TalentInfoInfoDlg.upload(fileTypeId, fileId);
  346. });
  347. $('#upload_file').val("");
  348. $('#upload_file').click();
  349. }
  350. //上传附件
  351. TalentInfoInfoDlg.upload = function (fileTypeId, fileId) {
  352. var id = $("#id").val();
  353. if (id == null || id == '') {
  354. Feng.info("请先添加基本信息并保存后再试");
  355. return;
  356. }
  357. if (!TalentInfoInfoDlg.validateIsEdit())
  358. return;
  359. if (fileId != null && fileId != 'null') {
  360. $("#fileId").val(fileId)
  361. } else {
  362. $("#fileId").val("");
  363. }
  364. $("#mainId").val(id);
  365. $("#fileTypeId").val(fileTypeId);
  366. var index = layer.load(0, {shade: false, time: 0});
  367. $("#index").val(index);
  368. $("#uploadForm").submit();
  369. }
  370. //删除附件
  371. TalentInfoInfoDlg.deleteFile = function (id, state) {
  372. if (!TalentInfoInfoDlg.validateIsEdit())
  373. return;
  374. var operation = function () {
  375. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  376. if (data.code == 200) {
  377. Feng.success(data.msg);
  378. $("#fileTable").bootstrapTable("refresh", {});
  379. } else {
  380. Feng.error(data.msg);
  381. }
  382. }, function (data) {
  383. Feng.error("删除失败!" + data.responseJSON.message + "!");
  384. });
  385. ajax.set("id", id);
  386. ajax.set("type", 1);
  387. ajax.start();
  388. }
  389. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  390. }
  391. /**
  392. * 提交审核
  393. */
  394. TalentInfoInfoDlg.submitToCheck = function () {
  395. var id = $("#id").val();
  396. if (id == null || id == "") {
  397. Feng.info("请先填写基础信息并上传附件");
  398. return;
  399. }
  400. if (!TalentInfoInfoDlg.validateIsEdit())
  401. return;
  402. var operation = function () {
  403. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submitToCheck", function (data) {
  404. if (data.code == 200) {
  405. Feng.success(data.msg);
  406. // $("#checkState").val(data.obj);
  407. window.parent.TalentInfo.table.refresh();
  408. TalentInfoInfoDlg.close();
  409. } else {
  410. Feng.error(data.msg);
  411. }
  412. }, function (data) {
  413. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  414. });
  415. ajax.set("id", id);
  416. ajax.start();
  417. }
  418. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  419. }
  420. /**
  421. * 校验是否可以修改/提交审核
  422. */
  423. TalentInfoInfoDlg.validateIsEdit = function () {
  424. var checkState = $("#checkState").val();
  425. if (checkState != 0 && checkState != 8) {
  426. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  427. Feng.error("您的申报审核不通过,无法再修改");
  428. return false;
  429. } else if (checkState == 28) {
  430. Feng.error("申报已完成");
  431. return false;
  432. } else if (checkState == 14) {
  433. Feng.error("您的申报已审核通过,无法再修改");
  434. return false;
  435. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  436. Feng.error("该申报已终止");
  437. return false;
  438. } else {
  439. Feng.error("您的申报正在审核中,请耐心等待");
  440. return false;
  441. }
  442. }
  443. return true;
  444. }
  445. /**
  446. * 初始化表格的列
  447. */
  448. TalentInfoInfoDlg.initFileTypeColumn = function () {
  449. return [
  450. {field: 'selectItem', checkbox: false, visible: false},
  451. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  452. formatter: function (value, row, index) {
  453. if (row.must == 1) {
  454. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  455. }
  456. if (row.must == 2) {
  457. return '<i class="fa fa-paste"></i>' + value;
  458. }
  459. }
  460. },
  461. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  462. formatter: function (value, row, index) {
  463. if (value == null || value == '' || value == 'null') {
  464. return '无';
  465. }
  466. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',5)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  467. "<i class=\"fa fa-download\"></i>下载" +
  468. "</button>";
  469. }
  470. },
  471. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  472. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  473. formatter: function (value, row, index) {
  474. var files = $("#files").val();
  475. var checkState = $("#checkState").val();
  476. var realState = $("#realState").val();
  477. //if (checkState == 8 || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(value) != -1)) {
  478. if (Feng.isEmptyStr(checkState) || (checkState == 8 && (realState == 8 || Feng.isEmptyStr(realState))) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(value) != -1)) {
  479. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this,'" + row.fState + "','" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  480. "<i class=\"fa fa-upload\"></i>上传" +
  481. "</button>";
  482. } else {
  483. return "审核通过,无法添加";
  484. }
  485. }
  486. }
  487. ]
  488. };
  489. //回调
  490. TalentInfoInfoDlg.callBack = function (data) {
  491. layer.close(data.obj);
  492. Feng.info(data.msg);
  493. if (data.code == 200) {
  494. $("#fileTable").bootstrapTable("refresh", {});
  495. }
  496. }
  497. TalentInfoInfoDlg.downloadFile = function (id, type) {
  498. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type=" + type;
  499. }
  500. //设置不可修改的字段
  501. TalentInfoInfoDlg.setNoChangeField = function () {
  502. var checkState = $("#checkState").val();
  503. var fields = $("#fields").val();
  504. var realState = $("#realState").val();
  505. if (realState == 11) {
  506. $("input,textarea").each(function () {
  507. $(this).attr("readonly", "readonly");
  508. });
  509. $("select,input[type=radio]").each(function () {
  510. $(this).attr("disabled", "disabled");
  511. });
  512. if (fields != null && fields != '') {
  513. var arr = fields.split(",");
  514. for (var key in arr) {
  515. if (arr[key] != "") {
  516. var name = $("#" + arr[key]).prop("tagName");
  517. if (name == 'select' || name == 'SELECT') {
  518. $("#" + arr[key]).removeAttr("disabled");
  519. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  520. $("#" + arr[key]).removeAttr("readonly");
  521. } else {
  522. if (typeof name == "undefined") {
  523. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly");
  524. }
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. $("#card_type").change(function () {
  532. async_padding($("#card_number").val().trim(), $(this).val());
  533. })
  534. $("#card_number").blur(function () {
  535. async_padding($(this).val().trim(), $("#card_type").val());
  536. })
  537. function async_padding(card_number, card_type) {
  538. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  539. var year = card_number.substring(6, 10);
  540. var month = card_number.substring(10, 12);
  541. var day = card_number.substring(12, 14);
  542. var birthday = year + "-" + month + "-" + day;
  543. var rule = /\d{4}-\d{2}-\d{2}/;
  544. if (rule.test(birthday))
  545. $("#birthday").val(birthday);
  546. var num = card_number.substring(17, 1);
  547. if (num % 2 == 0) {
  548. $("#sex").val(2);
  549. } else {
  550. $("#sex").val(1);
  551. }
  552. }
  553. }
  554. $(function () {
  555. $('#talentInfoForm').bootstrapValidator({
  556. feedbackIcons: {
  557. valid: 'glyphicon glyphicon-ok',
  558. invalid: 'glyphicon glyphicon-remove',
  559. validating: 'glyphicon glyphicon-refresh'
  560. },
  561. container: 'tooltip',
  562. group: '.rowGroup',
  563. fields: TalentInfoInfoDlg.validateFields,
  564. live: 'enabled',
  565. message: '该字段不能为空'
  566. }).on('error.field.bv', function (e, data) {
  567. // Get the tooltip
  568. var $parent = data.element.parents('.form-group-sm'),
  569. $icon = $parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]'),
  570. title = $icon.data('bs.tooltip').getTitle();
  571. $icon.tooltip('destroy').tooltip({
  572. html: true,
  573. placement: 'right',
  574. title: title,
  575. container: 'body'
  576. });
  577. });
  578. //批量加载字典表数据
  579. var arr = [
  580. {"name": "nation", "code": "nation"},
  581. {"name": "talent_arrange", "code": "talent_arrange"},
  582. {"name": "nationality", "code": "nationality"},
  583. {"name": "politics", "code": "politics"},
  584. {"name": "highest_degree", "code": "highest_degree"}];
  585. Feng.findChildDictBatch(JSON.stringify(arr));
  586. //批量加载时间控件
  587. $(".date").each(function () {
  588. laydate.render({
  589. elem: this
  590. , type: 'date'
  591. , trigger: 'click'
  592. });
  593. });
  594. $(".rangedate").each(function () {
  595. laydate.render({
  596. elem: this,
  597. type: "date",
  598. range: true,
  599. trigger: "click"
  600. })
  601. })
  602. $(".rangemonth").each(function () {
  603. laydate.render({
  604. elem: this,
  605. type: "month",
  606. range: true,
  607. trigger: "click"
  608. })
  609. })
  610. var id = $("#id").val();
  611. if (id != null && id != '') {
  612. $("select").each(function () {
  613. $(this).val($(this).attr("value")).trigger("change");
  614. });
  615. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  616. }
  617. $("#address").val($("#address").attr("value"));
  618. $("#province").val($("#province").attr("value"));
  619. TalentInfoInfoDlg.afterSelectProvince();
  620. $("#city").val($("#city").attr("value"));
  621. TalentInfoInfoDlg.afterSelectCity();
  622. $("#county").val($("#county").attr("value"));
  623. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  624. TalentInfoInfoDlg.getIdentifyCondition();
  625. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  626. $("#talent_condition").val($("#talent_condition").attr("value"));
  627. TalentInfoInfoDlg.validId();
  628. $("#photo").change(function (e) {
  629. var tag = e.target;
  630. var file = tag.files[0];
  631. var imgSrc;
  632. var reader = new FileReader();
  633. reader.readAsDataURL(file);
  634. reader.onload = function () {
  635. imgSrc = this.result;
  636. $("#photoImg").attr("src", imgSrc);
  637. };
  638. });
  639. TalentInfoInfoDlg.setNoChangeField();
  640. $("#talent_condition").on('chosen:ready', function (e, params) {
  641. $(".chosen-container-single .chosen-single").css("padding", "2px 0px 0px 4px");
  642. });
  643. $("#talent_condition").chosen({
  644. no_results_text: "没有找到结果!",
  645. width: '490px',
  646. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  647. disable_search: false,
  648. enable_split_word_search: true,
  649. rtl: true
  650. });
  651. });