talentInfo_ic_info.js 27 KB

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