housepurchase_info.js 30 KB

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