talentInfo_gj_info.js 31 KB

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