talentInfo_wj_info.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  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|16|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|16|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. var level = $("#talent_arrange").val();
  249. var type = $("#type").val();
  250. if (level == null || level == '') {
  251. $("#talent_condition").empty();
  252. $("#talent_condition").trigger('chosen:updated');
  253. TalentInfoInfoDlg.changeIdentifyCondition();
  254. return;
  255. }
  256. if (type == null || type == '') {
  257. Feng.info("请先选择人才类别");
  258. return;
  259. }
  260. Feng.addAjaxSelect({
  261. "id": "talent_condition",
  262. "displayCode": "id",
  263. "displayName": "name",
  264. "type": "GET",
  265. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level + "&type=" + type
  266. });
  267. $("#talent_condition").trigger('chosen:updated');
  268. TalentInfoInfoDlg.changeIdentifyCondition();
  269. }
  270. TalentInfoInfoDlg.getLayerCatdByLayer = function () {
  271. $("#talent_condition").html("<option value=''>---请选择---</option>");
  272. var level = $("#talent_arrange").val();
  273. Feng.addAjaxSelect({
  274. "id": "talent_arrange_category",
  275. "displayCode": "code",
  276. "displayName": "name",
  277. "type": "GET",
  278. "url": Feng.ctxPath + "/common/api/getLayerCatsByLayer/level/" + level
  279. });
  280. $("#talent_condition").trigger("chosen:updated");
  281. }
  282. TalentInfoInfoDlg.changeIdentifyCondition = function () {
  283. if ((TalentInfoInfoDlg.initTalentCondtion != $("#talent_condition").val() && $("#talent_condition").val() != "") || (TalentInfoInfoDlg.initTalentCondtion != "" && $("#talent_condition").val() == "")) {
  284. $("#fileTable").bootstrapTable("destroy", {});
  285. TalentInfoInfoDlg.initFileTable();
  286. //$("#fileTable").bootstrapTable("refresh", {});
  287. TalentInfoInfoDlg.initTalentCondtion = $("#talent_condition").val();
  288. }
  289. }
  290. TalentInfoInfoDlg.bankChange = function () {
  291. var bank = $("#bank").val();
  292. if ($.trim(bank) == '中国工商银行') {
  293. $("#bank_number").val('102391050013');
  294. } else {
  295. $("#bank_number").val('');
  296. }
  297. }
  298. TalentInfoInfoDlg.changeStudyAbroad = function () {
  299. var is_abroad = $("#study_abroad").val();
  300. if (is_abroad == 1) {
  301. $("#abroad_school").parent().css("display", "block");
  302. $("#abroad_major").parent().css("display", "block");
  303. } else {
  304. $("#abroad_school").val("").parent().css("display", "none");
  305. $("#abroad_major").val("").parent().css("display", "none");
  306. }
  307. }
  308. //初始化附件类别表单
  309. TalentInfoInfoDlg.initFileTable = function () {
  310. var queryData = {};
  311. queryData['project'] = CONFIG.project_rcrd;
  312. queryData['type'] = $("#type").val();
  313. queryData["talent_condition"] = $("#talent_condition").val();
  314. queryData['checkState'] = $("#checkState").val();
  315. queryData['isMix'] = 1;
  316. $("#fileTable").bootstrapTable({
  317. url: Feng.ctxPath + "/common/api/findCommonFileType",
  318. method: 'POST',
  319. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  320. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  321. showRefresh: false, // 是否显示刷新按钮
  322. clickToSelect: true, // 是否启用点击选中行
  323. singleSelect: true, // 设置True 将禁止多选
  324. striped: true, // 是否显示行间隔色
  325. escape: true,
  326. pagination: false, // 设置为 true 会在表格底部显示分页条
  327. paginationHAlign: "left",
  328. paginationDetailHAlign: "right",
  329. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  330. showColumns: false,
  331. detailView: true, //是否显示父子表
  332. pageList: [10, 30, 50],
  333. queryParams: function (params) {
  334. return $.extend(queryData, params)
  335. },
  336. rowStyle: function (row, index) {
  337. return {classes: "info"};
  338. },
  339. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  340. onPostBody: function () {
  341. $("td.uitd_showTip").bind("mouseover", function () {
  342. var htm = $(this).html();
  343. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  344. });
  345. },
  346. onLoadSuccess: function (data) {
  347. $("#fileTable").bootstrapTable('expandAllRows');
  348. },
  349. onExpandRow: function (index, row, $detail) {
  350. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  351. if (data == null || data.length == 0) {
  352. return;
  353. }
  354. 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>';
  355. var files = $("#files").val();
  356. var checkState = $("#checkState").val();
  357. var realState = $("#realState").val();
  358. for (var key in data) {
  359. var btn = "";
  360. 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)) {
  361. 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\">" +
  362. "<i class=\"fa fa-paste\"></i>修改" +
  363. "</button>" +
  364. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  365. "<i class=\"fa fa-times\"></i>删除" +
  366. "</button>";
  367. } else {
  368. btn = "";
  369. }
  370. var sn = data[key].url.lastIndexOf(".");
  371. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  372. var imgStr = "";
  373. if (suffix == "pdf" || suffix == "PDF") {
  374. 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>";
  375. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  376. 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>";
  377. } else {
  378. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  379. }
  380. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  381. '<li style="width: 75%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  382. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  383. '<li style="width: 15%;padding-top: 2px;">' + btn + '</li>';
  384. }
  385. html = html + '</ul>';
  386. $detail.html(html);
  387. $(".imgs").viewer({fullscreen: false});
  388. }, function (data) {
  389. Feng.error("查询失败!" + data.responseJSON.message + "!");
  390. });
  391. var queryData = {};
  392. queryData["mainId"] = $("#id").val();
  393. queryData["fileTypeId"] = row.id;
  394. ajax.set(queryData);
  395. ajax.start();
  396. }
  397. });
  398. }
  399. //校验是否保存基础信息
  400. TalentInfoInfoDlg.validId = function () {
  401. var id = $("#id").val();
  402. if (id != null && id != '') {
  403. $("#fileLi").removeAttr("style");
  404. } else {
  405. $("#fileLi").attr("style", "pointer-events: none");
  406. }
  407. }
  408. //选择附件并显示附件名
  409. TalentInfoInfoDlg.checkFile = function (content, state, fileTypeId, fileId) {
  410. if (!TalentInfoInfoDlg.validateIsEdit())
  411. return;
  412. $("#upload_file").unbind("change");
  413. $("#upload_file").change(function () {
  414. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  415. return;
  416. TalentInfoInfoDlg.upload(fileTypeId, fileId);
  417. });
  418. $('#upload_file').val("");
  419. $('#upload_file').click();
  420. }
  421. //上传附件
  422. TalentInfoInfoDlg.upload = function (fileTypeId, fileId) {
  423. var id = $("#id").val();
  424. if (id == null || id == '') {
  425. Feng.info("请先添加基本信息并保存后再试");
  426. return;
  427. }
  428. if (!TalentInfoInfoDlg.validateIsEdit())
  429. return;
  430. if (fileId != null && fileId != 'null') {
  431. $("#fileId").val(fileId)
  432. } else {
  433. $("#fileId").val("");
  434. }
  435. $("#mainId").val(id);
  436. $("#fileTypeId").val(fileTypeId);
  437. var index = layer.load(0, {shade: false, time: 0});
  438. $("#index").val(index);
  439. $("#uploadForm").submit();
  440. }
  441. //删除附件
  442. TalentInfoInfoDlg.deleteFile = function (id, state) {
  443. if (!TalentInfoInfoDlg.validateIsEdit())
  444. return;
  445. var operation = function () {
  446. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  447. if (data.code == 200) {
  448. Feng.success(data.msg);
  449. $("#fileTable").bootstrapTable("refresh", {});
  450. } else {
  451. Feng.error(data.msg);
  452. }
  453. }, function (data) {
  454. Feng.error("删除失败!" + data.responseJSON.message + "!");
  455. });
  456. ajax.set("id", id);
  457. ajax.set("type", 1);
  458. ajax.start();
  459. }
  460. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  461. }
  462. /**
  463. * 提交审核
  464. */
  465. TalentInfoInfoDlg.submitToCheck = function () {
  466. Feng.initValidatorTip("talentInfoForm", TalentInfoInfoDlg.validateFields2);
  467. var id = $("#id").val();
  468. if (id == null || id == "") {
  469. Feng.info("请先填写基础信息并上传附件");
  470. return;
  471. }
  472. if (!TalentInfoInfoDlg.validateIsEdit())
  473. return;
  474. var operation = function () {
  475. TalentInfoInfoDlg.clearData();
  476. TalentInfoInfoDlg.collectData();
  477. var id = $('#id').val();
  478. if (id != null && id != '') {
  479. if (!TalentInfoInfoDlg.validateIsEdit())
  480. return;
  481. }
  482. $("select,input[type=radio]").each(function () {
  483. $(this).removeAttr("disabled");
  484. });
  485. if (locked) {
  486. return;
  487. }
  488. locked = true;
  489. $("#talentInfoForm").attr("action", "/enterprise/talent/submitToCheck");
  490. $("#talentInfoForm")[0].submit();
  491. return;
  492. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submitToCheck", function (data) {
  493. if (data.code == 200) {
  494. Feng.success(data.msg);
  495. // $("#checkState").val(data.obj);
  496. window.parent.TalentInfo.table.refresh();
  497. TalentInfoInfoDlg.close();
  498. } else {
  499. Feng.error(data.msg);
  500. }
  501. }, function (data) {
  502. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  503. });
  504. ajax.set("id", id);
  505. ajax.start();
  506. }
  507. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  508. }
  509. /**
  510. * 校验是否可以修改/提交审核
  511. */
  512. TalentInfoInfoDlg.validateIsEdit = function () {
  513. var checkState = $("#checkState").val();
  514. if (checkState != 0 && checkState != 8 && checkState != 1) {
  515. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  516. Feng.error("您的申报审核不通过,无法再修改");
  517. return false;
  518. } else if (checkState == 28) {
  519. Feng.error("申报已完成");
  520. return false;
  521. } else if (checkState == 14) {
  522. Feng.error("您的申报已审核通过,无法再修改");
  523. return false;
  524. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  525. Feng.error("该申报已终止");
  526. return false;
  527. } else {
  528. Feng.error("您的申报正在审核中,请耐心等待");
  529. return false;
  530. }
  531. }
  532. return true;
  533. }
  534. /**
  535. * 初始化表格的列
  536. */
  537. TalentInfoInfoDlg.initFileTypeColumn = function () {
  538. return [
  539. {field: 'selectItem', checkbox: false, visible: false},
  540. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  541. formatter: function (value, row, index) {
  542. if (row.must == 1) {
  543. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  544. }
  545. if (row.must == 2) {
  546. return '<i class="fa fa-paste"></i>' + value;
  547. }
  548. }
  549. },
  550. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  551. formatter: function (value, row, index) {
  552. if (value == null || value == '' || value == 'null') {
  553. return '无';
  554. }
  555. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',5)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  556. "<i class=\"fa fa-download\"></i>下载" +
  557. "</button>";
  558. }
  559. },
  560. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  561. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  562. formatter: function (value, row, index) {
  563. var files = $("#files").val();
  564. var checkState = $("#checkState").val();
  565. var realState = $("#realState").val();
  566. 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)) {
  567. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this,'" + row.fState + "','" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  568. "<i class=\"fa fa-upload\"></i>上传" +
  569. "</button>";
  570. } else {
  571. return "";
  572. }
  573. }
  574. }
  575. ]
  576. };
  577. //回调
  578. TalentInfoInfoDlg.callBack = function (data) {
  579. layer.close(data.obj);
  580. Feng.info(data.msg);
  581. if (data.code == 200) {
  582. $("#fileTable").bootstrapTable("refresh", {});
  583. }
  584. }
  585. TalentInfoInfoDlg.downloadFile = function (id, type) {
  586. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type=" + type;
  587. }
  588. //设置不可修改的字段
  589. TalentInfoInfoDlg.setNoChangeField = function () {
  590. var checkState = $("#checkState").val();
  591. var fields = $("#fields").val();
  592. var realState = $("#realState").val();
  593. if (realState == 11 || realState == 4) {
  594. $("#photoImg").removeAttr("onclick");
  595. $("input,textarea").each(function () {
  596. $(this).attr("readonly", "readonly").css("pointer-events", "none");
  597. });
  598. $("select,input[type=radio]").each(function () {
  599. $(this).attr("disabled", "disabled");
  600. });
  601. if (fields != null && fields != '') {
  602. var arr = fields.split(",");
  603. for (var key in arr) {
  604. if (arr[key] == "headimgurl") {
  605. $("#photoImg").bind("click", function () {
  606. $("#photo").click();
  607. });
  608. continue;
  609. }
  610. if (arr[key] != "") {
  611. var name = $("#" + arr[key]).prop("tagName");
  612. if (name == 'select' || name == 'SELECT') {
  613. $("#" + arr[key]).removeAttr("disabled");
  614. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  615. $("#" + arr[key]).removeAttr("readonly").css("pointer-events", "initial");
  616. } else {
  617. if (typeof name == "undefined") {
  618. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly").css("pointer-events", "initial");
  619. }
  620. }
  621. }
  622. }
  623. }
  624. }
  625. }
  626. $("#card_type").change(function () {
  627. async_padding($("#card_number").val().trim(), $(this).val());
  628. })
  629. $("#card_number").blur(function () {
  630. async_padding($(this).val().trim(), $("#card_type").val());
  631. })
  632. function async_padding(card_number, card_type) {
  633. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  634. var year = card_number.substring(6, 10);
  635. var month = card_number.substring(10, 12);
  636. var day = card_number.substring(12, 14);
  637. var birthday = year + "-" + month + "-" + day;
  638. var rule = /\d{4}-\d{2}-\d{2}/;
  639. if (rule.test(birthday))
  640. $("#birthday").val(birthday);
  641. var num = card_number.substring(17, 1);
  642. if (num % 2 == 0) {
  643. $("#sex").val(2);
  644. } else {
  645. $("#sex").val(1);
  646. }
  647. }
  648. }
  649. TalentInfoInfoDlg.initTalentCondtion = "";
  650. $(function () {
  651. TalentInfoInfoDlg.initTalentCondtion = $("#talent_condition").attr("value");
  652. $('#talentInfoForm').bootstrapValidator({
  653. feedbackIcons: {
  654. valid: 'glyphicon glyphicon-ok',
  655. invalid: 'glyphicon glyphicon-remove',
  656. validating: 'glyphicon glyphicon-refresh'
  657. },
  658. container: 'tooltip',
  659. group: '.col',
  660. fields: TalentInfoInfoDlg.validateFields1,
  661. live: 'enabled',
  662. message: '该字段不能为空'
  663. }).on('error.field.bv', function (e, data) {
  664. // Get the tooltip
  665. var $parent = data.element.parents('.form-group-sm'),
  666. $icon = $parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]'),
  667. title = $icon.data('bs.tooltip').getTitle();
  668. $icon.tooltip('destroy').tooltip({
  669. html: true,
  670. placement: 'right',
  671. title: title,
  672. container: 'body'
  673. });
  674. });
  675. //批量加载字典表数据
  676. var arr = [
  677. {"name": "nation", "code": "nation"},
  678. {"name": "talent_arrange", "code": "talent_arrange"},
  679. {"name": "nationality", "code": "nationality"},
  680. {"name": "politics", "code": "politics"},
  681. {"name": "highest_degree", "code": "highest_degree"}];
  682. Feng.findChildDictBatch(JSON.stringify(arr));
  683. //批量加载时间控件
  684. $(".date").each(function () {
  685. laydate.render({
  686. elem: this
  687. , type: 'date'
  688. , trigger: 'click'
  689. });
  690. });
  691. $(".rangedate").each(function () {
  692. laydate.render({
  693. elem: this,
  694. type: "date",
  695. range: true,
  696. trigger: "click"
  697. })
  698. })
  699. $(".rangemonth").each(function () {
  700. laydate.render({
  701. elem: this,
  702. type: "month",
  703. range: true,
  704. trigger: "click"
  705. })
  706. })
  707. var id = $("#id").val();
  708. if (id != null && id != '') {
  709. $("select").each(function () {
  710. $(this).val($(this).attr("value")).trigger("change");
  711. });
  712. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  713. }
  714. TalentInfoInfoDlg.validId();
  715. $("#photo").change(function (e) {
  716. var tag = e.target;
  717. var file = tag.files[0];
  718. var imgSrc;
  719. var reader = new FileReader();
  720. reader.readAsDataURL(file);
  721. reader.onload = function () {
  722. imgSrc = this.result;
  723. $("#photoImg").attr("src", imgSrc);
  724. };
  725. });
  726. TalentInfoInfoDlg.changeStudyAbroad();
  727. TalentInfoInfoDlg.setNoChangeField();
  728. $("#talent_condition").on('chosen:ready', function (e, params) {
  729. $(".chosen-container-single .chosen-single").css("padding", "2px 0px 0px 4px");
  730. });
  731. $("#talent_condition").chosen({
  732. no_results_text: "没有找到结果!",
  733. width: '490px',
  734. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  735. disable_search: false,
  736. enable_split_word_search: true,
  737. rtl: true
  738. });
  739. TalentInfoInfoDlg.initFileTable();
  740. });