talentInfo_ic_info.js 27 KB

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