talentInfo_ic_info.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var TalentInfoInfoDlg = {
  6. talentInfoInfoData : {},
  7. validateFields: {
  8. enterpriseId: {validators: {notEmpty: {message: '所属企业不能为空' }}},
  9. companyName :{validators: {notEmpty: {message: '所属企业不能为空' }}},
  10. type : {validators: {notEmpty: {message: '人才类别不能为空' }}},
  11. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  12. nation: {validators: {notEmpty: {message: '民族不能为空'}}},
  13. provinceCode: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
  14. cityCode: {validators: {notEmpty: {message: '户籍市不能为空'}}},
  15. address: {validators: {notEmpty: {message: '现居地址不能为空'}}},
  16. highEducation: {validators: {notEmpty: {message: '最高学历不能为空'}}},
  17. major: {validators: {notEmpty: {message: '专业不能为空'}}},
  18. phone: {
  19. validators: {
  20. notEmpty: {
  21. message: '手机号码不能为空'
  22. },
  23. regexp :{
  24. regexp:/0?(13|14|15|17|18|19)[0-9]{9}/,
  25. message:"手机号码格式不正确"
  26. }
  27. }
  28. },
  29. bank: {
  30. validators: {
  31. notEmpty: {
  32. message: '开户银行不能为空'
  33. },
  34. regexp :{
  35. regexp: /^[\u4e00-\u9fa5]*银行$/,
  36. message:"开户银行格式不正确"
  37. }
  38. }
  39. },
  40. bankAccount: {validators: {notEmpty: {message: '银行账号不能为空'}}},
  41. entryTime: {validators: {notEmpty: {message: '入职时间不能为空'}}},
  42. endTime: {validators: {notEmpty: {message: '工作合同结束时间不能为空'}}},
  43. identifyCondition: {validators: {notEmpty: {message: '认定条件不能为空'}}},
  44. identifyConditionName: {validators: {notEmpty: {message: '认定条件名称不能为空'}}},
  45. type: {validators: {notEmpty: {message: '人才类别不能为空'}}},
  46. cardType:{validators:{notEmpty:{message:'证件类型不能为空'}}},
  47. idCard: {validators: {notEmpty: {message: '证件号码不能为空'}}},
  48. sex: {validators: {notEmpty: {message: '性别不能为空'}}},
  49. nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
  50. birthday: {validators: {notEmpty: {message: '出生日期不能为空'}}},
  51. politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
  52. graduateSchool: {validators: {notEmpty: {message: '毕业学校不能为空'}}},
  53. post: {validators: {notEmpty: {message: '职务不能为空'}}},
  54. email: {
  55. validators: {
  56. notEmpty: {
  57. message: '电子邮箱不能为空'
  58. },
  59. emailAddress:{
  60. message:"电子邮箱格式不正确"
  61. }
  62. }
  63. },
  64. bankNetwork:{
  65. validators: {
  66. notEmpty: {
  67. message: '开户银行网点不能为空'
  68. },
  69. regexp :{
  70. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  71. message:"开户银行格式不正确"
  72. }
  73. }
  74. },
  75. introductionMode:{
  76. validators: {
  77. notEmpty: {
  78. message: '引进方式不能为空'
  79. }
  80. }
  81. },
  82. startTime: {validators: {notEmpty: {message: '工作合同开始时间不能为空'}}},
  83. talentArrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  84. identifyGetTime: {validators: {notEmpty: {message: '认定条件证书取得时间不能为空'}}},
  85. breakFaith: {validators: {notEmpty: {message: '是否曾被相关主管部门列为失信个人不能为空'}}},
  86. mainHonours: {validators: {notEmpty: {message: '主要业绩及取得的荣誉不能为空'}}},
  87. educationAndResume: {validators: {notEmpty: {message: '教育背景及工作简历不能为空'}}}
  88. }
  89. };
  90. /**
  91. * 清除数据
  92. */
  93. TalentInfoInfoDlg.clearData = function() {
  94. this.talentInfoInfoData = {};
  95. }
  96. /**
  97. * 设置对话框中的数据
  98. *
  99. * @param key 数据的名称
  100. * @param val 数据的具体值
  101. */
  102. TalentInfoInfoDlg.set = function(key, val) {
  103. this.talentInfoInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  104. return this;
  105. }
  106. /**
  107. * 设置对话框中的数据
  108. *
  109. * @param key 数据的名称
  110. * @param val 数据的具体值
  111. */
  112. TalentInfoInfoDlg.get = function(key) {
  113. return $("#" + key).val();
  114. }
  115. /**
  116. * 关闭此对话框
  117. */
  118. TalentInfoInfoDlg.close = function() {
  119. parent.layer.close(window.parent.TalentInfo.layerIndex);
  120. }
  121. /**
  122. * 收集数据
  123. */
  124. TalentInfoInfoDlg.collectData = function() {
  125. this
  126. .set('id')
  127. .set('enterpriseId')
  128. .set('type')
  129. .set('idCard')
  130. .set('cardType')
  131. .set('name')
  132. .set('sex')
  133. .set('nation')
  134. .set('nationality')
  135. .set('provinceCode')
  136. .set('cityCode')
  137. .set('countyCode')
  138. .set('birthday')
  139. .set('address')
  140. .set('politics')
  141. .set('highEducation')
  142. .set('graduateSchool')
  143. .set('major')
  144. .set('post')
  145. .set('phone')
  146. .set('email')
  147. .set('bank')
  148. .set('bankNetwork')
  149. .set('bankAccount')
  150. .set('bankNumber')
  151. .set('entryTime')
  152. .set('startTime')
  153. .set('endTime')
  154. .set('talentArrange')
  155. .set('identifyCondition')
  156. .set('identifyGetTime')
  157. .set('identifyConditionName')
  158. .set('breakFaith')
  159. .set('educationAndResume')
  160. .set('mainHonours')
  161. .set('industryField')
  162. .set('title')
  163. .set('professionalQualifications')
  164. .set('studyAbroad')
  165. .set('studyAbroadCountry')
  166. .set('studyAbroadTime')
  167. .set('description');
  168. this.talentInfoInfoData["provinceName"] = $("#provinceCode").find("option:selected").text();
  169. this.talentInfoInfoData["cityName"] = $("#cityCode").find("option:selected").text();
  170. this.talentInfoInfoData["countyName"] = $("#countyCode").find("option:selected").text();
  171. }
  172. /**
  173. * 验证数据
  174. */
  175. TalentInfoInfoDlg.validate = function () {
  176. $('#talentInfoForm').data("bootstrapValidator").resetForm();
  177. $('#talentInfoForm').bootstrapValidator('validate');
  178. return $("#talentInfoForm").data('bootstrapValidator').isValid();
  179. }
  180. /**
  181. * 提交添加
  182. */
  183. TalentInfoInfoDlg.addSubmit = function() {
  184. this.clearData();
  185. this.collectData();
  186. if(!TalentInfoInfoDlg.validate()){
  187. return ;
  188. }
  189. var id = $('#id').val();
  190. $("#provinceName").val($("#provinceCode").find("option:selected").text());
  191. $("#cityName").val($("#cityCode").find("option:selected").text());
  192. if($("#countyCode").val()!=null && $("#countyCode").val()!=''){
  193. $("#countyName").val($("#countyCode").find("option:selected").text());
  194. }
  195. if(id!=null && id!=''){
  196. if(!TalentInfoInfoDlg.validateIsEdit())return;
  197. }
  198. $("select").each(function () {
  199. $(this).removeAttr("disabled");
  200. });
  201. if(locked){
  202. return ;
  203. }
  204. locked = true;
  205. $("#talentInfoForm")[0].submit();
  206. }
  207. //回调
  208. TalentInfoInfoDlg.infoCallback = function (data){
  209. locked = false;
  210. TalentInfoInfoDlg.setNoChangeField();
  211. Feng.info(data.msg);
  212. if (data.code == 200) {
  213. window.parent.TalentInfo.table.refresh();
  214. $("#id").val(data.obj.id);
  215. $("#fileLi").removeAttr("style");
  216. $("#checkState").val(data.obj.checkState);
  217. }
  218. }
  219. /**
  220. * 获取人才认定
  221. */
  222. TalentInfoInfoDlg.getIdentifyCondition = function() {
  223. var level = $("#talentArrange").val();
  224. var type = $("#type").val();
  225. if(level==null||level==''){
  226. $("#identifyCondition").empty();
  227. $("#identifyCondition").trigger('chosen:updated');
  228. return;
  229. }
  230. if(type==null||type==''){
  231. Feng.info("请先选择人才类别");
  232. return ;
  233. }
  234. Feng.addAjaxSelect({
  235. "id": "identifyCondition",
  236. "displayCode": "id",
  237. "displayName": "name",
  238. "type": "GET",
  239. "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level+"&type="+type
  240. });
  241. $("#identifyCondition").trigger('chosen:updated');
  242. }
  243. TalentInfoInfoDlg.bankChange = function () {
  244. var bank = $("#bank").val();
  245. if($.trim(bank)=='中国工商银行'){
  246. $("#bankNumber").val('102391050013');
  247. }else {
  248. $("#bankNumber").val('');
  249. }
  250. }
  251. /**
  252. * 加载市
  253. */
  254. TalentInfoInfoDlg.afterSelectProvince = function () {
  255. var province = $("#provinceCode").val();
  256. $("#cityCode").empty();
  257. $("#countyCode").empty();
  258. if(province==null||province==''){
  259. return;
  260. }
  261. Feng.addAjaxSelect({
  262. "id": "cityCode",
  263. "displayCode": "code",
  264. "displayName": "name",
  265. "type": "GET",
  266. "url": Feng.ctxPath + "/api/commonLocation/findCityByProvinceSelect/"+province
  267. });
  268. }
  269. /**
  270. * 加载县
  271. */
  272. TalentInfoInfoDlg.afterSelectCity = function (){
  273. var city = $("#cityCode").val();
  274. $("#countyCode").empty();
  275. if(city==null||city==''){
  276. return;
  277. }
  278. Feng.addAjaxSelect({
  279. "id": "countyCode",
  280. "displayCode": "code",
  281. "displayName": "name",
  282. "type": "GET",
  283. "url": Feng.ctxPath + "/api/commonLocation/findCountyByCitySelect/"+city
  284. });
  285. }
  286. //初始化附件类别表单
  287. TalentInfoInfoDlg.initFileTable = function (){
  288. var queryData = {};
  289. queryData['project'] = CONFIG.project_rcrd;
  290. queryData['type'] = $("#type").val();
  291. $("#fileTable").bootstrapTable({
  292. url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
  293. method: 'POST',
  294. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  295. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  296. showRefresh: false, // 是否显示刷新按钮
  297. clickToSelect: true, // 是否启用点击选中行
  298. singleSelect: true, // 设置True 将禁止多选
  299. striped: true, // 是否显示行间隔色
  300. escape: true,
  301. pagination: false, // 设置为 true 会在表格底部显示分页条
  302. paginationHAlign: "left",
  303. paginationDetailHAlign: "right",
  304. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  305. showColumns: false,
  306. detailView: true, //是否显示父子表
  307. pageList: [10, 30, 50],
  308. queryParams: function (params) {
  309. return $.extend(queryData,params)
  310. },
  311. rowStyle: function (row, index) {
  312. return {classes:"info"};
  313. },
  314. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  315. onPostBody: function () {
  316. $("td.uitd_showTip").bind("mouseover", function () {
  317. var htm = $(this).html();
  318. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  319. });
  320. },
  321. onLoadSuccess: function (data) {
  322. $("#fileTable").bootstrapTable('expandAllRows');
  323. },
  324. onExpandRow: function (index, row, $detail) {
  325. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/listTalentFile", function (data) {
  326. if(data==null||data.length==0){
  327. return;
  328. }
  329. 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>';
  330. var files = $("#files").val();
  331. var checkState = $("#checkState").val();
  332. for(var key in data){
  333. var btn = "";
  334. if(checkState!=10 || (checkState==10 && files.indexOf(row.id)!=-1)){
  335. 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\">" +
  336. "<i class=\"fa fa-paste\"></i>修改" +
  337. "</button>" +
  338. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile('"+data[key].id+"','"+row.fState+"')\" class=\"btn btn-xs btn-danger\">" +
  339. "<i class=\"fa fa-times\"></i>删除" +
  340. "</button>";
  341. }else{
  342. btn = "";
  343. }
  344. var sn = data[key].url.lastIndexOf(".");
  345. var suffix = data[key].url.substring(sn+1,data[key].url.length);
  346. var imgStr = "";
  347. if(suffix=="pdf"||suffix=="PDF"){
  348. 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>";
  349. }else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
  350. 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>";
  351. }else{
  352. imgStr = '<img class=\"imgUrl\" src=\"'+data[key].url+'\" style=\"width:25px;height:25px;\">';
  353. }
  354. html = html + '<li style="display: none">'+data[key].id+'</li>\n'+
  355. '<li style="width: 80%;padding-top: 5px;">'+data[key].orignName+'</li>\n'+
  356. '<li style="width: 10%;">'+imgStr+'</li>\n'+
  357. '<li style="width: 10%;padding-top: 2px;">'+btn+'</li>';
  358. }
  359. html = html + '</ul>';
  360. $detail.html(html);
  361. $(".imgs").viewer({ fullscreen:false});
  362. }, function (data) {
  363. Feng.error("查询失败!" + data.responseJSON.message + "!");
  364. });
  365. var queryData = {};
  366. queryData["mainId"] = $("#id").val();
  367. queryData["fileTypeId"] = row.id;
  368. ajax.set(queryData);
  369. ajax.start();
  370. }
  371. });
  372. }
  373. //校验是否保存基础信息
  374. TalentInfoInfoDlg.validId = function (){
  375. var id = $("#id").val();
  376. if(id!=null && id!=''){
  377. $("#fileLi").removeAttr("style");
  378. }else{
  379. $("#fileLi").attr("style","pointer-events: none");
  380. }
  381. }
  382. //选择附件并显示附件名
  383. TalentInfoInfoDlg.checkFile = function (content,state,fileTypeId,fileId){
  384. if(!TalentInfoInfoDlg.validateIsEdit())return;
  385. $("#upload_file ").unbind("change");
  386. $("#upload_file ").change(function () {
  387. TalentInfoInfoDlg.upload(fileTypeId,fileId);
  388. });
  389. $('#upload_file').val("");
  390. $('#upload_file').click()
  391. }
  392. //上传附件
  393. TalentInfoInfoDlg.upload = function (fileTypeId,fileId){
  394. var id = $("#id").val();
  395. if(id==null || id==''){
  396. Feng.info("请先添加基本信息并保存后再试");
  397. return ;
  398. }
  399. if(!TalentInfoInfoDlg.validateIsEdit())return;
  400. if(fileId!=null&&fileId!='null'){
  401. $("#fileId").val(fileId)
  402. }else{
  403. $("#fileId").val("");
  404. }
  405. $("#mainId").val(id);
  406. $("#fileTypeId").val(fileTypeId);
  407. var index = layer.load(0, {shade: false,time:0});
  408. $("#index").val(index);
  409. $("#uploadForm").submit();
  410. }
  411. //删除附件
  412. TalentInfoInfoDlg.deleteFile = function (id,state){
  413. if(!TalentInfoInfoDlg.validateIsEdit())return;
  414. var operation = function() {
  415. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/deleteFile", function (data) {
  416. if(data.code=200){
  417. Feng.success(data.msg);
  418. $("#fileTable").bootstrapTable("refresh", {});
  419. }else{
  420. Feng.error(data.msg);
  421. }
  422. }, function (data) {
  423. Feng.error("删除失败!" + data.responseJSON.message + "!");
  424. });
  425. ajax.set("id", id);
  426. ajax.set("type",1);
  427. ajax.start();
  428. }
  429. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  430. }
  431. /**
  432. * 提交审核
  433. */
  434. TalentInfoInfoDlg.submitToCheck = function(){
  435. var id = $("#id").val();
  436. if(id==null || id==""){
  437. Feng.info("请先填写基础信息并上传附件");
  438. return ;
  439. }
  440. if(!TalentInfoInfoDlg.validateIsEdit())return;
  441. var operation = function() {
  442. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/submitToCheck", function (data) {
  443. if(data.code==200){
  444. Feng.success(data.msg);
  445. // $("#checkState").val(data.obj);
  446. window.parent.TalentInfo.table.refresh();
  447. TalentInfoInfoDlg.close();
  448. }else{
  449. Feng.error(data.msg);
  450. }
  451. }, function (data) {
  452. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  453. });
  454. ajax.set("id", id);
  455. ajax.start();
  456. }
  457. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  458. }
  459. /**
  460. * 校验是否可以修改/提交审核
  461. */
  462. TalentInfoInfoDlg.validateIsEdit = function (){
  463. var checkState = $("#checkState").val();
  464. if(checkState != 1 && checkState != 5 && checkState != 10){
  465. if(checkState==-1){
  466. Feng.error("您的申报审核不通过,无法再修改");
  467. return false;
  468. }else if(checkState>=35){
  469. Feng.error("您的申报已审核通过,无法再修改");
  470. return false;
  471. }else{
  472. Feng.error("您的申报正在审核中,请耐心等待");
  473. return false;
  474. }
  475. }
  476. return true;
  477. }
  478. /**
  479. * 初始化表格的列
  480. */
  481. TalentInfoInfoDlg.initFileTypeColumn = function () {
  482. return [
  483. {field: 'selectItem', checkbox:false,visible:false},
  484. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"30%",'class': 'uitd_showTip',
  485. formatter : function(value,row,index){
  486. if(row.must==1){
  487. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> '+ value;
  488. }if(row.must==2){
  489. return '<i class="fa fa-paste"></i>'+value;
  490. }
  491. }
  492. },
  493. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"8%",
  494. formatter : function(value,row,index){
  495. if(value==null||value==''||value=='null'){
  496. return '无';
  497. }
  498. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('"+row.id+"',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  499. "<i class=\"fa fa-download\"></i>下载" +
  500. "</button>";
  501. }
  502. },
  503. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"52%",'class': 'uitd_showTip'},
  504. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"10%",
  505. formatter : function(value,row,index){
  506. var files = $("#files").val();
  507. var checkState = $("#checkState").val();
  508. if(checkState!=10 || files.indexOf(value)!=-1){
  509. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this,'"+row.fState+"','"+value+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  510. "<i class=\"fa fa-upload\"></i>上传" +
  511. "</button>" ;
  512. }else{
  513. return "审核通过,无法添加" ;
  514. }
  515. }
  516. }
  517. ]
  518. };
  519. //回调
  520. TalentInfoInfoDlg.callBack = function (data){
  521. layer.close(data.obj);
  522. Feng.info(data.msg);
  523. if (data.code == 200) {
  524. $("#fileTable").bootstrapTable("refresh", {});
  525. }
  526. }
  527. TalentInfoInfoDlg.downloadFile = function (id,type){
  528. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type="+type;
  529. }
  530. //设置不可修改的字段
  531. TalentInfoInfoDlg.setNoChangeField = function () {
  532. var checkState = $("#checkState").val();
  533. var fields = $("#fields").val();
  534. if(checkState==10){
  535. $("input,textarea").each(function () {
  536. $(this).attr("readonly","readonly");
  537. });
  538. $("select").each(function () {
  539. $(this).attr("disabled","disabled");
  540. });
  541. if(fields!=null && fields!=''){
  542. var arr = fields.split(",");
  543. for(var key in arr){
  544. var name = $("#" + arr[key]).prop("tagName");
  545. if(name=='select' || name=='SELECT'){
  546. $("#" + arr[key]).removeAttr("disabled");
  547. }if(name=="input" || name=='textarea' || name=="INPUT" || name=='TEXTAREA'){
  548. $("#" + arr[key]).removeAttr("readonly");
  549. }
  550. }
  551. }
  552. }
  553. }
  554. $(function() {
  555. $('#talentInfoForm').bootstrapValidator({
  556. feedbackIcons: {
  557. valid: 'glyphicon glyphicon-ok',
  558. invalid: 'glyphicon glyphicon-remove',
  559. validating: 'glyphicon glyphicon-refresh'
  560. },
  561. container: 'tooltip',
  562. group:'.rowGroup',
  563. fields: TalentInfoInfoDlg.validateFields,
  564. live: 'enabled',
  565. message: '该字段不能为空'
  566. }).on('error.field.bv', function(e, data) {
  567. // Get the tooltip
  568. var $parent = data.element.parents('.form-group-sm'),
  569. $icon = $parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]'),
  570. title = $icon.data('bs.tooltip').getTitle();
  571. $icon.tooltip('destroy').tooltip({
  572. html: true,
  573. placement: 'right',
  574. title: title,
  575. container: 'body'
  576. });
  577. });
  578. //批量加载字典表数据
  579. var arr = [
  580. {"name":"nation","code":"un_nation"},
  581. {"name":"talentArrange","code":"un_talentLevel"},
  582. {"name":"nationality","code":"un_nationality"},
  583. {"name":"talentType","code":"un_jbt_talentType"},
  584. {"name":"politics","code":"un_political"},
  585. {"name":"highEducation","code":"un_education"},
  586. {"name":"introductionMode","code":"un_introduction_mode"},
  587. {"name":"industryField","code":"un_industryField"},
  588. {"name":"address","code":"un_street"}];
  589. Feng.findChildDictBatch(JSON.stringify(arr));
  590. //加载省份
  591. Feng.addAjaxSelect({
  592. "id": "provinceCode",
  593. "displayCode": "code",
  594. "displayName": "name",
  595. "type": "GET",
  596. "url": Feng.ctxPath + "/api/commonLocation/getProvinceSelect"
  597. });
  598. //批量加载时间控件
  599. $(".date").each(function(){
  600. laydate.render({
  601. elem: this
  602. ,type: 'date'
  603. ,trigger: 'click'
  604. });
  605. });
  606. var id = $("#id").val();
  607. if(id!=null && id!=''){
  608. $("select").each(function () {
  609. $(this).val($(this).attr("value")).trigger("change");
  610. });
  611. Feng.getCheckLog("logTable",{"type":CONFIG.project_rcrd,"mainId":id,"typeFileId":"","active":1})
  612. }
  613. $("#address").val($("#address").attr("value"));
  614. $("#provinceCode").val($("#provinceCode").attr("value"));
  615. TalentInfoInfoDlg.afterSelectProvince();
  616. $("#cityCode").val($("#cityCode").attr("value"));
  617. TalentInfoInfoDlg.afterSelectCity();
  618. $("#countyCode").val($("#countyCode").attr("value"));
  619. $("#talentArrange").val($("#talentArrange").attr("value"));
  620. TalentInfoInfoDlg.getIdentifyCondition();
  621. $("#talentArrange").val($("#talentArrange").attr("value"));
  622. $("#identifyCondition").val($("#identifyCondition").attr("value"));
  623. TalentInfoInfoDlg.validId();
  624. $("#photo").change(function (e) {
  625. var tag = e.target;
  626. var file = tag.files[0];
  627. var imgSrc;
  628. var reader = new FileReader();
  629. reader.readAsDataURL(file);
  630. reader.onload = function() {
  631. imgSrc = this.result;
  632. $("#photoImg").attr("src", imgSrc);
  633. };
  634. });
  635. TalentInfoInfoDlg.setNoChangeField();
  636. $("#identifyCondition").on('chosen:ready', function(e, params) {
  637. $(".chosen-container-single .chosen-single").css("padding","4px 0px 0px 4px");
  638. });
  639. $("#identifyCondition").chosen({
  640. no_results_text: "没有找到结果!",
  641. width:'100%',
  642. search_contains:true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  643. disable_search: false,
  644. enable_split_word_search: true,
  645. rtl:true
  646. });
  647. });