talentInfo_info.js 36 KB

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