housepurchase_info.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  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|16|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. ;
  187. return;
  188. }
  189. if (Feng.isNotEmptyStr(talentId)) {
  190. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/getTalentInfo/id/" + talentId, function (data) {
  191. if (data.code == 200) {
  192. var talentInfo = data.obj.talentInfo;
  193. var houseInfo = data.obj.houseInfo;
  194. if (houseInfo && houseInfo.count >= 5) {
  195. Feng.info("当前申报人所关联房产已享受5次补贴,无法再次申报");
  196. return;
  197. }
  198. $("#name").val(talentInfo.name);
  199. $("#cardType").val(talentInfo.card_type);
  200. $("#idCard").val(talentInfo.card_number);
  201. $("#provinceCode").val(talentInfo.province).trigger("change");
  202. $("#cityCode").val(talentInfo.city).trigger("change");
  203. $("#countyCode").val(talentInfo.county);
  204. $("#street").val(talentInfo.street);
  205. $("#phone").val(talentInfo.phone);
  206. $("#bank").val(talentInfo.enterpriseBank);
  207. $("#bankNumber").val(talentInfo.bank_number);
  208. $("#bankNetwork").val(talentInfo.enterpriseBankNetwork);
  209. $("#bankAccount").val(talentInfo.enterpriseBankCard);
  210. $("#talentArrange").val(talentInfo.talentArrange).trigger("change");
  211. $("#certificateStartTime").val(talentInfo.certificateStartTime);
  212. $("#certificateEndTime").val(talentInfo.certificateOutTime);
  213. $("#identifyCondition").val(talentInfo.talent_condition);
  214. $("#idenfityConditionName").val(talentInfo.identifyConditionName);
  215. $("#identifyGetTime").val(talentInfo.identifyGetTime);
  216. if (Feng.isNotEmptyStr(houseInfo)) {
  217. $("#realEstateNo").val(houseInfo.realEstateNo).attr("style", "pointer-events: none;background-color: #eee;");
  218. $("#recordNo").val(houseInfo.recordNo).attr("style", "pointer-events: none;background-color: #eee;");
  219. $("#houseAddress").val(houseInfo.houseAddress).attr("style", "pointer-events: none;background-color: #eee;");
  220. $("#houseArea").val(houseInfo.houseArea).attr("style", "pointer-events: none;background-color: #eee;");
  221. $("#recordTime").val(houseInfo.recordTime).attr("style", "pointer-events: none;background-color: #eee;");
  222. $("#houseMoney").val(houseInfo.houseMoney).attr("style", "pointer-events: none;background-color: #eee;");
  223. } else {
  224. $("#realEstateNo").val("").removeAttr("style");
  225. $("#recordNo").val("").attr("style");
  226. $("#houseAddress").val("").attr("style");
  227. $("#houseArea").val("").attr("style");
  228. $("#recordTime").val("").attr("style");
  229. $("#houseMoney").val("").attr("style");
  230. }
  231. } else {
  232. $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val("");
  233. Feng.info(data.msg);
  234. }
  235. }, function (data) {
  236. Feng.error("查询失败!" + data.responseJSON.message + "!");
  237. });
  238. ajax.set("year", $("#year").val())
  239. ajax.set("declareType", declareType)
  240. ajax.start();
  241. }
  242. }
  243. /**
  244. * 添加未成年子女
  245. */
  246. HousepurchaseInfoDlg.addChild = function () {
  247. var options = $("#cardType").html();
  248. $("#childData").append(
  249. '<div class="col-sm-12">\n' +
  250. '<input type="hidden" name="id"/>\n' +
  251. '<input type="hidden" name="pId"/>' +
  252. '<div class="rowGroup col-sm-3">\n' +
  253. '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
  254. '</div>\n' +
  255. '<div class="rowGroup col-sm-3">\n' +
  256. '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
  257. options +
  258. '</select>\n' +
  259. '</div>\n' +
  260. '<div class="rowGroup col-sm-3">\n' +
  261. '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
  262. '</div>\n' +
  263. '<div class="add-btn" onclick="HousepurchaseInfoDlg.addChild()"></div>\n' +
  264. '<div class="reduce" onclick="HousepurchaseInfoDlg.reduceChild(this)"></div>' +
  265. '</div>');
  266. }
  267. /**
  268. * 删除子女信息
  269. */
  270. HousepurchaseInfoDlg.reduceChild = function (context) {
  271. var id = $(context).parent().find("input[name='id']").val();
  272. if (Feng.isEmptyStr(id)) {
  273. $(context).parent().remove();
  274. } else {
  275. if (!validateIsEdit())
  276. return;
  277. var operation = function () {
  278. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/deleteChildren", function (data) {
  279. if (data.code == 200) {
  280. $(context).parent().remove();
  281. Feng.success(data.msg);
  282. } else {
  283. Feng.info(data.msg);
  284. }
  285. }, function (data) {
  286. Feng.error("删除失败!" + data.responseJSON.message + "!");
  287. });
  288. ajax.set("id", id);
  289. ajax.start();
  290. }
  291. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  292. }
  293. }
  294. /**
  295. * 提交添加
  296. */
  297. HousepurchaseInfoDlg.addSubmit = function () {
  298. var id = $("#id").val();
  299. if (Feng.isNotEmptyStr(id)) {
  300. HousepurchaseInfoDlg.editSubmit(1);
  301. return;
  302. }
  303. this.clearData();
  304. this.collectData();
  305. if (!HousepurchaseInfoDlg.validate()) {
  306. return;
  307. }
  308. if (Feng.isNotEmptyStr(this.housepurchaseInfoData.houseMoney) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseMoney)) {
  309. Feng.info("房屋成交金额格式不正确!");
  310. return;
  311. }
  312. if (Feng.isNotEmptyStr(this.housepurchaseInfoData.houseArea) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseArea)) {
  313. Feng.info("房屋建筑面积格式不正确!");
  314. return;
  315. }
  316. if (this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3) {
  317. Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!");
  318. return;
  319. }
  320. //提交信息
  321. var child = new Array();
  322. var error = "";
  323. $("#childData .col-sm-12").each(function (index) {
  324. var id = $(this).find("input[name='id']").val();
  325. var pId = $(this).find("input[name='pId']").val();
  326. var childName = $(this).find("input[name='childName']").val();
  327. var childCardType = $(this).find("select[name='childCardType']").val();
  328. var childIdCard = $(this).find("input[name='childIdCard']").val();
  329. if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)) {
  330. if (Feng.isEmptyStr(childName)) {
  331. error = error + "第" + (index + 1) + "行未成年子女姓名为空;\n";
  332. }
  333. if (Feng.isEmptyStr(childCardType)) {
  334. error = error + "第" + (index + 1) + "行未成年子女证件类型为空;\n";
  335. }
  336. if (Feng.isEmptyStr(childIdCard)) {
  337. error = error + "第" + (index + 1) + "行未成年子女证件号码为空;\n";
  338. }
  339. child.push({"id": id, "pId": pId, "name": childName, "cardType": childCardType, "idCard": childIdCard});
  340. }
  341. });
  342. this.housepurchaseInfoData['childList'] = child;
  343. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/apply", function (data) {
  344. if (data.code == 200) {
  345. var obj = data.obj;
  346. var childList = obj.childList;
  347. Feng.success(data.msg);
  348. $("#id").val(obj.id);
  349. $("#type").val(obj.type);
  350. $("#fileLi").removeAttr("style");
  351. $("#checkState").val(obj.checkState);
  352. $("#talentId").prop("disabled", true).trigger("chosen:updated");
  353. HousepurchaseInfoDlg.initChildData(childList);
  354. } else {
  355. Feng.info(data.msg);
  356. }
  357. }, function (data) {
  358. Feng.error("添加失败!" + data.responseJSON.message + "!");
  359. });
  360. ajax.setcontentType("application/json;charset=utf-8");
  361. ajax.setData(JSON.stringify(this.housepurchaseInfoData));
  362. ajax.start();
  363. }
  364. /**
  365. * 提交修改
  366. */
  367. HousepurchaseInfoDlg.editSubmit = function (type) {
  368. this.clearData();
  369. this.collectData();
  370. if (!validateIsEdit())
  371. return;
  372. if (!HousepurchaseInfoDlg.validate()) { //校验
  373. return;
  374. }
  375. if (this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3) {
  376. Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!");
  377. return;
  378. }
  379. //提交信息
  380. var child = new Array();
  381. var error = "";
  382. $("#childData .col-sm-12").each(function (index) {
  383. var id = $(this).find("input[name='id']").val();
  384. var pId = $(this).find("input[name='pId']").val();
  385. var childName = $(this).find("input[name='childName']").val();
  386. var childCardType = $(this).find("select[name='childCardType']").val();
  387. var childIdCard = $(this).find("input[name='childIdCard']").val();
  388. if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)) {
  389. if (Feng.isEmptyStr(childName)) {
  390. error = error + "第" + (index + 1) + "行未成年子女姓名为空;\n";
  391. }
  392. if (Feng.isEmptyStr(childCardType)) {
  393. error = error + "第" + (index + 1) + "行未成年子女证件类型为空;\n";
  394. }
  395. if (Feng.isEmptyStr(childIdCard)) {
  396. error = error + "第" + (index + 1) + "行未成年子女证件号码为空;\n";
  397. }
  398. child.push({"id": id, "pId": pId, "name": childName, "cardType": childCardType, "idCard": childIdCard});
  399. }
  400. });
  401. this.housepurchaseInfoData['childList'] = child;
  402. //提交信息
  403. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/apply", function (data) {
  404. if (data.code == 200) {
  405. if (type == 1) {
  406. var childList = data.obj.childList;
  407. Feng.success(data.msg);
  408. HousepurchaseInfoDlg.initChildData(childList);
  409. } else {
  410. HousepurchaseInfoDlg.submitToCheck();
  411. }
  412. } else {
  413. Feng.info(data.msg);
  414. }
  415. }, function (data) {
  416. Feng.error("修改失败!" + data.responseJSON.message + "!");
  417. });
  418. ajax.setcontentType("application/json;charset=utf-8");
  419. ajax.setData(JSON.stringify(this.housepurchaseInfoData));
  420. ajax.start();
  421. }
  422. /**
  423. * 初始化子女信息
  424. * @param list
  425. */
  426. HousepurchaseInfoDlg.initChildData = function (list) {
  427. var options = $("#cardType").html();
  428. var html = "";
  429. for (var key in list) {
  430. html = html +
  431. '<div class="col-sm-12">\n' +
  432. '<input type="hidden" name="id" value="' + list[key].id + '"/>\n' +
  433. '<input type="hidden" name="pId" value="' + list[key].pId + '"/>' +
  434. '<div class="rowGroup col-sm-3">\n' +
  435. '<input type="text" class="form-control" name="childName" value="' + list[key].name + '" placeholder="未成年子女姓名"/>\n' +
  436. '</div>\n' +
  437. '<div class="rowGroup col-sm-3">\n' +
  438. '<select class="form-control" name="childCardType" value="' + list[key].cardType + '" placeholder="未成年子女证件类型">\n' +
  439. options +
  440. '</select>\n' +
  441. '</div>\n' +
  442. '<div class="rowGroup col-sm-3">\n' +
  443. '<input type="text" class="form-control" name="childIdCard" value="' + list[key].idCard + '" placeholder="未成年子女证件号码"/>\n' +
  444. '</div>\n' +
  445. '<div class="add-btn" onclick="HousepurchaseInfoDlg.addChild()"></div>\n' +
  446. '<div class="reduce" onclick="HousepurchaseInfoDlg.reduceChild(this)"></div>' +
  447. '</div>';
  448. }
  449. if (Feng.isEmptyStr(html)) {
  450. html = html +
  451. '<div class="col-sm-12">\n' +
  452. '<input type="hidden" name="id" />\n' +
  453. '<input type="hidden" name="pId" />' +
  454. '<div class="rowGroup col-sm-3">\n' +
  455. '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
  456. '</div>\n' +
  457. '<div class="rowGroup col-sm-3">\n' +
  458. '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
  459. options +
  460. '</select>\n' +
  461. '</div>\n' +
  462. '<div class="rowGroup col-sm-3">\n' +
  463. '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
  464. '</div>\n' +
  465. '<div class="add-btn" onclick="HouseRentingInfoDlg.addChild()"></div>\n' +
  466. '</div>';
  467. }
  468. $("#childData").empty().append(html);
  469. $("#childData select").each(function () {
  470. $(this).val($(this).attr("value"))
  471. })
  472. if (list == null) {
  473. HousepurchaseInfoDlg.addChild();
  474. }
  475. }
  476. /**
  477. * 提交审核
  478. */
  479. HousepurchaseInfoDlg.submitToCheck = function () {
  480. if (!validateIsEdit())
  481. return;
  482. var ajax = new $ax("/common/batch/checkBatchValid", function (data) {
  483. if (data.code == 200) {
  484. var operation = function () {
  485. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/submitToCheck", function (data) {
  486. if (data.code == 200) {
  487. Feng.success(data.msg);
  488. window.parent.Housepurchase.table.refresh();
  489. HousepurchaseInfoDlg.close();
  490. } else {
  491. Feng.error(data.msg);
  492. }
  493. }, function (data) {
  494. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  495. });
  496. ajax.set("id", $("#id").val());
  497. ajax.start();
  498. }
  499. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  500. } else {
  501. Feng.error(data.msg);
  502. }
  503. }, function (data) {
  504. Feng.error("查询失败!" + data.responseJSON.message + "!");
  505. });
  506. ajax.set("type", CONFIG.project_house);
  507. ajax.set("id", $("#id").val())
  508. ajax.start();
  509. }
  510. /**
  511. * 申报对象级联
  512. */
  513. HousepurchaseInfoDlg.declareObjChange = function () {
  514. var declareObj = $("#declareObject").val();
  515. switch (declareObj) {
  516. case "":
  517. break;
  518. case "1": //新政策中公布入选为晋江市现代产业体系人才后再购房对象
  519. break;
  520. case "2": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  521. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  522. break;
  523. case "3": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  524. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  525. break;
  526. }
  527. }
  528. /**
  529. * 根据申报类型
  530. */
  531. HousepurchaseInfoDlg.typeChange = function () {
  532. var type = $("#declareType").val();
  533. if (type == null) {
  534. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display", "none");
  535. }
  536. if (type == 1) {
  537. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display", "block");
  538. }
  539. if (type == 2) {
  540. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display", "none");
  541. }
  542. }
  543. /**
  544. * 获取认定条件
  545. */
  546. HousepurchaseInfoDlg.getIdentifyCondition = function () {
  547. var level = $("#talentArrange").val();
  548. if (level == null || level == '') {
  549. $("#identifyCondition").empty();
  550. return;
  551. }
  552. Feng.addAjaxSelect({
  553. "id": "identifyCondition",
  554. "displayCode": "id",
  555. "displayName": "name",
  556. "type": "GET",
  557. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level
  558. });
  559. }
  560. /**
  561. * 校验是否显示按钮
  562. * @param type 类型 1-上传按钮,2-修改删除按钮
  563. * @param row
  564. * @returns {string}
  565. */
  566. function validUploadButton(type, row, fileId) {
  567. var files = $("#files").val();
  568. var checkState = $("#checkState").val();
  569. if (Feng.isEmptyStr(checkState) || checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1)) {
  570. return type == 1 ?
  571. "<button type='button' onclick=\"checkFile(this,'" + row.id + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  572. "<i class=\"fa fa-upload\"></i>上传" +
  573. "</button>"
  574. :
  575. "<button type=\'button\' onclick=\"checkFile(this,'" + row.id + "','" + fileId + "')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  576. "<i class=\"fa fa-paste\"></i>修改" +
  577. "</button>" +
  578. "<button type='button' onclick=\"deleteFile('" + fileId + "','" + CONFIG.project_house + "')\" class=\"btn btn-xs btn-danger\">" +
  579. "<i class=\"fa fa-times\"></i>删除" +
  580. "</button>";
  581. } else {
  582. return type == 1 ? "" : "";
  583. }
  584. }
  585. function validateIsEdit() {
  586. var id = $("#id").val();
  587. var checkState = $("#checkState").val();
  588. if (Feng.isEmptyStr(id)) {
  589. Feng.info("请先填写基础信息并上传附件");
  590. return false;
  591. }
  592. if (checkState != 1 && checkState != 10) {
  593. if (checkState == -1) {
  594. Feng.error("您的申报审核不通过,无法修改");
  595. return false;
  596. } else if (checkState >= 40) {
  597. Feng.error("您的申报已审核通过,无法修改");
  598. return false;
  599. } else {
  600. Feng.error("您的申报正在审核中,请耐心等待");
  601. return false;
  602. }
  603. }
  604. return true;
  605. }
  606. //设置不可修改的字段
  607. HousepurchaseInfoDlg.setNoChangeField = function () {
  608. var checkState = $("#checkState").val();
  609. var fields = $("#fields").val();
  610. if (checkState == 10) {
  611. $("#basicData input,textarea").each(function () {
  612. $(this).attr("readonly", "readonly");
  613. });
  614. $("#basicData select").each(function () {
  615. $(this).attr("disabled", "disabled");
  616. });
  617. if (fields != null && fields != '') {
  618. var arr = fields.split(",");
  619. for (var key in arr) {
  620. var name = $("#" + arr[key]).prop("tagName");
  621. if (name == 'select' || name == 'SELECT') {
  622. $("#" + arr[key]).removeAttr("disabled");
  623. }
  624. if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  625. $("#" + arr[key]).removeAttr("readonly");
  626. }
  627. }
  628. }
  629. }
  630. }
  631. /**
  632. * 获取房产信息
  633. */
  634. HousepurchaseInfoDlg.getHouseInfo = function () {
  635. var idCard = $("#idCard").val();
  636. var spouseIdcard = $("#spouseIdcard").val();
  637. if (Feng.isEmptyStr(idCard)) {
  638. Feng.info("请选择申报人");
  639. return;
  640. }
  641. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/getHouseInfo", function (data) {
  642. if (data.code == 200) {
  643. var houseInfo = data.obj;
  644. if (houseInfo.count >= 5) {
  645. Feng.info("当前申报人(或配偶)所关联房产已享受5次补贴,无法再次申报");
  646. return;
  647. }
  648. if (Feng.isNotEmptyStr(houseInfo)) {
  649. $("#realEstateNo").val(houseInfo.realEstateNo).attr("style", "pointer-events: none;background-color: #eee;");
  650. $("#recordNo").val(houseInfo.recordNo).attr("style", "pointer-events: none;background-color: #eee;");
  651. $("#houseAddress").val(houseInfo.houseAddress).attr("style", "pointer-events: none;background-color: #eee;");
  652. $("#houseArea").val(houseInfo.houseArea).attr("style", "pointer-events: none;background-color: #eee;");
  653. $("#recordTime").val(houseInfo.recordTime).attr("style", "pointer-events: none;background-color: #eee;");
  654. $("#houseMoney").val(houseInfo.houseMoney).attr("style", "pointer-events: none;background-color: #eee;");
  655. } else {
  656. $("#realEstateNo").val("").removeAttr("style");
  657. $("#recordNo").val("").attr("style");
  658. $("#houseAddress").val("").attr("style");
  659. $("#houseArea").val("").attr("style");
  660. $("#recordTime").val("").attr("style");
  661. $("#houseMoney").val("").attr("style");
  662. }
  663. } else {
  664. $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val("");
  665. Feng.info(data.msg);
  666. }
  667. }, function (data) {
  668. Feng.error("查询失败!" + data.responseJSON.message + "!");
  669. });
  670. ajax.set("idCard", idCard);
  671. ajax.set("spouseIdcard", spouseIdcard);
  672. ajax.start();
  673. }
  674. $(function () {
  675. Feng.initValidatorTip("houseInfoForm", HousepurchaseInfoDlg.validateFields);
  676. Feng.addAjaxSelect({
  677. "id": 'talentId',
  678. "displayCode": "id",
  679. "displayName": "name",
  680. "type": "GET",
  681. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=2&year=" + $("#year").val()
  682. });
  683. //批量加载字典表数据
  684. var arr = [
  685. {"name": "cardType", "code": "card_type"},
  686. {"name": "spouseCardType", "code": "card_type"},
  687. {"name": "childCardType", "code": "card_type"},
  688. {"name": "marryStatus", "code": "marry_status"},
  689. {"name": "talentArrange", "code": "talent_arrange"},
  690. {"name": "street", "code": "street"}];
  691. Feng.findChildDictBatch(JSON.stringify(arr));
  692. $("select[name='childCardType']").append($("#cardType").html());
  693. $(".other_talentArrange").empty().append($("#talentArrange").html());
  694. loadProvince();
  695. //加载时间控件
  696. $(".date").each(function () {
  697. laydate.render({
  698. elem: this, type: 'date', trigger: 'click'
  699. });
  700. });
  701. var id = $("#id").val();
  702. if (Feng.isNotEmptyStr(id)) {
  703. $("select").each(function () {
  704. $(this).val($(this).attr("value")).trigger("change");
  705. });
  706. $("#fileLi").removeAttr("style");
  707. Feng.getCheckLog("logTable", {"type": CONFIG.project_house, "mainId": id, "typeFileId": "", "active": 1})
  708. } else {
  709. $("#fileLi").attr("style", "pointer-events: none");
  710. $("#talentId").on('chosen:ready', function (e, params) {
  711. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  712. });
  713. $("#talentId").chosen({
  714. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  715. disable_search: false,
  716. width: "100%",
  717. enable_split_word_search: true
  718. });
  719. }
  720. HousepurchaseInfoDlg.setNoChangeField();
  721. toastr.options = {
  722. "closeButton": true,
  723. "debug": false,
  724. "positionClass": "toast-bottom-right",
  725. "onclick": null,
  726. "showDuration": "300",
  727. "hideDuration": "1000",
  728. "timeOut": "600000",
  729. "extendedTimeOut": "1000",
  730. "showEasing": "swing",
  731. "hideEasing": "linear",
  732. "showMethod": "fadeIn",
  733. "hideMethod": "fadeOut",
  734. "tapToDismiss": true
  735. };
  736. toastr.success("免租入住仅人才标签为在站博士后的人才申报!!!");
  737. });