/** * 初始化购房补贴详情对话框 */ var HousepurchaseInfoDlg = { housepurchaseInfoData : {}, validateFields: { enterpriseId: {validators: {notEmpty: {message: '所属企业不能为空'}}}, name: {validators: {notEmpty: {message: '姓名不能为空'}}}, declareObject: {validators: {notEmpty: {message: '申报对象不能为空'}}}, declareType: {validators: {notEmpty: {message: '申报类型不能为空'}}}, cardType: {validators: {notEmpty: {message: '证件类型不能为空'}}}, idCard: {validators: {notEmpty: {message: '证件号码不能为空'}}}, marryStatus: {validators: {notEmpty: {message: '婚姻状态不能为空'}}}, // houseAddress: {validators: {notEmpty: {message: '房屋坐落地址不能为空'}}}, // houseArea: {validators: {notEmpty: {message: '房源购置面积不能为空'}}}, // recordTime: {validators: {notEmpty: {message: '商品房购房合同备案时间不能为空'}}}, // houseMoney: {validators: {notEmpty: {message: '房屋成交金额不能为空'}}}, // isEnjoyOther: {validators: {notEmpty: {message: '是否享受我市其他政策不能为空'}}}, // realEstateNo: { // validators: { // notEmpty: { // message: '不动产权证编号不能为空' // }, // regexp: { // regexp: /^闽\([0-9]{4}\)晋江市不动产权第\([0-9]+\)号$/, // message: "不动产权证编号格式不正确" // } // } // }, // recordNo: { // validators: { // notEmpty: { // message: '备案合同编号不能为空' // }, // regexp: { // regexp: /^\d+$/, // message: "备案合同编号格式不正确" // } // } // }, phone: { validators: { notEmpty: { message: '手机号码不能为空' }, regexp: { regexp: /0?(13|14|15|17|18|19)[0-9]{9}/, message: "手机号码格式不正确" } } }, bank: { validators: { notEmpty: { message: '开户银行不能为空' }, regexp: { regexp: /^[\u4e00-\u9fa5]*银行$/, message: "开户银行格式不正确" } } }, bankAccount: { validators: { notEmpty: { message: '银行账号不能为空' }, regexp: { regexp: /^\d+$/, message: "银行账号格式不正确" } } }, // number:{ // validators: { // notEmpty: { // message: '享受第几次购房补贴不能为空' // }, // regexp: { // regexp: /^[1-5]$/, // message: "享受第几次购房补贴格式不正确" // } // } // } } }; /** * 清除数据 */ HousepurchaseInfoDlg.clearData = function() { this.housepurchaseInfoData = {}; } /** * 设置对话框中的数据 * @param key 数据的名称 * @param val 数据的具体值 */ HousepurchaseInfoDlg.set = function(key, val) { this.housepurchaseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; return this; } /** * 设置对话框中的数据 * @param key 数据的名称 * @param val 数据的具体值 */ HousepurchaseInfoDlg.get = function(key) { return $("#" + key).val(); } /** * 关闭此对话框 */ HousepurchaseInfoDlg.close = function() { parent.layer.close(window.parent.Housepurchase.layerIndex); } /** * 收集数据 */ HousepurchaseInfoDlg.collectData = function() { this .set('id') .set('talentId') .set('type') .set('declareType') .set('declareObject') .set('year') .set('name') .set('cardType') .set('idCard') .set('provinceCode') .set('cityCode') .set('countyCode') .set('street') .set('talentType') .set('talentArrange') .set('certificateStartTime') .set('certificateEndTime') .set('identifyCondition') .set('idenfityConditionName') .set('identifyGetTime') .set('phone') .set('marryStatus') .set('spouseName') .set('spouseCardType') .set('spouseIdcard') .set('childName') .set('childCardType') .set('childIdCard') .set('number') .set('houseAddress') .set('houseArea') .set('recordTime') .set('houseMoney') .set('realEstateNo') .set('recordNo') .set('isEnjoyOther') .set('bank') .set('bankNetwork') .set('bankAccount') .set('bankNumber') .set('spouseIsLibrary'); if($("#provinceCode").val()!=null && $("#provinceCode").val()!=''){ this.housepurchaseInfoData["provinceName"] = $("#provinceCode").find("option:selected").text(); } if($("#cityCode").val()!=null && $("#cityCode").val()!=''){ this.housepurchaseInfoData["cityName"] = $("#cityCode").find("option:selected").text(); } if($("#countyCode").val()!=null && $("#countyCode").val()!=''){ this.housepurchaseInfoData["countyName"] = $("#countyCode").find("option:selected").text(); } } /** * 验证数据 */ HousepurchaseInfoDlg.validate = function () { $('#houseInfoForm').data("bootstrapValidator").resetForm(); $('#houseInfoForm').bootstrapValidator('validate'); return $("#houseInfoForm").data('bootstrapValidator').isValid(); } HousepurchaseInfoDlg.nameChange = function(){ var talentId = $("#talentId").val(); var declareType = $("#declareType").val(); if(Feng.isEmptyStr(declareType)){ Feng.info("请先选择申报类型"); $("#talentId").val("").trigger('chosen:updated');; return; } if(Feng.isNotEmptyStr(talentId)){ var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/init/"+talentId, function(data){ if(data.code == 200){ var talentInfo = data.obj.talentInfo; var houseInfo = data.obj.houseInfo; if(houseInfo.count>=5){ Feng.info("当前申报人所关联房产已享受5次补贴,无法再次申报");return; } $("#name").val(talentInfo.name); $("#cardType").val(talentInfo.cardType); $("#idCard").val(talentInfo.idCard); $("#provinceCode").val(talentInfo.provinceCode).trigger("change"); $("#cityCode").val(talentInfo.cityCode).trigger("change"); $("#countyCode").val(talentInfo.countyCode); $("#street").val(talentInfo.address); $("#phone").val(talentInfo.phone); $("#bank").val(talentInfo.bank); $("#bankNumber").val(talentInfo.bankNumber); $("#bankNetwork").val(talentInfo.bankNetwork); $("#bankAccount").val(talentInfo.bankAccount); $("#talentArrange").val(talentInfo.talentArrange).trigger("change"); $("#certificateStartTime").val(talentInfo.certificateStartTime); $("#certificateEndTime").val(talentInfo.qzgccrcActiveTime); $("#identifyCondition").val(talentInfo.identifyCondition); $("#idenfityConditionName").val(talentInfo.identifyConditionName); $("#identifyGetTime").val(talentInfo.identifyGetTime); if(Feng.isNotEmptyStr(houseInfo)){ $("#realEstateNo").val(houseInfo.realEstateNo).attr("style","pointer-events: none;background-color: #eee;"); $("#recordNo").val(houseInfo.recordNo).attr("style","pointer-events: none;background-color: #eee;"); $("#houseAddress").val(houseInfo.houseAddress).attr("style","pointer-events: none;background-color: #eee;"); $("#houseArea").val(houseInfo.houseArea).attr("style","pointer-events: none;background-color: #eee;"); $("#recordTime").val(houseInfo.recordTime).attr("style","pointer-events: none;background-color: #eee;"); $("#houseMoney").val(houseInfo.houseMoney).attr("style","pointer-events: none;background-color: #eee;"); }else{ $("#realEstateNo").val("").removeAttr("style"); $("#recordNo").val("").attr("style"); $("#houseAddress").val("").attr("style"); $("#houseArea").val("").attr("style"); $("#recordTime").val("").attr("style"); $("#houseMoney").val("").attr("style"); } }else{ $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val(""); Feng.info(data.msg); } },function(data){ Feng.error("查询失败!" + data.responseJSON.message + "!"); }); ajax.set("year",$("#year").val()) ajax.set("declareType",declareType) ajax.start(); } } /** * 添加未成年子女 */ HousepurchaseInfoDlg.addChild = function(){ var options = $("#cardType").html(); $("#childData").append( '
\n' + '\n' + ''+ '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '
'+ '
'); } /** * 删除子女信息 */ HousepurchaseInfoDlg.reduceChild = function(context){ var id = $(context).parent().find("input[name='id']").val(); if(Feng.isEmptyStr(id)){ $(context).parent().remove(); }else{ if(!validateIsEdit())return; var operation = function () { var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/deleteChildren", function(data){ if(data.code == 200){ $(context).parent().remove(); Feng.success(data.msg); }else{ Feng.info(data.msg); } },function(data){ Feng.error("删除失败!" + data.responseJSON.message + "!"); }); ajax.set("id",id); ajax.start(); } Feng.confirm("删除后无法恢复,确认删除吗?", operation); } } /** * 提交添加 */ HousepurchaseInfoDlg.addSubmit = function() { var id = $("#id").val(); if(Feng.isNotEmptyStr(id)){ HousepurchaseInfoDlg.editSubmit(1); return; } this.clearData(); this.collectData(); if(!HousepurchaseInfoDlg.validate()){ return ; } if(Feng.isNotEmptyStr(this.housepurchaseInfoData.houseMoney) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseMoney)){ Feng.info("房屋成交金额格式不正确!"); return ; } if(Feng.isNotEmptyStr(this.housepurchaseInfoData.houseArea) && !/^([1-9][0-9]*)+(\.[0-9]{0,10})?$/.test(this.housepurchaseInfoData.houseArea)){ Feng.info("房屋建筑面积格式不正确!"); return ; } if(this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3){ Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!"); return ; } //提交信息 var child = new Array(); var error = ""; $("#childData .col-sm-12").each(function (index) { var id = $(this).find("input[name='id']").val(); var pId = $(this).find("input[name='pId']").val(); var childName = $(this).find("input[name='childName']").val(); var childCardType = $(this).find("select[name='childCardType']").val(); var childIdCard = $(this).find("input[name='childIdCard']").val(); if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)){ if(Feng.isEmptyStr(childName)){ error = error + "第"+ (index + 1) + "行未成年子女姓名为空;\n"; } if(Feng.isEmptyStr(childCardType)){ error = error + "第"+ (index + 1) + "行未成年子女证件类型为空;\n"; } if(Feng.isEmptyStr(childIdCard)){ error = error + "第"+ (index + 1) + "行未成年子女证件号码为空;\n"; } child.push({"id":id,"pId":pId,"name":childName,"cardType":childCardType,"idCard":childIdCard}); } }); this.housepurchaseInfoData['childList'] = child; var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/add", function(data){ if(data.code == 200){ var obj = data.obj; var childList = obj.childList; Feng.success(data.msg); $("#id").val(obj.id); $("#type").val(obj.type); $("#fileLi").removeAttr("style"); $("#checkState").val(obj.checkState); $("#talentId").prop("disabled",true).trigger("chosen:updated"); HousepurchaseInfoDlg.initChildData(childList); }else{ Feng.info(data.msg); } },function(data){ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); ajax.setcontentType("application/json;charset=utf-8"); ajax.setData(JSON.stringify(this.housepurchaseInfoData)); ajax.start(); } /** * 提交修改 */ HousepurchaseInfoDlg.editSubmit = function(type) { this.clearData(); this.collectData(); if(!validateIsEdit())return; if(!HousepurchaseInfoDlg.validate()){ //校验 return ; } if(this.housepurchaseInfoData.declareObject == 2 || this.housepurchaseInfoData.declareObject == 3){ Feng.info("此种申报对象请通过线下申报,系统不支持旧政策申报流程!"); return ; } //提交信息 var child = new Array(); var error = ""; $("#childData .col-sm-12").each(function (index) { var id = $(this).find("input[name='id']").val(); var pId = $(this).find("input[name='pId']").val(); var childName = $(this).find("input[name='childName']").val(); var childCardType = $(this).find("select[name='childCardType']").val(); var childIdCard = $(this).find("input[name='childIdCard']").val(); if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(childName) || Feng.isNotEmptyStr(childCardType) || Feng.isNotEmptyStr(childIdCard)){ if(Feng.isEmptyStr(childName)){ error = error + "第"+ (index + 1) + "行未成年子女姓名为空;\n"; } if(Feng.isEmptyStr(childCardType)){ error = error + "第"+ (index + 1) + "行未成年子女证件类型为空;\n"; } if(Feng.isEmptyStr(childIdCard)){ error = error + "第"+ (index + 1) + "行未成年子女证件号码为空;\n"; } child.push({"id":id,"pId":pId,"name":childName,"cardType":childCardType,"idCard":childIdCard}); } }); this.housepurchaseInfoData['childList'] = child; //提交信息 var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/update", function(data){ if(data.code == 200){ if(type == 1){ var childList = data.obj.childList; Feng.success(data.msg); HousepurchaseInfoDlg.initChildData(childList); }else{ HousepurchaseInfoDlg.submitToCheck(); } }else{ Feng.info(data.msg); } },function(data){ Feng.error("修改失败!" + data.responseJSON.message + "!"); }); ajax.setcontentType("application/json;charset=utf-8"); ajax.setData(JSON.stringify(this.housepurchaseInfoData)); ajax.start(); } /** * 初始化子女信息 * @param list */ HousepurchaseInfoDlg.initChildData = function(list){ var options = $("#cardType").html(); var html = ""; for(var key in list) { html = html + '
\n' + '\n' + '' + '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '
'+ '
'; } if(Feng.isEmptyStr(html)){ html = html + '
\n' + '\n' + '' + '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '
'; } $("#childData").empty().append(html); $("#childData select").each(function () { $(this).val($(this).attr("value")) }) if(list == null){ HousepurchaseInfoDlg.addChild(); } } /** * 提交审核 */ HousepurchaseInfoDlg.submitToCheck = function(){ if(!validateIsEdit())return; var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/valiateIsSubmit", function (data) { if(data.code == 200){ var operation = function() { var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/submitToCheck", function (data) { if(data.code==200){ Feng.success(data.msg); window.parent.Housepurchase.table.refresh(); HousepurchaseInfoDlg.close(); }else{ Feng.error(data.msg); } }, function (data) { Feng.error("提交审核失败!" + data.responseJSON.message + "!"); }); ajax.set("id", $("#id").val()); ajax.start(); } Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation); }else{ Feng.error(data.msg); } }, function (data) { Feng.error("查询失败!" + data.responseJSON.message + "!"); }); ajax.set("type",CONFIG.project_house); ajax.set("id",$("#id").val()) ajax.start(); } /** * 申报对象级联 */ HousepurchaseInfoDlg.declareObjChange = function(){ var declareObj = $("#declareObject").val(); switch (declareObj) { case "": break; case "1": //新政策中公布入选为晋江市优秀人才后再购房对象 break; case "2": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库) Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!"); break; case "3": //旧政策中取得购房补贴指标后完成购房,且符合新政策认定标准对象(在库) Feng.info("此种对象请通过线下申报,线上不支持旧政策的申报流程!"); break; } } /** * 根据申报类型 */ HousepurchaseInfoDlg.typeChange = function(){ var type = $("#declareType").val(); if(type == null){ $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none"); } if(type == 1){ $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display","block"); } if(type == 2){ $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none"); } } /** * 获取认定条件 */ HousepurchaseInfoDlg.getIdentifyCondition = function(){ var level = $("#talentArrange").val(); if(level==null||level==''){ $("#identifyCondition").empty(); return; } Feng.addAjaxSelect({ "id": "identifyCondition", "displayCode": "id", "displayName": "name", "type": "GET", "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level }); } /** * 校验是否显示按钮 * @param type 类型 1-上传按钮,2-修改删除按钮 * @param row * @returns {string} */ function validUploadButton(type,row,fileId){ var files = $("#files").val(); var checkState = $("#checkState").val(); if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 10 && files.indexOf(row.id)!=-1)){ return type == 1? "" : "" + ""; }else{ return type == 1?"":"" ; } } function validateIsEdit(){ var id = $("#id").val(); var checkState = $("#checkState").val(); if(Feng.isEmptyStr(id)){ Feng.info("请先填写基础信息并上传附件"); return false; } if(checkState != 1 && checkState != 10){ if(checkState==-1){ Feng.error("您的申报审核不通过,无法修改"); return false; }else if(checkState>=40){ Feng.error("您的申报已审核通过,无法修改"); return false; }else{ Feng.error("您的申报正在审核中,请耐心等待"); return false; } } return true; } //设置不可修改的字段 HousepurchaseInfoDlg.setNoChangeField = function () { var checkState = $("#checkState").val(); var fields = $("#fields").val(); if(checkState==10){ $("#basicData input,textarea").each(function () { $(this).attr("readonly","readonly"); }); $("#basicData select").each(function () { $(this).attr("disabled","disabled"); }); if(fields!=null && fields!=''){ var arr = fields.split(","); for(var key in arr){ var name = $("#" + arr[key]).prop("tagName"); if(name=='select' || name=='SELECT'){ $("#" + arr[key]).removeAttr("disabled"); }if(name=="input" || name=='textarea' || name=="INPUT" || name=='TEXTAREA'){ $("#" + arr[key]).removeAttr("readonly"); } } } } } /** * 获取房产信息 */ HousepurchaseInfoDlg.getHouseInfo = function(){ var idCard = $("#idCard").val(); var spouseIdcard = $("#spouseIdcard").val(); if(Feng.isEmptyStr(idCard)){ Feng.info("请选择申报人");return ; } var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/getHouseInfo", function(data){ if(data.code == 200){ var houseInfo = data.obj; if(houseInfo.count>=5){ Feng.info("当前申报人(或配偶)所关联房产已享受5次补贴,无法再次申报");return; } if(Feng.isNotEmptyStr(houseInfo)){ $("#realEstateNo").val(houseInfo.realEstateNo).attr("style","pointer-events: none;background-color: #eee;"); $("#recordNo").val(houseInfo.recordNo).attr("style","pointer-events: none;background-color: #eee;"); $("#houseAddress").val(houseInfo.houseAddress).attr("style","pointer-events: none;background-color: #eee;"); $("#houseArea").val(houseInfo.houseArea).attr("style","pointer-events: none;background-color: #eee;"); $("#recordTime").val(houseInfo.recordTime).attr("style","pointer-events: none;background-color: #eee;"); $("#houseMoney").val(houseInfo.houseMoney).attr("style","pointer-events: none;background-color: #eee;"); }else{ $("#realEstateNo").val("").removeAttr("style"); $("#recordNo").val("").attr("style"); $("#houseAddress").val("").attr("style"); $("#houseArea").val("").attr("style"); $("#recordTime").val("").attr("style"); $("#houseMoney").val("").attr("style"); } }else{ $("#talentId,#cardType,#idCard,#provinceCode,#cityCode,#countyCode,#street,#phone,#bank,#bankNumber,#bankNetwork,#bankAccount,#talentArrange,#identifyCondition,#identifyConditionName,#identifyGetTime").val(""); Feng.info(data.msg); } },function(data){ Feng.error("查询失败!" + data.responseJSON.message + "!"); }); ajax.set("idCard",idCard); ajax.set("spouseIdcard",spouseIdcard); ajax.start(); } $(function() { Feng.initValidatorTip("houseInfoForm", HousepurchaseInfoDlg.validateFields); Feng.addAjaxSelect({ "id": 'talentId', "displayCode": "id", "displayName": "name", "type": "GET", "url": Feng.ctxPath + "/api/talentInfo/findTalentByEnterpriseInLibrary?type=2&year="+$("#year").val() }); //批量加载字典表数据 var arr = [ {"name":"cardType","code":"un_cardType"}, {"name":"spouseCardType","code":"un_cardType"}, {"name":"childCardType","code":"un_cardType"}, {"name":"marryStatus","code":"un_marryStatus"}, {"name":"talentArrange","code":"un_talentLevel"}, {"name":"street","code":"un_street"}]; Feng.findChildDictBatch(JSON.stringify(arr)); $("select[name='childCardType']").append($("#cardType").html()); $(".other_talentArrange").empty().append($("#talentArrange").html()); loadProvince(); //加载时间控件 $(".date").each(function(){laydate.render({ elem: this,type: 'date',trigger: 'click' }); }); var id = $("#id").val(); if(Feng.isNotEmptyStr(id)){ $("select").each(function () {$(this).val($(this).attr("value")).trigger("change");}); $("#fileLi").removeAttr("style"); Feng.getCheckLog("logTable",{"type":CONFIG.project_house,"mainId":id,"typeFileId":"","active":1}) }else{ $("#fileLi").attr("style","pointer-events: none"); $("#talentId").on('chosen:ready', function(e, params) { $(".chosen-container-single .chosen-single").css("padding","4px 0px 0px 4px"); }); $("#talentId").chosen({ search_contains:true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配 disable_search: false, width:"100%", enable_split_word_search: true }); } HousepurchaseInfoDlg.setNoChangeField(); toastr.options = { "closeButton": true, "debug": false, "positionClass": "toast-bottom-right", "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "600000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut", "tapToDismiss":true }; toastr.success("免租入住仅人才标签为在站博士后的人才申报!!!"); });