talentInfo_ic_info.js 26 KB

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