123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- /**
- * 初始化购房补助详情对话框
- */
- var HouseRentingPurchaseFeesInfoDlg = {
- houseRentingPurchaseFeesInfoData : {},
- validateFields: {
- talentId: {validators: {notEmpty: {message: '申报对象不能为空'}}},
- email: {validators: {notEmpty: {message: '电子邮箱不能为空'}}},
- houseType: {validators: {notEmpty: {message: '房产人才社区不能为空'}}},
- cardType: {validators: {notEmpty: {message: '证件类型不能为空'}}},
- idCard: {validators: {notEmpty: {message: '证件号码不能为空'}}},
- marryStatus: {validators: {notEmpty: {message: '婚姻状态不能为空'}}},
- houseMoney: {
- validators: {
- notEmpty: {
- message: '房产成交金额不能为空'
- },
- regexp :{
- regexp: /^([1-9][0-9]*)+(\.[0-9]{1,10})?$/,
- message:"房产成交金额格式不正确"
- }
- }
- },
- }
- };
- /**
- * 清除数据
- */
- HouseRentingPurchaseFeesInfoDlg.clearData = function() {
- this.houseRentingPurchaseFeesInfoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HouseRentingPurchaseFeesInfoDlg.set = function(key, val) {
- this.houseRentingPurchaseFeesInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HouseRentingPurchaseFeesInfoDlg.get = function(key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- HouseRentingPurchaseFeesInfoDlg.close = function() {
- parent.layer.close(window.parent.HouseRentingPurchaseFees.layerIndex);
- }
- /**
- * 收集数据
- */
- HouseRentingPurchaseFeesInfoDlg.collectData = function() {
- this
- .set('id')
- .set('type')
- .set('talentId')
- .set('phone')
- .set('email')
- .set('marryStatus')
- .set('spouseName')
- .set('spouseSex')
- .set('spouseCardType')
- .set('spouseIdCard')
- .set('spouseTalentArrange')
- .set('spouseNativePlace')
- .set('spouseEntryTime')
- .set('spousePost')
- .set('spouseEnterpriseName')
- .set('spouseEnterpriseAddress')
- .set('spouseAddress')
- .set('spousePhone')
- .set('spouseEmail')
- .set('houseAddress')
- .set('houseMoney')
- .set('bankAddress')
- .set('bankAccount')
- .set('checkState');
- }
- /**
- * 验证数据
- */
- HouseRentingPurchaseFeesInfoDlg.validate = function () {
- $('#houseRentingPurchaseFeesInfoForm').data("bootstrapValidator").resetForm();
- $('#houseRentingPurchaseFeesInfoForm').bootstrapValidator('validate');
- return $("#houseRentingPurchaseFeesInfoForm").data('bootstrapValidator').isValid();
- }
- HouseRentingPurchaseFeesInfoDlg.nameChange = function(){
- var talentId = $("#talentId").val();
- if(Feng.isNotEmptyStr(talentId)){
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingPurchaseFees/initData/"+talentId, function(data){
- if(data.code == 200){
- var talentInfo = data.obj;
- $("#sex").val(talentInfo.sex);
- $("#cardType").val(talentInfo.cardType);
- $("#idCard").val(talentInfo.idCard);
- $("#nativePlace").val(talentInfo.nativePlace);
- $("#talentArrange").val(talentInfo.talentArrange);
- $("#entryTime").val(talentInfo.entryTime);
- $("#post").val(talentInfo.post);
- $("#enterpriseAddress").val(talentInfo.enterpriseAddress);
- $("#phone").val(talentInfo.phone);
- $("#email").val(talentInfo.email);
- $("#marryStatus").val(talentInfo.marryStatus);
- $("#houseType").val(talentInfo.marryStatus);
- $("#houseAddress").val(talentInfo.applyAddress);
- $("#spouseName").val(talentInfo.spouseName);
- $("#spouseSex").val(talentInfo.spouseSex);
- $("#spouseCardType").val(talentInfo.spouseCardType);
- $("#spouseIdCard").val(talentInfo.spouseIdCard);
- $("#spouseNativePlace").val(talentInfo.spouseNativePlace);
- $("#spouseTalentArrange").val(talentInfo.spouseTalentArrange);
- $("#spouseEntryTime").val(talentInfo.spouseEntryTime);
- $("#spousePost").val(talentInfo.spousePost);
- $("#spouseEnterpriseName").val(talentInfo.spouseEnterpriseName);
- $("#spouseEnterpriseAddress").val(talentInfo.spouseEnterpriseAddress);
- $("#spousePhone").val(talentInfo.spousePhone);
- $("#spouseEmail").val(talentInfo.spouseEmail);
- $("#bankAddress").val(talentInfo.bankAddress);
- $("#bankAccount").val(talentInfo.bankAccount);
- var html = "";
- var options = $("#cardType").html();
- for (let key in data.obj.childList){
- var child = data.obj.childList[key];
- html = html +
- '<div class="col-sm-12">\n' +
- '<input type="hidden" name="id"/>\n' +
- '<input type="hidden" name="pId" />'+
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childName" value="'+child.name+'" placeholder="未成年子女姓名"/>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<select class="form-control" name="childCardType" value="'+child.cardType+'" placeholder="未成年子女证件类型">\n' +
- options+
- '</select>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childIdCard" value="'+child.idCard+'" placeholder="未成年子女证件号码"/>\n' +
- '</div>\n' +
- '<div class="add-btn" onclick="HouseRentingPurchaseFeesInfoDlg.addChild()"></div>\n' +
- '<div class="reduce" onclick="HouseRentingPurchaseFeesInfoDlg.reduceChild(this)"></div>'+
- '</div>';
- }
- $("#childData").empty().append(html);
- $("select[name='childCardType']").each(function () {
- $(this).val($(this).attr("value"));
- })
- }else{
- Feng.info(data.msg);
- }
- },function(data){
- Feng.error("查询失败!" + data.responseJSON.message + "!");
- });
- ajax.start();
- }
- }
- /**
- * 添加未成年子女
- */
- HouseRentingPurchaseFeesInfoDlg.addChild = function(){
- var options = $("#cardType").html();
- $("#childData").append(
- '<div class="col-sm-12">\n' +
- '<input type="hidden" name="id"/>\n' +
- '<input type="hidden" name="pId"/>'+
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
- options+
- '</select>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
- '</div>\n' +
- '<div class="add-btn" onclick="HouseRentingPurchaseFeesInfoDlg.addChild()"></div>\n' +
- '<div class="reduce" onclick="HouseRentingPurchaseFeesInfoDlg.reduceChild(this)"></div>'+
- '</div>');
- }
- /**
- * 删除子女信息
- */
- HouseRentingPurchaseFeesInfoDlg.reduceChild = function(context){
- var id = $(context).parent().find("input[name='id']").val();
- if(Feng.isEmptyStr(id)){
- $(context).parent().remove();
- if($("#childData").children().length == 0){
- HouseRentingPurchaseFeesInfoDlg.addChild();
- }
- }else{
- if(!validateIsEdit())return;
- var operation = function () {
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingPurchaseFees/deleteChildren", function(data){
- if(data.code == 200){
- $(context).parent().remove();
- Feng.success(data.msg);
- if($("#childData").children().length == 0){
- HouseRentingPurchaseFeesInfoDlg.addChild();
- }
- }else{
- Feng.info(data.msg);
- }
- },function(data){
- Feng.error("添加失败!" + data.responseJSON.message + "!");
- });
- ajax.set("id",id);
- ajax.start();
- }
- Feng.confirm("删除后无法恢复,确认删除吗?", operation);
- }
- }
- /**
- * 提交添加
- */
- HouseRentingPurchaseFeesInfoDlg.addSubmit = function() {
- var id = $("#id").val();
- if(Feng.isNotEmptyStr(id)){
- HouseRentingPurchaseFeesInfoDlg.editSubmit(1);
- return;
- }
- this.clearData();
- this.collectData();
- if(!HouseRentingPurchaseFeesInfoDlg.validate()){
- 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});
- }
- });
- if (Feng.isNotEmptyStr(error)){
- Feng.info(error);
- return;
- }
- this.houseRentingPurchaseFeesInfoData['childList'] = child;
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingPurchaseFees/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);
- HouseRentingPurchaseFeesInfoDlg.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.houseRentingPurchaseFeesInfoData));
- ajax.start();
- }
- /**
- * 提交修改
- */
- HouseRentingPurchaseFeesInfoDlg.editSubmit = function(type) {
- this.clearData();
- this.collectData();
- if(!validateIsEdit())return;
- if(!HouseRentingPurchaseFeesInfoDlg.validate()){
- 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});
- }
- });
- if (Feng.isNotEmptyStr(error)){
- Feng.info(error);
- return;
- }
- this.houseRentingPurchaseFeesInfoData['childList'] = child;
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingPurchaseFees/update", function(data){
- if(data.code == 200){
- if(type == 1){
- var childList = data.obj.childList;
- Feng.success(data.msg);
- HouseRentingPurchaseFeesInfoDlg.initChildData(childList);
- }else{
- HouseRentingPurchaseFeesInfoDlg.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.houseRentingPurchaseFeesInfoData));
- ajax.start();
- }
- /**
- * 提交审核
- */
- HouseRentingPurchaseFeesInfoDlg.submitToCheck = function(){
- if(!validateIsEdit())return;
- var operation = function() {
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingPurchaseFees/submitToCheck", function (data) {
- if(data.code==200){
- Feng.success(data.msg);
- window.parent.HouseRentingPurchaseFees.table.refresh();
- HouseRentingPurchaseFeesInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- }, function (data) {
- Feng.error("提交审核失败!" + data.responseJSON.message + "!");
- });
- ajax.set("id", $("#id").val());
- ajax.start();
- }
- Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
- }
- /**
- * 校验是否显示按钮
- * @param type 类型 1-上传按钮,2-修改删除按钮
- * @param row
- * @returns {string}
- */
- function validUploadButton(type,row,fileId){
- var checkState = $("#checkState").val();
- if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 4 )){
- return type == 1?
- "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
- "<i class=\"fa fa-upload\"></i>上传" +
- "</button>"
- :
- "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
- "<i class=\"fa fa-paste\"></i>修改" +
- "</button>" +
- "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_renting_purchase_fees+"')\" class=\"btn btn-xs btn-danger\">" +
- "<i class=\"fa fa-times\"></i>删除" +
- "</button>";
- }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 != 4){
- Feng.info("正在审核中或已审核完成,无法操作");
- return false;
- }
- return true;
- }
- /**
- * 初始化子女信息
- * @param list
- */
- HouseRentingPurchaseFeesInfoDlg.initChildData = function(list){
- var options = $("#cardType").html();
- var html = "";
- for(var key in list) {
- html = html +
- '<div class="col-sm-12">\n' +
- '<input type="hidden" name="id" value="'+list[key].id+'"/>\n' +
- '<input type="hidden" name="pId" value="'+list[key].pId+'"/>' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childName" value="'+list[key].name+'" placeholder="未成年子女姓名"/>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<select class="form-control" name="childCardType" value="'+list[key].cardType+'" placeholder="未成年子女证件类型">\n' +
- options +
- '</select>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childIdCard" value="'+list[key].idCard+'" placeholder="未成年子女证件号码"/>\n' +
- '</div>\n' +
- '<div class="add-btn" onclick="HouseRentingPurchaseFeesInfoDlg.addChild()"></div>\n' +
- '<div class="reduce" onclick="HouseRentingPurchaseFeesInfoDlg.reduceChild(this)"></div>'+
- '</div>';
- }
- if(Feng.isEmptyStr(html)){
- html = html +
- '<div class="col-sm-12">\n' +
- '<input type="hidden" name="id" />\n' +
- '<input type="hidden" name="pId" />' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childName" placeholder="未成年子女姓名"/>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<select class="form-control" name="childCardType" placeholder="未成年子女证件类型">\n' +
- options +
- '</select>\n' +
- '</div>\n' +
- '<div class="rowGroup col-sm-3">\n' +
- '<input type="text" class="form-control" name="childIdCard" placeholder="未成年子女证件号码"/>\n' +
- '</div>\n' +
- '<div class="add-btn" onclick="HouseRentingPurchaseFeesInfoDlg.addChild()"></div>\n' +
- '</div>';
- }
- $("#childData").empty().append(html);
- $("#childData select").each(function () {
- $(this).val($(this).attr("value"))
- })
- if(list == null){
- HouseRentingPurchaseFeesInfoDlg.addChild();
- }
- }
- $(function() {
- Feng.initValidatorTip("houseRentingPurchaseFeesInfoForm", HouseRentingPurchaseFeesInfoDlg.validateFields);
- //批量加载字典表数据
- var arr = [
- {"name":"cardType","code":"un_cardType"},
- {"name":"talentArrange","code":"un_talentLevel"},
- {"name":"houseType","code":"un_renting_houseType"},
- {"name":"marryStatus","code":"un_marryStatus"},
- {"name":"spouseCardType","code":"un_cardType"},
- {"name":"spouseTalentArrange","code":"un_talentLevel"}];
- Feng.findChildDictBatch(JSON.stringify(arr));
- $("select[name='childCardType']").empty().append($("#cardType").html());
- //加载时间控件
- $(".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_renting_purchase_fees,"mainId":id,"typeFileId":"","active":1})
- }else{
- $("#fileLi").attr("style","pointer-events: none");
- }
- });
|