talentInfo_wj_info.js 29 KB

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