talentInfo_info.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var step = $("#step").val();
  6. var TalentInfoInfoDlg = step == 1 ? {
  7. talentInfoInfoData: {},
  8. validateFields: {
  9. source_county: {validators: {notEmpty: {message: '入选来源县市区不能为空'}}},
  10. talent_type: {validators: {notEmpty: {message: '人才类型不能为空'}}},
  11. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  12. card_type: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  13. card_number: {
  14. validators: {
  15. notEmpty: {message: '证件号码不能为空'},
  16. regexp: {
  17. regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  18. message: "身份证号码格式不正确"
  19. }
  20. }
  21. },
  22. sex: {validators: {notEmpty: {message: '性别不能为空'}}},
  23. birthday: {validators: {notEmpty: {message: '出生日期不能为空'}}},
  24. nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
  25. province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
  26. city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
  27. nation: {validators: {notEmpty: {message: '民族不能为空'}}},
  28. politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
  29. experience: {validators: {notEmpty: {message: '工作简历不能为空'}}},
  30. education: {validators: {notEmpty: {message: '教育背景不能为空'}}}
  31. }
  32. } : {
  33. talentInfoInfoData: {},
  34. validateFields: {
  35. apply_year: {validators: {notEmpty: {message: '申报年度不能为空'}}},
  36. import_way: {validators: {notEmpty: {message: '引进方式不能为空'}}},
  37. cur_entry_time: {validators: {notEmpty: {message: '本单位入职时间不能为空'}}},
  38. position: {validators: {notEmpty: {message: '本单位现任职务不能为空'}}},
  39. source: {validators: {notEmpty: {message: '申报来源不能为空'}}},
  40. talent_arrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  41. talent_condition: {validators: {notEmpty: {message: '认定条件不能为空'}}},
  42. highest_degree: {validators: {notEmpty: {message: '最高学历不能为空'}}},
  43. graduate_school: {validators: {notEmpty: {message: '毕业院校不能为空'}}},
  44. major: {validators: {notEmpty: {message: '专业不能为空'}}},
  45. bank: {
  46. validators: {
  47. notEmpty: {
  48. message: '开户银行不能为空'
  49. },
  50. regexp: {
  51. regexp: /^[\u4e00-\u9fa5]*银行$/,
  52. message: "开户银行格式不正确"
  53. }
  54. }
  55. },
  56. bank_number: {
  57. validators: {
  58. notEmpty: {
  59. message: '银行行号不能为空'
  60. },
  61. regexp: {
  62. regexp: /^\d+$/,
  63. message: "银行行号格式不正确"
  64. }
  65. }
  66. },
  67. bank_branch_name: {
  68. validators: {
  69. notEmpty: {
  70. message: '开户银行网点不能为空'
  71. },
  72. regexp: {
  73. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  74. message: "开户银行格式不正确"
  75. }
  76. }
  77. },
  78. bank_account: {
  79. validators: {
  80. notEmpty: {
  81. message: '银行账号不能为空'
  82. },
  83. regexp: {
  84. regexp: /^\d+$/,
  85. message: "银行账号格式不正确"
  86. }
  87. }
  88. },
  89. phone: {
  90. validators: {
  91. notEmpty: {
  92. message: '手机号码不能为空'
  93. },
  94. regexp: {
  95. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  96. message: "手机号码格式不正确"
  97. }
  98. }
  99. },
  100. email: {
  101. validators: {
  102. notEmpty: {
  103. message: '电子邮箱不能为空'
  104. },
  105. emailAddress: {
  106. message: "电子邮箱格式不正确"
  107. }
  108. }
  109. }
  110. }
  111. };
  112. /**
  113. * 清除数据
  114. */
  115. TalentInfoInfoDlg.clearData = function () {
  116. this.talentInfoInfoData = {};
  117. }
  118. /**
  119. * 设置对话框中的数据
  120. *
  121. * @param key 数据的名称
  122. * @param val 数据的具体值
  123. */
  124. TalentInfoInfoDlg.set = function (key, val) {
  125. var dis = $("#" + key).attr("disabled");
  126. if (dis == "disabled") {
  127. $("#" + key).removeAttr("disabled");
  128. }
  129. this.talentInfoInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  130. if (dis == "disabled") {
  131. $("#" + key).prop("disabled", true);
  132. }
  133. return this;
  134. }
  135. /**
  136. * 设置对话框中的数据
  137. *
  138. * @param key 数据的名称
  139. * @param val 数据的具体值
  140. */
  141. TalentInfoInfoDlg.get = function (key) {
  142. return $("#" + key).val();
  143. }
  144. /**
  145. * 关闭此对话框
  146. */
  147. TalentInfoInfoDlg.close = function () {
  148. parent.layer.close(window.parent.TalentInfo.layerIndex);
  149. }
  150. /**
  151. * 收集数据
  152. */
  153. TalentInfoInfoDlg.collectData = function () {
  154. this
  155. .set('id')
  156. .set('type')
  157. .set('talent_type')
  158. .set('tax_insurance_month')
  159. .set('labor_contract_rangetime')
  160. .set('enterprise_id')
  161. .set('name')
  162. .set('photo')
  163. .set('card_type')
  164. .set('card_number')
  165. .set('sex')
  166. .set('birthday')
  167. .set('nationality')
  168. .set('province')
  169. .set('city')
  170. .set('county')
  171. .set('nation')
  172. .set('politics')
  173. .set('talent_arrange')
  174. .set('talent_condition')
  175. .set('highest_degree')
  176. .set('graduate_school')
  177. .set('major')
  178. .set('professional')
  179. .set('bank')
  180. .set('bank_number')
  181. .set('bank_branch_name')
  182. .set('bank_account')
  183. .set('study_abroad')
  184. .set('abroad_school')
  185. .set('abroad_major')
  186. .set('phone')
  187. .set('email')
  188. .set('apply_year')
  189. .set('import_way')
  190. .set('fst_work_time')
  191. .set('cur_entry_time')
  192. .set('position')
  193. .set('source')
  194. .set('fujian_highcert_pubtime')
  195. .set('fujian_highcert_exptime')
  196. .set('quanzhou_highcert_pubtime')
  197. .set('quanzhou_highcert_exptime');
  198. if ($("#province").val() != null && $("#province").val() != '') {
  199. this.talentInfoInfoData["province_name"] = $("#province").find("option:selected").text();
  200. }
  201. if ($("#city").val() != null && $("#city").val() != '') {
  202. this.talentInfoInfoData["city_name"] = $("#city").find("option:selected").text();
  203. }
  204. if ($("#county").val() != null && $("#county").val() != '') {
  205. this.talentInfoInfoData["county_name"] = $("#county").find("option:selected").text();
  206. }
  207. if ($("#source_city").val() != null && $("#source_city").val() != '') {
  208. this.talentInfoInfoData["source_city_name"] = $("#source_city").find("option:selected").text();
  209. }
  210. if ($("#source_county").val() != null && $("#source_county").val() != '') {
  211. this.talentInfoInfoData["source_county_name"] = $("#source_county").find("option:selected").text();
  212. }
  213. }
  214. /**
  215. * 验证数据
  216. */
  217. TalentInfoInfoDlg.validate = function () {
  218. $('#talentInfoForm').data("bootstrapValidator").resetForm();
  219. $('#talentInfoForm').bootstrapValidator('validate');
  220. return $("#talentInfoForm").data('bootstrapValidator').isValid();
  221. }
  222. /**
  223. * 初始化表格的列
  224. */
  225. TalentInfoInfoDlg.initFileTypeColumn = function () {
  226. return [
  227. {field: 'selectItem', checkbox: false, visible: false},
  228. {title: '名称', field: 'name', visible: true, align: 'left', valign: 'middle', width: "82%", 'class': 'uitd_showTip',
  229. formatter: function (value, row, index) {
  230. let str = '<div class="word-wrap">';
  231. if (row.must == 1) {
  232. str = str + '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  233. }
  234. if (row.must == 2) {
  235. str = str + '<i class="fa fa-paste"></i>' + value;
  236. }
  237. str = str + '<br /><span id="desc_' + row.rel + '">' + row.description + '</span></div>'
  238. return str;
  239. }
  240. },
  241. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  242. formatter: function (value, row, index) {
  243. if (value == null || value == '' || value == 'null') {
  244. return '无';
  245. }
  246. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  247. "<i class=\"fa fa-download\"></i>下载" +
  248. "</button>";
  249. }
  250. },
  251. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  252. formatter: function (value, row, index) {
  253. return row.step == 1 ? "" : TalentInfoInfoDlg.validUploadButton(1, value, '', row.tableIndex, row.trIndex);
  254. }
  255. }
  256. ]
  257. };
  258. TalentInfoInfoDlg.initFileTable = function () {
  259. var ajax = new $ax("/common/api/findCommonFileType", function (data) {
  260. if (data == null || data.length == 0) {
  261. return;
  262. }
  263. var datas = new Array();
  264. for (var i = 0; i < $(".fileTable").length; i++) {
  265. datas.push([]);//创建空的多维数组,等下用来存每个附件表的各自的列
  266. }
  267. var enterpriseTag = $("#enterprise_tag").val();
  268. for (var k in data["rows"]) {
  269. if (data["rows"][k].enterprise_tag != "" && data["rows"][k].enterprise_tag != null && data["rows"][k].enterprise_tag.indexOf(enterpriseTag) == -1) {
  270. continue;
  271. }
  272. var rel = data["rows"][k].rel;
  273. if ($("#" + rel).length > 0) {
  274. var tableIndex = 0;
  275. if ($("#" + rel).parents(".table").length > 0) {
  276. tableIndex = $("#" + rel).parents(".table").find("table.fileTable").index(".fileTable");
  277. } else {
  278. tableIndex = $("#" + rel).parents(".row").next(".row").find("table.fileTable").index(".fileTable");
  279. }
  280. data["rows"][k].tableIndex = tableIndex;
  281. data["rows"][k].trIndex = datas[tableIndex].length;
  282. datas[tableIndex].push(data["rows"][k]);
  283. if (data["rows"][k].option) {
  284. //指定了选项
  285. if (rel == "birthday") {
  286. let birthday = parseInt($("#" + rel).val().substring(0, 4));
  287. let currentYear = parseInt(new Date().getFullYear());
  288. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  289. if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
  290. data["rows"][k].hidden = true;
  291. } else {
  292. let selectVal = $("#" + rel).data("value").toString();
  293. let options = data["rows"][k].option.split(",");
  294. if (options.indexOf(selectVal) == -1) {
  295. data["rows"][k].hidden = true;
  296. }
  297. }
  298. }
  299. } else {
  300. if (data["rows"][k].isConditionFile) {
  301. var tableIndex = 0;
  302. if ($("#talent_condition").parents(".table").length > 0) {
  303. tableIndex = $("#talent_condition").parents(".table").find("table.fileTable").index(".fileTable");
  304. } else {
  305. tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
  306. }
  307. data["rows"][k].tableIndex = tableIndex;
  308. data["rows"][k].trIndex = datas[tableIndex].length;
  309. datas[tableIndex].push(data["rows"][k]);//放入人才条件后面的附件表
  310. } else {
  311. var tableIndex = $(".fileTable").length - 1;
  312. data["rows"][k].tableIndex = tableIndex;
  313. data["rows"][k].trIndex = datas[tableIndex].length;
  314. datas[$(".fileTable").length - 1].push(data["rows"][k]);//没有归属,放入最后一个附件表
  315. }
  316. }
  317. }
  318. for (var i = 0; i < $(".fileTable").length; i++) {
  319. var that = $(".fileTable").eq(i);
  320. that.bootstrapTable({
  321. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  322. data: datas[i],
  323. showHeader: false,
  324. rowStyle: function (row, index) {
  325. return {classes: ""};
  326. },
  327. onPostBody: function (data) {
  328. for (var k in data) {
  329. var files = data[k].files;
  330. var html = '<ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
  331. for (var key in files) {
  332. var btn = "";
  333. if (data[k].step != 1) {
  334. btn = TalentInfoInfoDlg.validUploadButton(2, data[k].id, files[key].id, i, k);
  335. }
  336. var sn = files[key].url.lastIndexOf(".");
  337. var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
  338. var imgStr = "";
  339. if (suffix == "pdf" || suffix == "PDF") {
  340. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  341. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  342. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  343. } else {
  344. imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
  345. }
  346. html += '<li data-id="' + files[key].id + '">\n\
  347. <div>' + (data[k].step != 1 ? '<input type="hidden" name="uploadFiles[]" value="' + files[key].id + '">' : "") + '</div>\n' +
  348. '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
  349. '<div style="width: 10%;">' + imgStr + '</div>\n' +
  350. '<div style="width: 20%;">' + btn + '</div>\n\
  351. </li>';
  352. }
  353. html = html + '</ul>';
  354. that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
  355. that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
  356. that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
  357. if (typeof data[k].hidden != "undefined") {
  358. that.find("tr[data-index='" + k + "']").css("display", "none");
  359. that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
  360. }
  361. }
  362. $("td.uitd_showTip").bind("mouseover", function () {
  363. var htm = $(this).html();
  364. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  365. });
  366. },
  367. });
  368. }
  369. }, function (data) {
  370. Feng.error("查询失败!" + data.responseJSON.message + "!");
  371. });
  372. var queryData = {};
  373. queryData["mainId"] = $("#id").val();
  374. queryData['project'] = CONFIG.project_rcrd;
  375. queryData["source"] = $("#source").val();
  376. queryData['type'] = $("#type").val();
  377. queryData["talent_condition"] = $("#talent_condition option:selected").val();
  378. queryData['checkState'] = $("#checkState").val();
  379. ajax.set(queryData);
  380. ajax.start();
  381. }
  382. /**
  383. * 提交添加
  384. */
  385. TalentInfoInfoDlg.addSubmit = function () {
  386. this.clearData();
  387. this.collectData();
  388. /*if (!TalentInfoInfoDlg.validate()) {
  389. return;
  390. }*/
  391. var id = $('#id').val();
  392. if (id != null && id != '') {
  393. if (!TalentInfoInfoDlg.validateIsEdit())
  394. return;
  395. }
  396. $("select").each(function () {
  397. $(this).removeAttr("disabled");
  398. });
  399. if (locked) {
  400. return;
  401. }
  402. locked = true;
  403. $("#talentInfoForm").attr("action", "/enterprise/talent/second");
  404. $("#talentInfoForm")[0].submit();
  405. }
  406. //回调
  407. TalentInfoInfoDlg.infoCallback = function (data) {
  408. locked = false;
  409. TalentInfoInfoDlg.setNoChangeField();
  410. Feng.info(data.msg);
  411. if (data.code == 200) {
  412. window.parent.TalentInfo.table.refresh();
  413. $("#id").val(data.obj.id);
  414. $("#fileLi").removeAttr("style");
  415. $("#checkState").val(data.obj.checkState);
  416. }
  417. }
  418. TalentInfoInfoDlg.getLayerCatdByLayer = function () {
  419. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  420. $("#talent_condition").html("<option>---请选择---</option>");
  421. $("#annual_salary").parents("td").css("display", "none");
  422. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  423. var level = $("#talent_arrange").val();
  424. Feng.addAjaxSelect({
  425. "id": "talent_arrange_category",
  426. "displayCode": "code",
  427. "displayName": "name",
  428. "type": "GET",
  429. "url": Feng.ctxPath + "/common/api/getLayerCatsByLayer/level/" + level
  430. });
  431. $("#talent_condition").trigger("chosen:updated");
  432. }
  433. /**
  434. * 获取人才认定
  435. */
  436. TalentInfoInfoDlg.getIdentifyCondition = function () {
  437. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  438. $("#annual_salary").parents("td").css("display", "none");
  439. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  440. var level = $("#talent_arrange").val();
  441. var cat = $("#talent_arrange_category").val();
  442. var id = $('#id').val();
  443. Feng.addAjaxSelect({
  444. "id": "talent_condition",
  445. "displayCode": "id",
  446. "displayName": "name",
  447. "type": "GET",
  448. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel/level/" + level + "/cat/" + cat + "/id/" + id
  449. });
  450. $("#talent_condition").trigger('chosen:updated');
  451. }
  452. TalentInfoInfoDlg.getIdentifyNeedsFileTypes = function () {
  453. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  454. $("#annual_salary").parents("td").css("display", "none");
  455. $('#talentInfoForm').bootstrapValidator('removeField', "annual_salary");
  456. var source = $("#source").val();
  457. if (source == "" || typeof source == "undefined") {
  458. layer.alert("请先选择申报来源");
  459. $("#talent_condition").val("");
  460. $("#talent_condition").trigger('chosen:updated');
  461. return;
  462. }
  463. TalentInfoInfoDlg.ajaxGetConditionFile(source);
  464. }
  465. TalentInfoInfoDlg.ajaxGetConditionFile = function (source) {
  466. var condition = $("#talent_condition option:selected").val();
  467. if (condition != "") {
  468. var ajax = new $ax("/common/api/getTalentCondtionUploadFile", function (data) {
  469. if (data == null || data.length == 0) {
  470. return;
  471. }
  472. if (typeof data.info != "undefined" && data.info.isSalary == 1) {
  473. $("#annual_salary").parents("td").css("display", "table-cell");
  474. $('#talentInfoForm').bootstrapValidator('addField', "annual_salary", {validators: {
  475. notEmpty: {message: '年薪不能放空'},
  476. callback: {
  477. message: "年薪只能填写数字",
  478. callback: function (value, validator) {
  479. if (!isNaN(value) && isFinite(value)) {
  480. return true;
  481. }
  482. return false;
  483. }
  484. }
  485. }
  486. });
  487. }
  488. if (source != "5") {
  489. return;
  490. }
  491. var conditionFileTable = $("#talent_condition").parents(".table").find(".fileTable");
  492. var tableIndex = conditionFileTable.index(".fileTable");
  493. var tbody = conditionFileTable.find("tbody");
  494. var html = "";
  495. for (var key in data.rows) {
  496. var filetype = data.rows[key];
  497. var name = "";
  498. if (filetype.must == 1) {
  499. name = '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + filetype.name;
  500. }
  501. if (filetype.must == 2) {
  502. name = '<i class="fa fa-paste"></i>' + filetype.name;
  503. }
  504. var uploadbtn = TalentInfoInfoDlg.validUploadButton(1, filetype.id, '', tableIndex, key);
  505. var templateUrl = '<button type="button" onclick="TalentInfoInfoDlg.downloadFile("' + filetype.id + '",3)" style="margin-right: 10px" class="btn btn-xs btn-primary">\n\
  506. <i class=\"fa fa-download\"></i>下载""</button>"';
  507. html += '<tr data-index="' + key + '">\n\
  508. <td class="uitd_showTip" style="text-align: center; vertical-align: middle; width: 30%; ">' + name + '</td> \n\
  509. <td style="text-align: center; vertical-align: middle; width: 8%; ">' + (filetype.templateUrl ? templateUrl : "无") + '</td> \n\
  510. <td class="uitd_showTip" style="text-align: center; vertical-align: middle; width: 52%; ">' + filetype.description + '</td> \n\
  511. <td style="text-align: center; vertical-align: middle; width: 10%; ">' + uploadbtn + '</td> </tr></tr>';
  512. html += '<tr class="detail-view"><td colspan="5"><ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
  513. for (var k in filetype.files) {
  514. var file = filetype.files[k];
  515. var btn = TalentInfoInfoDlg.validUploadButton(2, filetype.id, file.id, tableIndex, key);
  516. var sn = file.url.lastIndexOf(".");
  517. var suffix = file.ext;//file.url.substring(sn + 1, file.url.length);
  518. var imgStr = "";
  519. if (suffix == "pdf" || suffix == "PDF") {
  520. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + file.url + "','" + file.id + "','" + file.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  521. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  522. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + file.url + "','" + file.id + "','" + file.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  523. } else {
  524. imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + file.url + '\" style=\"width:25px;height:25px;\">';
  525. }
  526. html += '<li data-id="' + file.id + '">\n\
  527. <div>' + (filetype.step != 1 ? '<input type="hidden" name="uploadFiles[]" value="' + file.id + '">' : "") + '</div>\n' +
  528. '<div style="width: 80%;">' + file.orignName + '</div>\n' +
  529. '<div style="width: 10%;">' + imgStr + '</div>\n' +
  530. '<div style="width: 10%;">' + btn + '</div>\n\
  531. </li>';
  532. }
  533. html += '</ul></td></tr>';
  534. }
  535. tbody.html(html);
  536. }, function (data) {
  537. Feng.error("查询失败!" + data.responseJSON.message + "!");
  538. });
  539. var queryData = {};
  540. queryData["mainId"] = $("#id").val();
  541. queryData['project'] = CONFIG.project_rcrd;
  542. queryData["source"] = source;
  543. queryData['type'] = $("#type").val();
  544. queryData["talent_condition"] = condition;
  545. ajax.set(queryData);
  546. ajax.start();
  547. }
  548. }
  549. TalentInfoInfoDlg.bankChange = function () {
  550. var bank = $("#bank").val();
  551. if ($.trim(bank) == '中国工商银行') {
  552. $("#bank_number").val('102391050013');
  553. } else {
  554. $("#bank_number").val('');
  555. }
  556. }
  557. TalentInfoInfoDlg.changeStudyAbroad = function () {
  558. var is_abroad = $("#study_abroad").val();
  559. if (is_abroad == 1) {
  560. $("#abroad_school").parent().css("display", "block");
  561. $("#abroad_major").parent().css("display", "block");
  562. $('#talentInfoForm').bootstrapValidator('addField', "abroad_school", {validators: {notEmpty: {message: '留学毕业院校不能为空'}}});
  563. $('#talentInfoForm').bootstrapValidator('addField', "abroad_major", {validators: {notEmpty: {message: '留学专业不能为空'}}});
  564. $("[data-rel='study_abroad']").find("i.fa-paste").after('<span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span>');
  565. } else {
  566. $("#abroad_school").val("").parent().css("display", "none");
  567. $("#abroad_major").val("").parent().css("display", "none");
  568. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_school");
  569. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_major");
  570. $("[data-rel='study_abroad']").find("i.fa-paste").next("span").remove();
  571. }
  572. }
  573. TalentInfoInfoDlg.sourceChange = function () {
  574. var source = $("#source").val();
  575. $("#source_batch").val("").parent().css("display", "none");
  576. $(".fujian_highcert").css("display", "none");
  577. $(".quanzhou_highcert").css("display", "none");
  578. $("#source_city").val("").parent().css("display", "none");
  579. $("#source_county").val("").parent().css("display", "none");
  580. $('#talentInfoForm').bootstrapValidator('removeField', "source_batch");
  581. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_pubtime");
  582. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_exptime");
  583. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_pubtime");
  584. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_exptime");
  585. $('#talentInfoForm').bootstrapValidator('removeField', "source_city");
  586. $('#talentInfoForm').bootstrapValidator('removeField', "source_county");
  587. switch (source) {
  588. case "1":
  589. case "3":
  590. $("#source_batch").parent().css("display", "block");
  591. $(".fujian_highcert").css("display", "block");
  592. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  593. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_pubtime", {validators: {notEmpty: {message: '福建省高层次人才证书发证日期不能为空'}}});
  594. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_exptime", {validators: {notEmpty: {message: '福建省高层次人才证书有效期不能为空'}}});
  595. break;
  596. case "2":
  597. case "4":
  598. $("#source_batch").parent().css("display", "block");
  599. $(".quanzhou_highcert").css("display", "block");
  600. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  601. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_pubtime", {validators: {notEmpty: {message: '泉州高层次人才证书发证日期不能为空'}}});
  602. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_exptime", {validators: {notEmpty: {message: '泉州高层次人才证书有效期不能为空'}}});
  603. break;
  604. }
  605. if (source == 3) {
  606. //显示入选来源地级市除泉
  607. $("#source_city").parent().css("display", "block");
  608. Feng.addAjaxSelect({
  609. "id": "source_city",
  610. "displayCode": "code",
  611. "displayName": "name",
  612. "type": "GET",
  613. "url": "/common/tool/findChildAreaByCode/code/35/no/350500"
  614. });
  615. $('#talentInfoForm').bootstrapValidator('addField', "source_city", {validators: {notEmpty: {message: '入选来源地级市不能为空'}}});
  616. }
  617. if (source == 4) {
  618. //显示入选来源县市区除晋
  619. $("#source_county").parent().css("display", "block");
  620. Feng.addAjaxSelect({
  621. "id": "source_county",
  622. "displayCode": "code",
  623. "displayName": "name",
  624. "type": "GET",
  625. "url": "/common/tool/findChildAreaByCode/code/3505/no/350582"
  626. });
  627. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  628. }
  629. if (source != 5) {
  630. $("#talent_condition").parents(".table").find(".fileTable").find("tbody").html("");
  631. } else {
  632. TalentInfoInfoDlg.ajaxGetConditionFile(source);
  633. }
  634. }
  635. //校验是否保存基础信息
  636. TalentInfoInfoDlg.validId = function () {
  637. var id = $("#id").val();
  638. if (id != null && id != '') {
  639. $("#fileLi").removeAttr("style");
  640. } else {
  641. $("#fileLi").attr("style", "pointer-events: none");
  642. }
  643. }
  644. //选择附件并显示附件名
  645. TalentInfoInfoDlg.checkFile = function (content, fileTypeId, fileId, tableIndex, trIndex) {
  646. if (!TalentInfoInfoDlg.validateIsEdit())
  647. return;
  648. $("#upload_file").unbind("change");
  649. $("#upload_file").change(function () {
  650. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  651. return;
  652. TalentInfoInfoDlg.upload(fileTypeId, fileId, tableIndex, trIndex);
  653. });
  654. $('#upload_file').val("");
  655. $('#upload_file').click();
  656. }
  657. //上传附件
  658. TalentInfoInfoDlg.upload = function (fileTypeId, fileId, tableIndex, trIndex) {
  659. var id = $("#id").val();
  660. if (!TalentInfoInfoDlg.validateIsEdit())
  661. return;
  662. if (fileId != null && fileId != 'null') {
  663. $("#fileId").val(fileId)
  664. } else {
  665. $("#fileId").val("");
  666. }
  667. $("#mainId").val(id);
  668. $("#fileTypeId").val(fileTypeId);
  669. $("#tableIndex").val(tableIndex);
  670. $("#trIndex").val(trIndex);
  671. var index = layer.load(0, {shade: false, time: 0});
  672. $("#index").val(index);
  673. $("#uploadForm").submit();
  674. }
  675. //删除附件
  676. TalentInfoInfoDlg.deleteFile = function (id, state) {
  677. if (!TalentInfoInfoDlg.validateIsEdit())
  678. return;
  679. var operation = function () {
  680. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  681. if (data.code = 200) {
  682. Feng.success(data.msg);
  683. $("input[name='uploadFiles[]'][value='" + id + "']").parents("li").remove();
  684. //$("#fileTable").bootstrapTable("refresh", {});
  685. } else {
  686. Feng.error(data.msg);
  687. }
  688. }, function (data) {
  689. Feng.error("删除失败!" + data.responseJSON.message + "!");
  690. });
  691. ajax.set("id", id);
  692. ajax.set("type", 1);
  693. ajax.start();
  694. }
  695. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  696. }
  697. /**
  698. * 提交审核
  699. */
  700. TalentInfoInfoDlg.submitToCheck = function () {
  701. /*if (!TalentInfoInfoDlg.validate()) {
  702. return;
  703. }*/
  704. var id = $("#id").val();
  705. /*if (id == null || id == "") {
  706. Feng.info("请先填写基础信息并上传附件");
  707. return;
  708. }*/
  709. if (!TalentInfoInfoDlg.validateIsEdit())
  710. return;
  711. var operation = function () {
  712. TalentInfoInfoDlg.clearData();
  713. TalentInfoInfoDlg.collectData();
  714. /*if (!TalentInfoInfoDlg.validate()) {
  715. return;
  716. }*/
  717. var id = $('#id').val();
  718. if (id != null && id != '') {
  719. if (!TalentInfoInfoDlg.validateIsEdit())
  720. return;
  721. }
  722. $("select").each(function () {
  723. $(this).removeAttr("disabled");
  724. });
  725. if (locked) {
  726. return;
  727. }
  728. locked = true;
  729. $("#talentInfoForm").attr("action", "/enterprise/talent/submit");
  730. $("#talentInfoForm")[0].submit();
  731. return;
  732. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submit", function (data) {
  733. if (data.code == 200) {
  734. Feng.success(data.msg);
  735. // $("#checkState").val(data.obj);
  736. window.parent.TalentInfo.table.refresh();
  737. TalentInfoInfoDlg.close();
  738. } else {
  739. Feng.error(data.msg);
  740. }
  741. }, function (data) {
  742. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  743. });
  744. ajax.set("id", id);
  745. ajax.start();
  746. }
  747. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  748. }
  749. //回调
  750. TalentInfoInfoDlg.submitCallback = function (data) {
  751. locked = false;
  752. TalentInfoInfoDlg.setNoChangeField();
  753. if (data.code == 200) {
  754. Feng.success(data.msg);
  755. // $("#checkState").val(data.obj);
  756. window.parent.TalentInfo.table.refresh();
  757. TalentInfoInfoDlg.close();
  758. } else {
  759. Feng.error(data.msg);
  760. }
  761. }
  762. /**
  763. * 校验是否可以修改/提交审核
  764. */
  765. TalentInfoInfoDlg.validateIsEdit = function () {
  766. var checkState = $("#checkState").val();
  767. if (checkState != 0 && checkState != 1 && checkState != 3 && checkState != 5 && checkState != 8) {
  768. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  769. Feng.error("您的申报审核不通过,无法再修改");
  770. return false;
  771. } else if (checkState == 28) {
  772. Feng.error("申报已完成");
  773. return false;
  774. } else if (checkState == 14) {
  775. Feng.error("您的申报已审核通过,无法再修改");
  776. return false;
  777. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  778. Feng.error("该申报已终止");
  779. return false;
  780. } else {
  781. Feng.error("您的申报正在审核中,请耐心等待");
  782. return false;
  783. }
  784. }
  785. return true;
  786. }
  787. /**
  788. * 校验是否显示按钮
  789. * @param type 类型 1-上传按钮,2-修改删除按钮
  790. * @param row
  791. * @returns {string}
  792. */
  793. TalentInfoInfoDlg.validUploadButton = function (type, fileTypeId, fileId, tableIndex, trIndex) {
  794. var files = $("#files").val();
  795. files = files.split(",");
  796. var checkState = $("#checkState").val();
  797. var realState = $("#realState").val();
  798. console.log(checkState, realState);
  799. if (Feng.isEmptyStr(checkState) || checkState == 0 || checkState == 1 || checkState == 3 || (checkState == 5 && realState == 5) || (checkState == 8 && realState == 8) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(fileTypeId.toString()) != -1)) {
  800. if (type == 1) { //上传
  801. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + null + "," + tableIndex + "," + trIndex + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  802. "<i class=\"fa fa-upload\"></i>上传" +
  803. "</button>";
  804. } else {
  805. return "<button type=\'button\' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + fileId + "," + tableIndex + "," + trIndex + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  806. "<i class=\"fa fa-paste\"></i>修改" +
  807. "</button>" +
  808. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile(" + fileId + ")\" class=\"btn btn-xs btn-danger\">" +
  809. "<i class=\"fa fa-times\"></i>删除" +
  810. "</button>";
  811. }
  812. } else {
  813. return type == 1 ? "" : "";
  814. }
  815. }
  816. //回调
  817. TalentInfoInfoDlg.callBack = function (data) {
  818. layer.close(data.obj);
  819. Feng.info(data.msg);
  820. if (data.code == 200) {
  821. var tableIndex = $("#tableIndex").val();
  822. var trIndex = $("#trIndex").val();
  823. var sn = data.info.lastIndexOf(".");
  824. var suffix = data.ext;//data.info.substring(sn + 1, data.info.length);
  825. var imgStr = "";
  826. if (suffix == "pdf" || suffix == "PDF") {
  827. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  828. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  829. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  830. } else {
  831. imgStr = '<img class="imgUrl" src="' + data.info + '" style="width:25px;height:25px;">';
  832. }
  833. var li = $("input[name='uploadFiles[]'][value='" + data.id + "'").parents("li");
  834. if (li.length > 0) {
  835. li.find("div").eq(1).html(data.orignName);
  836. li.find("div").eq(2).html(imgStr);
  837. } else {
  838. var html = '<li data-id="' + data.id + '">\n\
  839. <div><input type="hidden" name="uploadFiles[]" value="' + data.id + '"></div>\n\
  840. <div style="width: 70%;">' + data.orignName + '</div>\n\
  841. <div style="width: 10%;">' + imgStr + '</div>\n\
  842. <div style="width: 20%;">\n\
  843. <button type="button" onclick="TalentInfoInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ',' + tableIndex + ',' + trIndex + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
  844. <button type="button" onclick="TalentInfoInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
  845. </div></li></ul>';
  846. $(".fileTable").eq(tableIndex).find("tr[data-index='" + trIndex + "']").next("tr.detail-view").find(".imgs").append(html);
  847. }
  848. }
  849. }
  850. TalentInfoInfoDlg.downloadFile = function (id, type) {
  851. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type=" + type;
  852. }
  853. //设置不可修改的字段
  854. TalentInfoInfoDlg.setNoChangeField = function () {
  855. var checkState = $("#checkState").val();
  856. var fields = $("#fields").val();
  857. var realState = $("#realState").val();
  858. if (realState == 11) {
  859. $("input,textarea").each(function () {
  860. $(this).attr("readonly", "readonly");
  861. });
  862. $("select").each(function () {
  863. $(this).attr("disabled", "disabled");
  864. });
  865. if (fields != null && fields != '') {
  866. var arr = fields.split(",");
  867. for (var key in arr) {
  868. var name = $("#" + arr[key]).prop("tagName");
  869. if (name == 'select' || name == 'SELECT') {
  870. $("#" + arr[key]).removeAttr("disabled");
  871. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  872. $("#" + arr[key]).removeAttr("readonly");
  873. } else {
  874. if (name == "undefined") {
  875. $("input[name=" + arr[key] + "]").removeAttr("disabled");
  876. }
  877. }
  878. }
  879. }
  880. }
  881. }
  882. TalentInfoInfoDlg.__initValidateCondition = function () {
  883. var step = $("#step").val();
  884. if (step == 1) {
  885. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  886. $('#talentInfoForm').bootstrapValidator('addField', "talent_type", {validators: {notEmpty: {message: '人才类型不能为空'}}});
  887. $('#talentInfoForm').bootstrapValidator('addField', "name", {validators: {notEmpty: {message: '姓名不能为空'}}});
  888. $('#talentInfoForm').bootstrapValidator('addField', "card_type", {validators: {notEmpty: {message: '证件类型不能为空'}}});
  889. $('#talentInfoForm').bootstrapValidator('addField', "card_number", {validators: {notEmpty: {message: '证件号码不能为空'}}});
  890. $('#talentInfoForm').bootstrapValidator('addField', "sex", {validators: {notEmpty: {message: '性别不能为空'}}});
  891. $('#talentInfoForm').bootstrapValidator('addField', "birthday", {validators: {notEmpty: {message: '出生日期不能为空'}}});
  892. $('#talentInfoForm').bootstrapValidator('addField', "nationality", {validators: {notEmpty: {message: '国籍/地区不能为空'}}});
  893. $('#talentInfoForm').bootstrapValidator('addField', "province", {validators: {notEmpty: {message: '户籍省份不能为空'}}});
  894. $('#talentInfoForm').bootstrapValidator('addField', "city", {validators: {notEmpty: {message: '户籍市不能为空'}}});
  895. $('#talentInfoForm').bootstrapValidator('addField', "nation", {validators: {notEmpty: {message: '民族不能为空'}}});
  896. $('#talentInfoForm').bootstrapValidator('addField', "politics", {validators: {notEmpty: {message: '政治面貌不能为空'}}});
  897. } else {
  898. $('#talentInfoForm').bootstrapValidator('addField', "apply_year", {validators: {notEmpty: {message: '申报年度不能为空'}}});
  899. $('#talentInfoForm').bootstrapValidator('addField', "import_way", {validators: {notEmpty: {message: '引进方式不能为空'}}});
  900. $('#talentInfoForm').bootstrapValidator('addField', "cur_entry_time", {validators: {notEmpty: {message: '本单位入职时间不能为空'}}});
  901. $('#talentInfoForm').bootstrapValidator('addField', "position", {validators: {notEmpty: {message: '本单位现任职务不能为空'}}});
  902. $('#talentInfoForm').bootstrapValidator('addField', "source", {validators: {notEmpty: {message: '申报来源不能为空'}}});
  903. $('#talentInfoForm').bootstrapValidator('addField', "talent_arrange", {validators: {notEmpty: {message: '人才层次不能为空'}}});
  904. $('#talentInfoForm').bootstrapValidator('addField', "talent_condition", {validators: {notEmpty: {message: '认定条件不能为空'}}});
  905. $('#talentInfoForm').bootstrapValidator('addField', "highest_degree", {validators: {notEmpty: {message: '最高学历不能为空'}}});
  906. $('#talentInfoForm').bootstrapValidator('addField', "graduate_school", {validators: {notEmpty: {message: '毕业院校不能为空'}}});
  907. $('#talentInfoForm').bootstrapValidator('addField', "major", {validators: {notEmpty: {message: '专业不能为空'}}});
  908. $('#talentInfoForm').bootstrapValidator('addField', "bank", {
  909. validators: {
  910. notEmpty: {
  911. message: '开户银行不能为空'
  912. },
  913. regexp: {
  914. regexp: /^[\u4e00-\u9fa5]*银行$/,
  915. message: "开户银行格式不正确"
  916. }
  917. }
  918. });
  919. $('#talentInfoForm').bootstrapValidator('addField', "bank_number", {
  920. validators: {
  921. notEmpty: {
  922. message: '银行行号不能为空'
  923. },
  924. regexp: {
  925. regexp: /^\d+$/,
  926. message: "银行行号格式不正确"
  927. }
  928. }
  929. });
  930. $('#talentInfoForm').bootstrapValidator('addField', "bank_branch_name", {
  931. validators: {
  932. notEmpty: {
  933. message: '开户银行网点不能为空'
  934. },
  935. regexp: {
  936. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  937. message: "开户银行格式不正确"
  938. }
  939. }
  940. });
  941. $('#talentInfoForm').bootstrapValidator('addField', "bank_account", {
  942. validators: {
  943. notEmpty: {
  944. message: '银行账号不能为空'
  945. },
  946. regexp: {
  947. regexp: /^\d+$/,
  948. message: "银行账号格式不正确"
  949. }
  950. }
  951. });
  952. $('#talentInfoForm').bootstrapValidator('addField', "phone", {
  953. validators: {
  954. notEmpty: {
  955. message: '手机号码不能为空'
  956. },
  957. regexp: {
  958. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  959. message: "手机号码格式不正确"
  960. }
  961. }
  962. });
  963. $('#talentInfoForm').bootstrapValidator('addField', "email", {
  964. validators: {
  965. notEmpty: {
  966. message: '电子邮箱不能为空'
  967. },
  968. emailAddress: {
  969. message: "电子邮箱格式不正确"
  970. }
  971. }
  972. });
  973. }
  974. }
  975. $("#card_type").change(function () {
  976. async_padding($("#card_number").val().trim(), $(this).val());
  977. })
  978. $("#card_number").blur(function () {
  979. async_padding($(this).val().trim(), $("#card_type").val());
  980. })
  981. function async_padding(card_number, card_type) {
  982. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  983. var year = card_number.substring(6, 10);
  984. var month = card_number.substring(10, 12);
  985. var day = card_number.substring(12, 14);
  986. var birthday = year + "-" + month + "-" + day;
  987. var rule = /\d{4}-\d{2}-\d{2}/;
  988. if (rule.test(birthday))
  989. $("#birthday").val(birthday);
  990. var num = card_number.substring(17, 1);
  991. if (num % 2 == 0) {
  992. $("#sex").val(2);
  993. } else {
  994. $("#sex").val(1);
  995. }
  996. }
  997. }
  998. $(function () {
  999. //Feng.initValidatorTip("talentInfoForm", TalentInfoInfoDlg.validateFields);
  1000. var id = $("#id").val();
  1001. var checkState = $("#checkState").val();
  1002. //批量加载字典表数据
  1003. var arr = [
  1004. {"name": "talent_arrange", "code": "talent_arrange"},
  1005. {"name": "highest_degree", "code": "highest_degree"},
  1006. {"name": "source", "code": "source"},
  1007. {"name": "import_way", "code": "import_way"}];
  1008. Feng.findChildDictBatch(JSON.stringify(arr))
  1009. //批量加载时间控件
  1010. $(".date").each(function () {
  1011. laydate.render({
  1012. elem: this
  1013. , type: 'date'
  1014. , trigger: 'click'
  1015. });
  1016. });
  1017. $(".rangedate").each(function () {
  1018. laydate.render({
  1019. elem: this,
  1020. type: "date",
  1021. range: true,
  1022. trigger: "click"
  1023. })
  1024. })
  1025. if (id != null && id != '') {
  1026. //select初始化
  1027. $("#highest_degree").val($("#highest_degree").attr("value")).trigger("change");
  1028. $("#import_way").val($("#import_way").attr("value")).trigger("change");
  1029. $("#source").val($("#source").attr("value")).trigger("change");
  1030. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  1031. }
  1032. $("#source_batch").val($("#source_batch").attr("value"));
  1033. $("#source_city").val($("#source_city").attr("value"));
  1034. $("#source_county").val($("#source_county").attr("value"));
  1035. $("#quanzhou_highcert_pubtime").val($("#quanzhou_highcert_pubtime").attr("value"));
  1036. $("#quanzhou_highcert_exptime").val($("#quanzhou_highcert_exptime").attr("value"));
  1037. $("#fujian_highcert_pubtime").val($("#fujian_highcert_pubtime").attr("value"));
  1038. $("#fujian_highcert_exptime").val($("#fujian_highcert_exptime").attr("value"));
  1039. $("#talent_type").val($("#talent_type").attr("value"));
  1040. $("#card_type").val($("#card_type").attr("value"));
  1041. $("#sex").val($("#sex").attr("value"));
  1042. $("#enterprise_tag").val($("#enterprise_tag").attr("value"));
  1043. $("#address").val($("#address").attr("value"));
  1044. $("#nation").val($("#nation").attr("value"));
  1045. $("#nationality").val($("#nationality").attr("value"));
  1046. $("#industry_field").val($("#industry_field").attr("value"));
  1047. $("#province").val($("#province").attr("value"));
  1048. $("#city").val($("#city").attr("value"));
  1049. $("#county").val($("#county").attr("value"));
  1050. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  1051. TalentInfoInfoDlg.getLayerCatdByLayer();
  1052. $("#talent_arrange_category").val($("#talent_arrange_category").attr("value"));
  1053. TalentInfoInfoDlg.getIdentifyCondition();
  1054. $("#politics").val($("#politics").attr("value"));
  1055. TalentInfoInfoDlg.validId();
  1056. $("#photo").change(function (e) {
  1057. var tag = e.target;
  1058. var file = tag.files[0];
  1059. var imgSrc;
  1060. var reader = new FileReader();
  1061. reader.readAsDataURL(file);
  1062. reader.onload = function () {
  1063. imgSrc = this.result;
  1064. $("#photoImg").attr("src", imgSrc);
  1065. };
  1066. });
  1067. TalentInfoInfoDlg.setNoChangeField();
  1068. $("#talent_condition").on('chosen:ready', function (e, params) {
  1069. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  1070. });
  1071. $("#talent_condition").val($("#talent_condition").attr("value"));
  1072. $("#talent_condition").chosen({
  1073. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  1074. disable_search: false,
  1075. width: "100%",
  1076. enable_split_word_search: true,
  1077. rtl: true
  1078. });
  1079. if ($("#annual_salary").val() != "") {
  1080. $("#annual_salary").parents("td").css("display", "table-cell");
  1081. $('#talentInfoForm').bootstrapValidator('addField', "annual_salary", {validators: {
  1082. notEmpty: {message: '年薪不能放空'},
  1083. callback: {
  1084. message: "年薪只能填写数字",
  1085. callback: function (value, validator) {
  1086. if (!isNaN(value) && isFinite(value)) {
  1087. return true;
  1088. }
  1089. return false;
  1090. }
  1091. }
  1092. }
  1093. });
  1094. }
  1095. TalentInfoInfoDlg.initFileTable();
  1096. var is_abroad = $("#study_abroad").val();
  1097. if (is_abroad == "1") {
  1098. TalentInfoInfoDlg.changeStudyAbroad();
  1099. }
  1100. });