talentInfo_gj_info.js 31 KB

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