housepurchase_select.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. * @param list
  119. */
  120. HousepurchaseInfoDlg.initChildData = function(list){
  121. var options = $("#cardType").html();
  122. var html = "";
  123. for(var key in list) {
  124. html = html +
  125. '<div class="col-sm-12">\n' +
  126. '<input type="hidden" name="id" value="'+list[key].id+'"/>\n' +
  127. '<input type="hidden" name="pId" value="'+list[key].pId+'"/>' +
  128. '<div class="rowGroup col-sm-3">\n' +
  129. '<input type="text" class="form-control" name="childName" value="'+list[key].name+'" placeholder="未成年子女姓名"/>\n' +
  130. '</div>\n' +
  131. '<div class="rowGroup col-sm-3">\n' +
  132. '<select class="form-control" name="childCardType" value="'+list[key].cardType+'" placeholder="未成年子女证件类型">\n' +
  133. options +
  134. '</select>\n' +
  135. '</div>\n' +
  136. '<div class="rowGroup col-sm-3">\n' +
  137. '<input type="text" class="form-control" name="childIdCard" value="'+list[key].idCard+'" placeholder="未成年子女证件号码"/>\n' +
  138. '</div>\n' +
  139. '</div>';
  140. }
  141. $("#childData").empty().append(html);
  142. $("#childData select").each(function () {
  143. $(this).val($(this).attr("value"))
  144. })
  145. if(list == null){
  146. HousepurchaseInfoDlg.addChild();
  147. }
  148. }
  149. /**
  150. * 申报对象级联
  151. */
  152. HousepurchaseInfoDlg.declareObjChange = function(){
  153. var declareObj = $("#declareObject").val();
  154. switch (declareObj) {
  155. case "":
  156. break;
  157. case "1": //新政策中公布入选为晋江市优秀人才后再购房对象
  158. break;
  159. case "2": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  160. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  161. break;
  162. case "3": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库)
  163. Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!");
  164. break;
  165. }
  166. }
  167. /**
  168. * 根据申报类型
  169. */
  170. HousepurchaseInfoDlg.typeChange = function(){
  171. var type = $("#declareType").val();
  172. if(type == null){
  173. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
  174. }
  175. if(type == 1){
  176. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display","block");
  177. }
  178. if(type == 2){
  179. $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
  180. }
  181. }
  182. /**
  183. * 获取认定条件
  184. */
  185. HousepurchaseInfoDlg.getIdentifyCondition = function(){
  186. var level = $("#talentArrange").val();
  187. if(level==null||level==''){
  188. $("#identifyCondition").empty();
  189. return;
  190. }
  191. Feng.addAjaxSelect({
  192. "id": "identifyCondition",
  193. "displayCode": "id",
  194. "displayName": "name",
  195. "type": "GET",
  196. "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level
  197. });
  198. }
  199. /**
  200. * 校验是否显示按钮
  201. * @param type 类型 1-上传按钮,2-修改删除按钮
  202. * @param row
  203. * @returns {string}
  204. */
  205. function validUploadButton(type,row,fileId){
  206. var files = $("#files").val();
  207. var checkState = $("#checkState").val();
  208. if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 10 && files.indexOf(row.id)!=-1)){
  209. return type == 1?
  210. "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  211. "<i class=\"fa fa-upload\"></i>上传" +
  212. "</button>"
  213. :
  214. "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  215. "<i class=\"fa fa-paste\"></i>修改" +
  216. "</button>" +
  217. "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_house+"')\" class=\"btn btn-xs btn-danger\">" +
  218. "<i class=\"fa fa-times\"></i>删除" +
  219. "</button>";
  220. }else{
  221. return type == 1?"":"" ;
  222. }
  223. }
  224. $(function() {
  225. Feng.addAjaxSelect({
  226. "id": 'talentId',
  227. "displayCode": "id",
  228. "displayName": "name",
  229. "type": "GET",
  230. "url": Feng.ctxPath + "/api/talentInfo/findTalentByEnterpriseInLibrary?type=2&year="+$("#year").val()
  231. });
  232. //批量加载字典表数据
  233. var arr = [
  234. {"name":"cardType","code":"un_cardType"},
  235. {"name":"spouseCardType","code":"un_cardType"},
  236. {"name":"childCardType","code":"un_cardType"},
  237. {"name":"marryStatus","code":"un_marryStatus"},
  238. {"name":"talentArrange","code":"un_talentLevel"},
  239. {"name":"street","code":"un_street"}];
  240. Feng.findChildDictBatch(JSON.stringify(arr));
  241. $(".other_talentArrange").empty().append($("#talentArrange").html());
  242. loadProvince();
  243. $("select").each(function () {$(this).val($(this).attr("value")).trigger("change");});
  244. });