talentInfo_info.js 31 KB

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