talentInfo_ic_info.js 28 KB

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