123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- /**
- * 初始化房租补助详情对话框
- */
- var HouseRentingFeesInfoDlg = {
- houseRentingFeesInfoData : {},
- validateFields: {
- baseId: {validators: {notEmpty: {message: '申报对象不能为空'}}},
- email: {validators: {notEmpty: {message: '电子邮箱不能为空'}}},
- bankAddress: {validators: {notEmpty: {message: '开户银行网点不能为空'}}},
- bankAccount: {validators: {notEmpty: {message: '银行账号不能为空'}}},
- }
- };
- /**
- * 清除数据
- */
- HouseRentingFeesInfoDlg.clearData = function() {
- this.houseRentingFeesInfoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HouseRentingFeesInfoDlg.set = function(key, val) {
- this.houseRentingFeesInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HouseRentingFeesInfoDlg.get = function(key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- HouseRentingFeesInfoDlg.close = function() {
- parent.layer.close(window.parent.HouseRentingFees.layerIndex);
- }
- /**
- * 收集数据
- */
- HouseRentingFeesInfoDlg.collectData = function() {
- this
- .set('id')
- .set('baseId')
- .set('phone')
- .set('email')
- .set('bankAddress')
- .set('bankAccount')
- .set('checkState');
- }
- /**
- * 验证数据
- */
- HouseRentingFeesInfoDlg.validate = function () {
- $('#houseRentingPurchaseFeesInfoForm').data("bootstrapValidator").resetForm();
- $('#houseRentingPurchaseFeesInfoForm').bootstrapValidator('validate');
- return $("#houseRentingPurchaseFeesInfoForm").data('bootstrapValidator').isValid();
- }
- HouseRentingFeesInfoDlg.nameChange = function(){
- var baseId = $("#baseId").val();
- if(Feng.isNotEmptyStr(baseId)){
- var ajax = new $ax(Feng.ctxPath + "/api/houseRenting/detail/"+baseId, function(data){
- var talentInfo = data;
- $("#sex").val(talentInfo.sex);
- $("#cardTypeName").val(talentInfo.cardTypeName);
- $("#idCard").val(talentInfo.idCard);
- $("#nativePlace").val(talentInfo.nativePlace);
- $("#talentArrangeName").val(talentInfo.talentArrangeName);
- $("#entryTime").val(talentInfo.entryTime);
- $("#post").val(talentInfo.post);
- $("#enterpriseAddress").val(talentInfo.enterpriseAddress);
- $("#phone").val(talentInfo.phone);
- $("#email").val(talentInfo.email);
- $("#marryStatusName").val(talentInfo.marryStatusName);
- $("#houseTypeName").val(talentInfo.houseTypeName);
- $("#rentAddress").val(talentInfo.rentAddress);
- $("#rentStartTime").val(talentInfo.rentStartTime);
- $("#rentEndTime").val(talentInfo.rentEndTime);
- $("#rentMoney").val(talentInfo.rentMoney);
- $("#spouseName").val(talentInfo.spouseName);
- $("#spouseSex").val(talentInfo.spouseSex);
- $("#spouseCardTypeName").val(talentInfo.spouseCardTypeName);
- $("#spouseIdCard").val(talentInfo.spouseIdCard);
- $("#spouseNativePlace").val(talentInfo.spouseNativePlace);
- $("#spouseTalentArrangeName").val(talentInfo.spouseTalentArrangeName);
- $("#spouseEntryTime").val(talentInfo.spouseEntryTime);
- $("#spousePost").val(talentInfo.spousePost);
- $("#spouseEnterpriseName").val(talentInfo.spouseEnterpriseName);
- $("#spouseEnterpriseAddress").val(talentInfo.spouseEnterpriseAddress);
- $("#spousePhone").val(talentInfo.spousePhone);
- $("#spouseEmail").val(talentInfo.spouseEmail);
- },function(data){
- Feng.error("查询失败!" + data.responseJSON.message + "!");
- });
- ajax.start();
- }
- }
- /**
- * 提交添加
- */
- HouseRentingFeesInfoDlg.addSubmit = function() {
- var id = $("#id").val();
- if(Feng.isNotEmptyStr(id)){
- HouseRentingFeesInfoDlg.editSubmit(1);
- return;
- }
- this.clearData();
- this.collectData();
- if(!HouseRentingFeesInfoDlg.validate()){
- return ;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/add", function(data){
- if(data.code == 200){
- Feng.success(data.msg);
- $("#id").val(data.obj.id);
- $("#fileLi").removeAttr("style");
- $("#checkState").val(data.obj.checkState);
- }else{
- Feng.info(data.msg);
- }
- },function(data){
- Feng.error("添加失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.houseRentingFeesInfoData);
- ajax.start();
- }
- /**
- * 提交修改
- */
- HouseRentingFeesInfoDlg.editSubmit = function(type) {
- this.clearData();
- this.collectData();
- if(!validateIsEdit())return;
- if(!HouseRentingFeesInfoDlg.validate()){
- return ;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/update", function(data){
- if(data.code == 200){
- if(type == 1){
- Feng.success(data.msg);
- }else{
- HouseRentingFeesInfoDlg.submitToCheck();
- }
- }else{
- Feng.info(data.msg);
- }
- },function(data){
- Feng.error("修改失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.houseRentingFeesInfoData);
- ajax.start();
- }
- /**
- * 提交审核
- */
- HouseRentingFeesInfoDlg.submitToCheck = function(){
- if(!validateIsEdit())return;
- var operation = function() {
- var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/submitToCheck", function (data) {
- if(data.code==200){
- Feng.success(data.msg);
- window.parent.HouseRentingFees.table.refresh();
- HouseRentingFeesInfoDlg.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_rentingFees+"')\" 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;
- }
- $(function() {
- Feng.initValidatorTip("houseRentingFeesInfoForm", HouseRentingFeesInfoDlg.validateFields);
- 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_rentingFees,"mainId":id,"typeFileId":"","active":1})
- }else{
- $("#fileLi").attr("style","pointer-events: none");
- }
- });
|