talentInfo_wj_info.js 27 KB

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