talentInfo_info.js 34 KB

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