talentInfo_gj_info.js 33 KB

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