housepurchase_info.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. /**
  2. * 初始化购房补贴详情对话框
  3. */
  4. var HousepurchaseInfoDlg = {
  5. housepurchaseInfoData : {},
  6. validateFields: {
  7. enterpriseId: {validators: {notEmpty: {message: '所属企业不能为空'}}},
  8. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  9. declareObject: {validators: {notEmpty: {message: '申报对象不能为空'}}},
  10. declareType: {validators: {notEmpty: {message: '申报类型不能为空'}}},
  11. cardType: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  12. idCard: {validators: {notEmpty: {message: '证件号码不能为空'}}},
  13. marryStatus: {validators: {notEmpty: {message: '婚姻状态不能为空'}}},
  14. // houseAddress: {validators: {notEmpty: {message: '房屋坐落地址不能为空'}}},
  15. // houseArea: {validators: {notEmpty: {message: '房源购置面积不能为空'}}},
  16. // recordTime: {validators: {notEmpty: {message: '商品房购房合同备案时间不能为空'}}},
  17. // houseMoney: {validators: {notEmpty: {message: '房屋成交金额不能为空'}}},
  18. // isEnjoyOther: {validators: {notEmpty: {message: '是否享受我市其他政策不能为空'}}},
  19. // realEstateNo: {
  20. // validators: {
  21. // notEmpty: {
  22. // message: '不动产权证编号不能为空'
  23. // },
  24. // regexp: {
  25. // regexp: /^闽\([0-9]{4}\)晋江市不动产权第\([0-9]+\)号$/,
  26. // message: "不动产权证编号格式不正确"
  27. // }
  28. // }
  29. // },
  30. // recordNo: {
  31. // validators: {
  32. // notEmpty: {
  33. // message: '备案合同编号不能为空'
  34. // },
  35. // regexp: {
  36. // regexp: /^\d+$/,
  37. // message: "备案合同编号格式不正确"
  38. // }
  39. // }
  40. // },
  41. phone: {
  42. validators: {
  43. notEmpty: {
  44. message: '手机号码不能为空'
  45. },
  46. regexp: {
  47. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  48. message: "手机号码格式不正确"
  49. }
  50. }
  51. },
  52. bank: {
  53. validators: {
  54. notEmpty: {
  55. message: '开户银行不能为空'
  56. },
  57. regexp: {
  58. regexp: /^[\u4e00-\u9fa5]*银行$/,
  59. message: "开户银行格式不正确"
  60. }
  61. }
  62. },
  63. bankAccount: {
  64. validators: {
  65. notEmpty: {
  66. message: '银行账号不能为空'
  67. },
  68. regexp: {
  69. regexp: /^\d+$/,
  70. message: "银行账号格式不正确"
  71. }
  72. }
  73. },
  74. // number:{
  75. // validators: {
  76. // notEmpty: {
  77. // message: '享受第几次购房补贴不能为空'
  78. // },
  79. // regexp: {
  80. // regexp: /^[1-5]$/,
  81. // message: "享受第几次购房补贴格式不正确"
  82. // }
  83. // }
  84. // }
  85. }
  86. };
  87. /**
  88. * 清除数据
  89. */
  90. HousepurchaseInfoDlg.clearData = function() {
  91. this.housepurchaseInfoData = {};
  92. }
  93. /**
  94. * 设置对话框中的数据
  95. * @param key 数据的名称
  96. * @param val 数据的具体值
  97. */
  98. HousepurchaseInfoDlg.set = function(key, val) {
  99. this.housepurchaseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  100. return this;
  101. }
  102. /**
  103. * 设置对话框中的数据
  104. * @param key 数据的名称
  105. * @param val 数据的具体值
  106. */
  107. HousepurchaseInfoDlg.get = function(key) {
  108. return $("#" + key).val();
  109. }
  110. /**
  111. * 关闭此对话框
  112. */
  113. HousepurchaseInfoDlg.close = function() {
  114. parent.layer.close(window.parent.Housepurchase.layerIndex);
  115. }
  116. /**
  117. * 收集数据
  118. */
  119. HousepurchaseInfoDlg.collectData = function() {
  120. this
  121. .set('id')
  122. .set('talentId')
  123. .set('type')
  124. .set('declareType')
  125. .set('declareObject')
  126. .set('year')
  127. .set('name')
  128. .set('cardType')
  129. .set('idCard')
  130. .set('provinceCode')
  131. .set('cityCode')
  132. .set('countyCode')
  133. .set('street')
  134. .set('talentType')
  135. .set('talentArrange')
  136. .set('certificateStartTime')
  137. .set('certificateEndTime')
  138. .set('identifyCondition')
  139. .set('idenfityConditionName')
  140. .set('identifyGetTime')
  141. .set('phone')
  142. .set('marryStatus')
  143. .set('spouseName')
  144. .set('spouseCardType')
  145. .set('spouseIdcard')
  146. .set('childName')
  147. .set('childCardType')
  148. .set('childIdCard')
  149. .set('number')
  150. .set('houseAddress')
  151. .set('houseArea')
  152. .set('recordTime')
  153. .set('houseMoney')
  154. .set('realEstateNo')
  155. .set('recordNo')
  156. .set('isEnjoyOther')
  157. .set('bank')
  158. .set('bankNetwork')
  159. .set('bankAccount')
  160. .set('bankNumber')
  161. .set('spouseIsLibrary');
  162. if($("#provinceCode").val()!=null && $("#provinceCode").val()!=''){
  163. this.housepurchaseInfoData["provinceName"] = $("#provinceCode").find("option:selected").text();
  164. }
  165. if($("#cityCode").val()!=null && $("#cityCode").val()!=''){
  166. this.housepurchaseInfoData["cityName"] = $("#cityCode").find("option:selected").text();
  167. }
  168. if($("#countyCode").val()!=null && $("#countyCode").val()!=''){
  169. this.housepurchaseInfoData["countyName"] = $("#countyCode").find("option:selected").text();
  170. }
  171. }
  172. /**
  173. * 验证数据
  174. */
  175. HousepurchaseInfoDlg.validate = function () {
  176. $('#houseInfoForm').data("bootstrapValidator").resetForm();
  177. $('#houseInfoForm').bootstrapValidator('validate');
  178. return $("#houseInfoForm").data('bootstrapValidator').isValid();
  179. }
  180. HousepurchaseInfoDlg.nameChange = function(){
  181. var talentId = $("#talentId").val();
  182. var declareType = $("#declareType").val();
  183. if(Feng.isEmptyStr(declareType)){
  184. Feng.info("请先选择申报类型");
  185. $("#talentId").val("").trigger('chosen:updated');;
  186. return;
  187. }
  188. if(Feng.isNotEmptyStr(talentId)){
  189. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/init/"+talentId, function(data){
  190. if(data.code == 200){
  191. var talentInfo = data.obj.talentInfo;
  192. var houseInfo = data.obj.houseInfo;
  193. if(houseInfo.count>=5){
  194. Feng.info("当前申报人所关联房产已享受5次补贴,无法再次申报");return;
  195. }
  196. $("#name").val(talentInfo.name);
  197. $("#cardType").val(talentInfo.cardType);
  198. $("#idCard").val(talentInfo.idCard);
  199. $("#provinceCode").val(talentInfo.provinceCode).trigger("change");
  200. $("#cityCode").val(talentInfo.cityCode).trigger("change");
  201. $("#countyCode").val(talentInfo.countyCode);
  202. $("#street").val(talentInfo.address);
  203. $("#phone").val(talentInfo.phone);
  204. $("#bank").val(talentInfo.bank);
  205. $("#bankNumber").val(talentInfo.bankNumber);
  206. $("#bankNetwork").val(talentInfo.bankNetwork);
  207. $("#bankAccount").val(talentInfo.bankAccount);
  208. $("#talentArrange").val(talentInfo.talentArrange).trigger("change");
  209. $("#certificateStartTime").val(talentInfo.certificateStartTime);
  210. $("#certificateEndTime").val(talentInfo.qzgccrcActiveTime);
  211. $("#identifyCondition").val(talentInfo.identifyCondition);
  212. $("#idenfityConditionName").val(talentInfo.identifyConditionName);
  213. $("#identifyGetTime").val(talentInfo.identifyGetTime);
  214. if(Feng.isNotEmptyStr(houseInfo)){
  215. $("#realEstateNo").val(houseInfo.realEstateNo).attr("style","pointer-events: none;background-color: #eee;");
  216. $("#recordNo").val(houseInfo.recordNo).attr("style","pointer-events: none;background-color: #eee;");
  217. $("#houseAddress").val(houseInfo.houseAddress).attr("style","pointer-events: none;background-color: #eee;");
  218. $("#houseArea").val(houseInfo.houseArea).attr("style","pointer-events: none;background-color: #eee;");
  219. $("#recordTime").val(houseInfo.recordTime).attr("style","pointer-events: none;background-color: #eee;");
  220. $("#houseMoney").val(houseInfo.houseMoney).attr("style","pointer-events: none;background-color: #eee;");
  221. }else{
  222. $("#realEstateNo").val("").removeAttr("style");
  223. $("#recordNo").val("").attr("style");
  224. $("#houseAddress").val("").attr("style");
  225. $("#houseArea").val("").attr("style");
  226. $("#recordTime").val("").attr("style");
  227. $("#houseMoney").val("").attr("style");
  228. }
  229. }else{
  230. $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val("");
  231. Feng.info(data.msg);
  232. }
  233. },function(data){
  234. Feng.error("查询失败!" + data.responseJSON.message + "!");
  235. });
  236. ajax.set("year",$("#year").val())
  237. ajax.set("declareType",declareType)
  238. ajax.start();
  239. }
  240. }
  241. /**
  242. * 添加未成年子女
  243. */
  244. HousepurchaseInfoDlg.addChild = function(){
  245. var options = $("#cardType").html();
  246. $("#childData").append(
  247. '<div class="col-sm-12">\n' +
  248. '<input type="hidden" name="id"/>\n' +
  249. '<input type="hidden" name="pId"/>'+
  250. '<div class="rowGroup col-sm-3">\n' +
  251. '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
  252. '</div>\n' +
  253. '<div class="rowGroup col-sm-3">\n' +
  254. '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
  255. options+
  256. '</select>\n' +
  257. '</div>\n' +
  258. '<div class="rowGroup col-sm-3">\n' +
  259. '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
  260. '</div>\n' +
  261. '<div class="add-btn" onclick="HousepurchaseInfoDlg.addChild()"></div>\n' +
  262. '<div class="reduce" onclick="HousepurchaseInfoDlg.reduceChild(this)"></div>'+
  263. '</div>');
  264. }
  265. /**
  266. * 删除子女信息
  267. */
  268. HousepurchaseInfoDlg.reduceChild = function(context){
  269. var id = $(context).parent().find("input[name='id']").val();
  270. if(Feng.isEmptyStr(id)){
  271. $(context).parent().remove();
  272. }else{
  273. if(!validateIsEdit())return;
  274. var operation = function () {
  275. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/deleteChildren", function(data){
  276. if(data.code == 200){
  277. $(context).parent().remove();
  278. Feng.success(data.msg);
  279. }else{
  280. Feng.info(data.msg);
  281. }
  282. },function(data){
  283. Feng.error("删除失败!" + data.responseJSON.message + "!");
  284. });
  285. ajax.set("id",id);
  286. ajax.start();
  287. }
  288. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  289. }
  290. }
  291. /**
  292. * 提交添加
  293. */
  294. HousepurchaseInfoDlg.addSubmit = function() {
  295. var id = $("#id").val();
  296. if(Feng.isNotEmptyStr(id)){
  297. HousepurchaseInfoDlg.editSubmit(1);
  298. return;
  299. }
  300. this.clearData();
  301. this.collectData();
  302. if(!HousepurchaseInfoDlg.validate()){
  303. return ;
  304. }
  305. if(Feng.isNotEmptyStr(this.housepurchaseInfoData.houseMoney) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseMoney)){
  306. Feng.info("房屋成交金额格式不正确!");
  307. return ;
  308. }
  309. if(Feng.isNotEmptyStr(this.housepurchaseInfoData.houseArea) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseArea)){
  310. Feng.info("房屋建筑面积格式不正确!");
  311. return ;
  312. }
  313. if(this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3){
  314. Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!");
  315. return ;
  316. }
  317. //提交信息
  318. var child = new Array();
  319. var error = "";
  320. $("#childData .col-sm-12").each(function (index) {
  321. var id = $(this).find("input[name='id']").val();
  322. var pId = $(this).find("input[name='pId']").val();
  323. var childName = $(this).find("input[name='childName']").val();
  324. var childCardType = $(this).find("select[name='childCardType']").val();
  325. var childIdCard = $(this).find("input[name='childIdCard']").val();
  326. if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)){
  327. if(Feng.isEmptyStr(childName)){
  328. error = error + "第"+ (index + 1) + "行未成年子女姓名为空;\n";
  329. }
  330. if(Feng.isEmptyStr(childCardType)){
  331. error = error + "第"+ (index + 1) + "行未成年子女证件类型为空;\n";
  332. }
  333. if(Feng.isEmptyStr(childIdCard)){
  334. error = error + "第"+ (index + 1) + "行未成年子女证件号码为空;\n";
  335. }
  336. child.push({"id":id,"pId":pId,"name":childName,"cardType":childCardType,"idCard":childIdCard});
  337. }
  338. });
  339. this.housepurchaseInfoData['childList'] = child;
  340. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/add", function(data){
  341. if(data.code == 200){
  342. var obj = data.obj;
  343. var childList = obj.childList;
  344. Feng.success(data.msg);
  345. $("#id").val(obj.id);
  346. $("#type").val(obj.type);
  347. $("#fileLi").removeAttr("style");
  348. $("#checkState").val(obj.checkState);
  349. $("#talentId").prop("disabled",true).trigger("chosen:updated");
  350. HousepurchaseInfoDlg.initChildData(childList);
  351. }else{
  352. Feng.info(data.msg);
  353. }
  354. },function(data){
  355. Feng.error("添加失败!" + data.responseJSON.message + "!");
  356. });
  357. ajax.setcontentType("application/json;charset=utf-8");
  358. ajax.setData(JSON.stringify(this.housepurchaseInfoData));
  359. ajax.start();
  360. }
  361. /**
  362. * 提交修改
  363. */
  364. HousepurchaseInfoDlg.editSubmit = function(type) {
  365. this.clearData();
  366. this.collectData();
  367. if(!validateIsEdit())return;
  368. if(!HousepurchaseInfoDlg.validate()){ //校验
  369. return ;
  370. }
  371. if(this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3){
  372. Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!");
  373. return ;
  374. }
  375. //提交信息
  376. var child = new Array();
  377. var error = "";
  378. $("#childData .col-sm-12").each(function (index) {
  379. var id = $(this).find("input[name='id']").val();
  380. var pId = $(this).find("input[name='pId']").val();
  381. var childName = $(this).find("input[name='childName']").val();
  382. var childCardType = $(this).find("select[name='childCardType']").val();
  383. var childIdCard = $(this).find("input[name='childIdCard']").val();
  384. if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)){
  385. if(Feng.isEmptyStr(childName)){
  386. error = error + "第"+ (index + 1) + "行未成年子女姓名为空;\n";
  387. }
  388. if(Feng.isEmptyStr(childCardType)){
  389. error = error + "第"+ (index + 1) + "行未成年子女证件类型为空;\n";
  390. }
  391. if(Feng.isEmptyStr(childIdCard)){
  392. error = error + "第"+ (index + 1) + "行未成年子女证件号码为空;\n";
  393. }
  394. child.push({"id":id,"pId":pId,"name":childName,"cardType":childCardType,"idCard":childIdCard});
  395. }
  396. });
  397. this.housepurchaseInfoData['childList'] = child;
  398. //提交信息
  399. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/update", function(data){
  400. if(data.code == 200){
  401. if(type == 1){
  402. var childList = data.obj.childList;
  403. Feng.success(data.msg);
  404. HousepurchaseInfoDlg.initChildData(childList);
  405. }else{
  406. HousepurchaseInfoDlg.submitToCheck();
  407. }
  408. }else{
  409. Feng.info(data.msg);
  410. }
  411. },function(data){
  412. Feng.error("修改失败!" + data.responseJSON.message + "!");
  413. });
  414. ajax.setcontentType("application/json;charset=utf-8");
  415. ajax.setData(JSON.stringify(this.housepurchaseInfoData));
  416. ajax.start();
  417. }
  418. /**
  419. * 初始化子女信息
  420. * @param list
  421. */
  422. HousepurchaseInfoDlg.initChildData = function(list){
  423. var options = $("#cardType").html();
  424. var html = "";
  425. for(var key in list) {
  426. html = html +
  427. '<div class="col-sm-12">\n' +
  428. '<input type="hidden" name="id" value="'+list[key].id+'"/>\n' +
  429. '<input type="hidden" name="pId" value="'+list[key].pId+'"/>' +
  430. '<div class="rowGroup col-sm-3">\n' +
  431. '<input type="text" class="form-control" name="childName" value="'+list[key].name+'" placeholder="未成年子女姓名"/>\n' +
  432. '</div>\n' +
  433. '<div class="rowGroup col-sm-3">\n' +
  434. '<select class="form-control" name="childCardType" value="'+list[key].cardType+'" placeholder="未成年子女证件类型">\n' +
  435. options +
  436. '</select>\n' +
  437. '</div>\n' +
  438. '<div class="rowGroup col-sm-3">\n' +
  439. '<input type="text" class="form-control" name="childIdCard" value="'+list[key].idCard+'" placeholder="未成年子女证件号码"/>\n' +
  440. '</div>\n' +
  441. '<div class="add-btn" onclick="HousepurchaseInfoDlg.addChild()"></div>\n' +
  442. '<div class="reduce" onclick="HousepurchaseInfoDlg.reduceChild(this)"></div>'+
  443. '</div>';
  444. }
  445. if(Feng.isEmptyStr(html)){
  446. html = html +
  447. '<div class="col-sm-12">\n' +
  448. '<input type="hidden" name="id" />\n' +
  449. '<input type="hidden" name="pId" />' +
  450. '<div class="rowGroup col-sm-3">\n' +
  451. '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
  452. '</div>\n' +
  453. '<div class="rowGroup col-sm-3">\n' +
  454. '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
  455. options +
  456. '</select>\n' +
  457. '</div>\n' +
  458. '<div class="rowGroup col-sm-3">\n' +
  459. '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
  460. '</div>\n' +
  461. '<div class="add-btn" onclick="HouseRentingInfoDlg.addChild()"></div>\n' +
  462. '</div>';
  463. }
  464. $("#childData").empty().append(html);
  465. $("#childData select").each(function () {
  466. $(this).val($(this).attr("value"))
  467. })
  468. if(list == null){
  469. HousepurchaseInfoDlg.addChild();
  470. }
  471. }
  472. /**
  473. * 提交审核
  474. */
  475. HousepurchaseInfoDlg.submitToCheck = function(){
  476. if(!validateIsEdit())return;
  477. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/valiateIsSubmit", function (data) {
  478. if(data.code == 200){
  479. var operation = function() {
  480. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/submitToCheck", function (data) {
  481. if(data.code==200){
  482. Feng.success(data.msg);
  483. window.parent.Housepurchase.table.refresh();
  484. HousepurchaseInfoDlg.close();
  485. }else{
  486. Feng.error(data.msg);
  487. }
  488. }, function (data) {
  489. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  490. });
  491. ajax.set("id", $("#id").val());
  492. ajax.start();
  493. }
  494. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  495. }else{
  496. Feng.error(data.msg);
  497. }
  498. }, function (data) {
  499. Feng.error("查询失败!" + data.responseJSON.message + "!");
  500. });
  501. ajax.set("type",CONFIG.project_house);
  502. ajax.set("id",$("#id").val())
  503. ajax.start();
  504. }
  505. /**
  506. * 申报对象级联
  507. */
  508. HousepurchaseInfoDlg.declareObjChange = function(){
  509. var declareObj = $("#declareObject").val();
  510. switch (declareObj) {
  511. case "":
  512. break;
  513. case "1": //新政策中公布入选为晋江市优秀人才后再购房对象
  514. break;
  515. case "2": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  516. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  517. break;
  518. case "3": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  519. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  520. break;
  521. }
  522. }
  523. /**
  524. * 根据申报类型
  525. */
  526. HousepurchaseInfoDlg.typeChange = function(){
  527. var type = $("#declareType").val();
  528. if(type == null){
  529. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
  530. }
  531. if(type == 1){
  532. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display","block");
  533. }
  534. if(type == 2){
  535. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
  536. }
  537. }
  538. /**
  539. * 获取认定条件
  540. */
  541. HousepurchaseInfoDlg.getIdentifyCondition = function(){
  542. var level = $("#talentArrange").val();
  543. if(level==null||level==''){
  544. $("#identifyCondition").empty();
  545. return;
  546. }
  547. Feng.addAjaxSelect({
  548. "id": "identifyCondition",
  549. "displayCode": "id",
  550. "displayName": "name",
  551. "type": "GET",
  552. "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level
  553. });
  554. }
  555. /**
  556. * 校验是否显示按钮
  557. * @param type 类型 1-上传按钮,2-修改删除按钮
  558. * @param row
  559. * @returns {string}
  560. */
  561. function validUploadButton(type,row,fileId){
  562. var files = $("#files").val();
  563. var checkState = $("#checkState").val();
  564. if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 10 && files.indexOf(row.id)!=-1)){
  565. return type == 1?
  566. "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  567. "<i class=\"fa fa-upload\"></i>上传" +
  568. "</button>"
  569. :
  570. "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  571. "<i class=\"fa fa-paste\"></i>修改" +
  572. "</button>" +
  573. "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_house+"')\" class=\"btn btn-xs btn-danger\">" +
  574. "<i class=\"fa fa-times\"></i>删除" +
  575. "</button>";
  576. }else{
  577. return type == 1?"":"" ;
  578. }
  579. }
  580. function validateIsEdit(){
  581. var id = $("#id").val();
  582. var checkState = $("#checkState").val();
  583. if(Feng.isEmptyStr(id)){
  584. Feng.info("请先填写基础信息并上传附件");
  585. return false;
  586. }
  587. if(checkState != 1 && checkState != 10){
  588. if(checkState==-1){
  589. Feng.error("您的申报审核不通过,无法修改");
  590. return false;
  591. }else if(checkState>=40){
  592. Feng.error("您的申报已审核通过,无法修改");
  593. return false;
  594. }else{
  595. Feng.error("您的申报正在审核中,请耐心等待");
  596. return false;
  597. }
  598. }
  599. return true;
  600. }
  601. //设置不可修改的字段
  602. HousepurchaseInfoDlg.setNoChangeField = function () {
  603. var checkState = $("#checkState").val();
  604. var fields = $("#fields").val();
  605. if(checkState==10){
  606. $("#basicData input,textarea").each(function () {
  607. $(this).attr("readonly","readonly");
  608. });
  609. $("#basicData select").each(function () {
  610. $(this).attr("disabled","disabled");
  611. });
  612. if(fields!=null && fields!=''){
  613. var arr = fields.split(",");
  614. for(var key in arr){
  615. var name = $("#" + arr[key]).prop("tagName");
  616. if(name=='select' || name=='SELECT'){
  617. $("#" + arr[key]).removeAttr("disabled");
  618. }if(name=="input" || name=='textarea' || name=="INPUT" || name=='TEXTAREA'){
  619. $("#" + arr[key]).removeAttr("readonly");
  620. }
  621. }
  622. }
  623. }
  624. }
  625. /**
  626. * 获取房产信息
  627. */
  628. HousepurchaseInfoDlg.getHouseInfo = function(){
  629. var idCard = $("#idCard").val();
  630. var spouseIdcard = $("#spouseIdcard").val();
  631. if(Feng.isEmptyStr(idCard)){
  632. Feng.info("请选择申报人");return ;
  633. }
  634. var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/getHouseInfo", function(data){
  635. if(data.code == 200){
  636. var houseInfo = data.obj;
  637. if(houseInfo.count>=5){
  638. Feng.info("当前申报人(或配偶)所关联房产已享受5次补贴,无法再次申报");return;
  639. }
  640. if(Feng.isNotEmptyStr(houseInfo)){
  641. $("#realEstateNo").val(houseInfo.realEstateNo).attr("style","pointer-events: none;background-color: #eee;");
  642. $("#recordNo").val(houseInfo.recordNo).attr("style","pointer-events: none;background-color: #eee;");
  643. $("#houseAddress").val(houseInfo.houseAddress).attr("style","pointer-events: none;background-color: #eee;");
  644. $("#houseArea").val(houseInfo.houseArea).attr("style","pointer-events: none;background-color: #eee;");
  645. $("#recordTime").val(houseInfo.recordTime).attr("style","pointer-events: none;background-color: #eee;");
  646. $("#houseMoney").val(houseInfo.houseMoney).attr("style","pointer-events: none;background-color: #eee;");
  647. }else{
  648. $("#realEstateNo").val("").removeAttr("style");
  649. $("#recordNo").val("").attr("style");
  650. $("#houseAddress").val("").attr("style");
  651. $("#houseArea").val("").attr("style");
  652. $("#recordTime").val("").attr("style");
  653. $("#houseMoney").val("").attr("style");
  654. }
  655. }else{
  656. $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val("");
  657. Feng.info(data.msg);
  658. }
  659. },function(data){
  660. Feng.error("查询失败!" + data.responseJSON.message + "!");
  661. });
  662. ajax.set("idCard",idCard);
  663. ajax.set("spouseIdcard",spouseIdcard);
  664. ajax.start();
  665. }
  666. $(function() {
  667. Feng.initValidatorTip("houseInfoForm", HousepurchaseInfoDlg.validateFields);
  668. Feng.addAjaxSelect({
  669. "id": 'talentId',
  670. "displayCode": "id",
  671. "displayName": "name",
  672. "type": "GET",
  673. "url": Feng.ctxPath + "/api/talentInfo/findTalentByEnterpriseInLibrary?type=2&year="+$("#year").val()
  674. });
  675. //批量加载字典表数据
  676. var arr = [
  677. {"name":"cardType","code":"un_cardType"},
  678. {"name":"spouseCardType","code":"un_cardType"},
  679. {"name":"childCardType","code":"un_cardType"},
  680. {"name":"marryStatus","code":"un_marryStatus"},
  681. {"name":"talentArrange","code":"un_talentLevel"},
  682. {"name":"street","code":"un_street"}];
  683. Feng.findChildDictBatch(JSON.stringify(arr));
  684. $("select[name='childCardType']").append($("#cardType").html());
  685. $(".other_talentArrange").empty().append($("#talentArrange").html());
  686. loadProvince();
  687. //加载时间控件
  688. $(".date").each(function(){laydate.render({
  689. elem: this,type: 'date',trigger: 'click'
  690. });
  691. });
  692. var id = $("#id").val();
  693. if(Feng.isNotEmptyStr(id)){
  694. $("select").each(function () {$(this).val($(this).attr("value")).trigger("change");});
  695. $("#fileLi").removeAttr("style");
  696. Feng.getCheckLog("logTable",{"type":CONFIG.project_house,"mainId":id,"typeFileId":"","active":1})
  697. }else{
  698. $("#fileLi").attr("style","pointer-events: none");
  699. $("#talentId").on('chosen:ready', function(e, params) {
  700. $(".chosen-container-single .chosen-single").css("padding","4px 0px 0px 4px");
  701. });
  702. $("#talentId").chosen({
  703. search_contains:true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  704. disable_search: false,
  705. width:"100%",
  706. enable_split_word_search: true
  707. });
  708. }
  709. HousepurchaseInfoDlg.setNoChangeField();
  710. toastr.options = {
  711. "closeButton": true,
  712. "debug": false,
  713. "positionClass": "toast-bottom-right",
  714. "onclick": null,
  715. "showDuration": "300",
  716. "hideDuration": "1000",
  717. "timeOut": "600000",
  718. "extendedTimeOut": "1000",
  719. "showEasing": "swing",
  720. "hideEasing": "linear",
  721. "showMethod": "fadeIn",
  722. "hideMethod": "fadeOut",
  723. "tapToDismiss":true
  724. };
  725. toastr.success("免租入住仅人才标签为在站博士后的人才申报!!!");
  726. });