talentInfo_wj_info.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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. * 加载市
  240. */
  241. TalentInfoInfoDlg.afterSelectProvince = function () {
  242. var province = $("#province").val();
  243. $("#city").empty();
  244. $("#county").empty();
  245. if (province == null || province == '') {
  246. return;
  247. }
  248. Feng.addAjaxSelect({
  249. "id": "city",
  250. "displayCode": "code",
  251. "displayName": "name",
  252. "type": "GET",
  253. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  254. });
  255. }
  256. /**
  257. * 加载县
  258. */
  259. TalentInfoInfoDlg.afterSelectCity = function () {
  260. var city = $("#city").val();
  261. $("#county").empty();
  262. if (city == null || city == '') {
  263. return;
  264. }
  265. Feng.addAjaxSelect({
  266. "id": "county",
  267. "displayCode": "code",
  268. "displayName": "name",
  269. "type": "GET",
  270. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  271. });
  272. }
  273. //初始化附件类别表单
  274. TalentInfoInfoDlg.initFileTable = function () {
  275. var queryData = {};
  276. queryData['project'] = CONFIG.project_rcrd;
  277. queryData['type'] = $("#type").val();
  278. queryData['checkState'] = $("#checkState").val();
  279. queryData['isMix'] = 1;
  280. $("#fileTable").bootstrapTable({
  281. url: Feng.ctxPath + "/common/api/findCommonFileType",
  282. method: 'POST',
  283. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  284. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  285. showRefresh: false, // 是否显示刷新按钮
  286. clickToSelect: true, // 是否启用点击选中行
  287. singleSelect: true, // 设置True 将禁止多选
  288. striped: true, // 是否显示行间隔色
  289. escape: true,
  290. pagination: false, // 设置为 true 会在表格底部显示分页条
  291. paginationHAlign: "left",
  292. paginationDetailHAlign: "right",
  293. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  294. showColumns: false,
  295. detailView: true, //是否显示父子表
  296. pageList: [10, 30, 50],
  297. queryParams: function (params) {
  298. return $.extend(queryData, params)
  299. },
  300. rowStyle: function (row, index) {
  301. return {classes: "info"};
  302. },
  303. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  304. onPostBody: function () {
  305. $("td.uitd_showTip").bind("mouseover", function () {
  306. var htm = $(this).html();
  307. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  308. });
  309. },
  310. onLoadSuccess: function (data) {
  311. $("#fileTable").bootstrapTable('expandAllRows');
  312. },
  313. onExpandRow: function (index, row, $detail) {
  314. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  315. if (data == null || data.length == 0) {
  316. return;
  317. }
  318. 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>';
  319. var files = $("#files").val();
  320. var checkState = $("#checkState").val();
  321. var realState = $("#realState").val();
  322. for (var key in data) {
  323. var btn = "";
  324. if (Feng.isEmptyStr(checkState) || (checkState == 8 && (realState == 8 || Feng.isEmptyStr(realState))) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(row.id) != -1)) {
  325. 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\">" +
  326. "<i class=\"fa fa-paste\"></i>修改" +
  327. "</button>" +
  328. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  329. "<i class=\"fa fa-times\"></i>删除" +
  330. "</button>";
  331. } else {
  332. btn = "";
  333. }
  334. var sn = data[key].url.lastIndexOf(".");
  335. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  336. var imgStr = "";
  337. if (suffix == "pdf" || suffix == "PDF") {
  338. 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>";
  339. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  340. 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>";
  341. } else {
  342. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  343. }
  344. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  345. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  346. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  347. '<li style="width: 10%;padding-top: 2px;">' + btn + '</li>';
  348. }
  349. html = html + '</ul>';
  350. $detail.html(html);
  351. $(".imgs").viewer({fullscreen: false});
  352. }, function (data) {
  353. Feng.error("查询失败!" + data.responseJSON.message + "!");
  354. });
  355. var queryData = {};
  356. queryData["mainId"] = $("#id").val();
  357. queryData["fileTypeId"] = row.id;
  358. ajax.set(queryData);
  359. ajax.start();
  360. }
  361. });
  362. }
  363. //校验是否保存基础信息
  364. TalentInfoInfoDlg.validId = function () {
  365. var id = $("#id").val();
  366. if (id != null && id != '') {
  367. $("#fileLi").removeAttr("style");
  368. } else {
  369. $("#fileLi").attr("style", "pointer-events: none");
  370. }
  371. }
  372. //选择附件并显示附件名
  373. TalentInfoInfoDlg.checkFile = function (content, state, fileTypeId, fileId) {
  374. if (!TalentInfoInfoDlg.validateIsEdit())
  375. return;
  376. $("#upload_file").unbind("change");
  377. $("#upload_file").change(function () {
  378. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  379. return;
  380. TalentInfoInfoDlg.upload(fileTypeId, fileId);
  381. });
  382. $('#upload_file').val("");
  383. $('#upload_file').click();
  384. }
  385. //上传附件
  386. TalentInfoInfoDlg.upload = function (fileTypeId, fileId) {
  387. var id = $("#id").val();
  388. if (id == null || id == '') {
  389. Feng.info("请先添加基本信息并保存后再试");
  390. return;
  391. }
  392. if (!TalentInfoInfoDlg.validateIsEdit())
  393. return;
  394. if (fileId != null && fileId != 'null') {
  395. $("#fileId").val(fileId)
  396. } else {
  397. $("#fileId").val("");
  398. }
  399. $("#mainId").val(id);
  400. $("#fileTypeId").val(fileTypeId);
  401. var index = layer.load(0, {shade: false, time: 0});
  402. $("#index").val(index);
  403. $("#uploadForm").submit();
  404. }
  405. //删除附件
  406. TalentInfoInfoDlg.deleteFile = function (id, state) {
  407. if (!TalentInfoInfoDlg.validateIsEdit())
  408. return;
  409. var operation = function () {
  410. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  411. if (data.code == 200) {
  412. Feng.success(data.msg);
  413. $("#fileTable").bootstrapTable("refresh", {});
  414. } else {
  415. Feng.error(data.msg);
  416. }
  417. }, function (data) {
  418. Feng.error("删除失败!" + data.responseJSON.message + "!");
  419. });
  420. ajax.set("id", id);
  421. ajax.set("type", 1);
  422. ajax.start();
  423. }
  424. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  425. }
  426. /**
  427. * 提交审核
  428. */
  429. TalentInfoInfoDlg.submitToCheck = function () {
  430. var id = $("#id").val();
  431. if (id == null || id == "") {
  432. Feng.info("请先填写基础信息并上传附件");
  433. return;
  434. }
  435. if (!TalentInfoInfoDlg.validateIsEdit())
  436. return;
  437. var operation = function () {
  438. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submitToCheck", function (data) {
  439. if (data.code == 200) {
  440. Feng.success(data.msg);
  441. // $("#checkState").val(data.obj);
  442. window.parent.TalentInfo.table.refresh();
  443. TalentInfoInfoDlg.close();
  444. } else {
  445. Feng.error(data.msg);
  446. }
  447. }, function (data) {
  448. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  449. });
  450. ajax.set("id", id);
  451. ajax.start();
  452. }
  453. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  454. }
  455. /**
  456. * 校验是否可以修改/提交审核
  457. */
  458. TalentInfoInfoDlg.validateIsEdit = function () {
  459. var checkState = $("#checkState").val();
  460. if (checkState != 0 && checkState != 8) {
  461. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  462. Feng.error("您的申报审核不通过,无法再修改");
  463. return false;
  464. } else if (checkState == 28) {
  465. Feng.error("申报已完成");
  466. return false;
  467. } else if (checkState == 14) {
  468. Feng.error("您的申报已审核通过,无法再修改");
  469. return false;
  470. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  471. Feng.error("该申报已终止");
  472. return false;
  473. } else {
  474. Feng.error("您的申报正在审核中,请耐心等待");
  475. return false;
  476. }
  477. }
  478. return true;
  479. }
  480. /**
  481. * 初始化表格的列
  482. */
  483. TalentInfoInfoDlg.initFileTypeColumn = function () {
  484. return [
  485. {field: 'selectItem', checkbox: false, visible: false},
  486. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  487. formatter: function (value, row, index) {
  488. if (row.must == 1) {
  489. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  490. }
  491. if (row.must == 2) {
  492. return '<i class="fa fa-paste"></i>' + value;
  493. }
  494. }
  495. },
  496. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  497. formatter: function (value, row, index) {
  498. if (value == null || value == '' || value == 'null') {
  499. return '无';
  500. }
  501. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',5)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  502. "<i class=\"fa fa-download\"></i>下载" +
  503. "</button>";
  504. }
  505. },
  506. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  507. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  508. formatter: function (value, row, index) {
  509. var files = $("#files").val();
  510. var checkState = $("#checkState").val();
  511. var realState = $("#realState").val();
  512. //if (checkState == 8 || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(value) != -1)) {
  513. if (Feng.isEmptyStr(checkState) || (checkState == 8 && (realState == 8 || Feng.isEmptyStr(realState))) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(value) != -1)) {
  514. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this,'" + row.fState + "','" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  515. "<i class=\"fa fa-upload\"></i>上传" +
  516. "</button>";
  517. } else {
  518. return "审核通过,无法添加";
  519. }
  520. }
  521. }
  522. ]
  523. };
  524. //回调
  525. TalentInfoInfoDlg.callBack = function (data) {
  526. layer.close(data.obj);
  527. Feng.info(data.msg);
  528. if (data.code == 200) {
  529. $("#fileTable").bootstrapTable("refresh", {});
  530. }
  531. }
  532. TalentInfoInfoDlg.downloadFile = function (id, type) {
  533. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type=" + type;
  534. }
  535. //设置不可修改的字段
  536. TalentInfoInfoDlg.setNoChangeField = function () {
  537. var checkState = $("#checkState").val();
  538. var fields = $("#fields").val();
  539. var realState = $("#realState").val();
  540. if (realState == 11) {
  541. $("input,textarea").each(function () {
  542. $(this).attr("readonly", "readonly");
  543. });
  544. $("select,input[type=radio]").each(function () {
  545. $(this).attr("disabled", "disabled");
  546. });
  547. if (fields != null && fields != '') {
  548. var arr = fields.split(",");
  549. for (var key in arr) {
  550. if (arr[key] != "") {
  551. var name = $("#" + arr[key]).prop("tagName");
  552. if (name == 'select' || name == 'SELECT') {
  553. $("#" + arr[key]).removeAttr("disabled");
  554. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  555. $("#" + arr[key]).removeAttr("readonly");
  556. } else {
  557. if (typeof name == "undefined") {
  558. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly");
  559. }
  560. }
  561. }
  562. }
  563. }
  564. }
  565. }
  566. $("#card_type").change(function () {
  567. async_padding($("#card_number").val().trim(), $(this).val());
  568. })
  569. $("#card_number").blur(function () {
  570. async_padding($(this).val().trim(), $("#card_type").val());
  571. })
  572. function async_padding(card_number, card_type) {
  573. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  574. var year = card_number.substring(6, 10);
  575. var month = card_number.substring(10, 12);
  576. var day = card_number.substring(12, 14);
  577. var birthday = year + "-" + month + "-" + day;
  578. var rule = /\d{4}-\d{2}-\d{2}/;
  579. if (rule.test(birthday))
  580. $("#birthday").val(birthday);
  581. var num = card_number.substring(17, 1);
  582. if (num % 2 == 0) {
  583. $("#sex").val(2);
  584. } else {
  585. $("#sex").val(1);
  586. }
  587. }
  588. }
  589. $(function () {
  590. $('#talentInfoForm').bootstrapValidator({
  591. feedbackIcons: {
  592. valid: 'glyphicon glyphicon-ok',
  593. invalid: 'glyphicon glyphicon-remove',
  594. validating: 'glyphicon glyphicon-refresh'
  595. },
  596. container: 'tooltip',
  597. group: '.rowGroup',
  598. fields: TalentInfoInfoDlg.validateFields,
  599. live: 'enabled',
  600. message: '该字段不能为空'
  601. }).on('error.field.bv', function (e, data) {
  602. // Get the tooltip
  603. var $parent = data.element.parents('.form-group-sm'),
  604. $icon = $parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]'),
  605. title = $icon.data('bs.tooltip').getTitle();
  606. $icon.tooltip('destroy').tooltip({
  607. html: true,
  608. placement: 'right',
  609. title: title,
  610. container: 'body'
  611. });
  612. });
  613. //批量加载字典表数据
  614. var arr = [
  615. {"name": "nation", "code": "nation"},
  616. {"name": "talent_arrange", "code": "talent_arrange"},
  617. {"name": "nationality", "code": "nationality"},
  618. {"name": "politics", "code": "politics"},
  619. {"name": "highest_degree", "code": "highest_degree"}];
  620. Feng.findChildDictBatch(JSON.stringify(arr));
  621. //批量加载时间控件
  622. $(".date").each(function () {
  623. laydate.render({
  624. elem: this
  625. , type: 'date'
  626. , trigger: 'click'
  627. });
  628. });
  629. $(".rangedate").each(function () {
  630. laydate.render({
  631. elem: this,
  632. type: "date",
  633. range: true,
  634. trigger: "click"
  635. })
  636. })
  637. $(".rangemonth").each(function () {
  638. laydate.render({
  639. elem: this,
  640. type: "month",
  641. range: true,
  642. trigger: "click"
  643. })
  644. })
  645. var id = $("#id").val();
  646. if (id != null && id != '') {
  647. $("select").each(function () {
  648. $(this).val($(this).attr("value")).trigger("change");
  649. });
  650. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  651. }
  652. $("#address").val($("#address").attr("value"));
  653. $("#province").val($("#province").attr("value"));
  654. TalentInfoInfoDlg.afterSelectProvince();
  655. $("#city").val($("#city").attr("value"));
  656. TalentInfoInfoDlg.afterSelectCity();
  657. $("#county").val($("#county").attr("value"));
  658. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  659. TalentInfoInfoDlg.getIdentifyCondition();
  660. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  661. $("#talent_condition").val($("#talent_condition").attr("value"));
  662. TalentInfoInfoDlg.validId();
  663. $("#photo").change(function (e) {
  664. var tag = e.target;
  665. var file = tag.files[0];
  666. var imgSrc;
  667. var reader = new FileReader();
  668. reader.readAsDataURL(file);
  669. reader.onload = function () {
  670. imgSrc = this.result;
  671. $("#photoImg").attr("src", imgSrc);
  672. };
  673. });
  674. TalentInfoInfoDlg.setNoChangeField();
  675. $("#talent_condition").on('chosen:ready', function (e, params) {
  676. $(".chosen-container-single .chosen-single").css("padding", "2px 0px 0px 4px");
  677. });
  678. $("#talent_condition").chosen({
  679. no_results_text: "没有找到结果!",
  680. width: '490px',
  681. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  682. disable_search: false,
  683. enable_split_word_search: true,
  684. rtl: true
  685. });
  686. });