talentInfo_info.js 41 KB

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