/**
|
* 初始化区域城市详情对话框
|
*/
|
var AreaCityInfoDlg = {
|
areaCityInfoData : {}
|
};
|
|
/**
|
* 清除数据
|
*/
|
AreaCityInfoDlg.clearData = function() {
|
this.areaCityInfoData = {};
|
};
|
|
/**
|
* 设置对话框中的数据
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
AreaCityInfoDlg.set = function(key, val) {
|
this.areaCityInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
};
|
|
/**
|
* 设置对话框中的数据
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
AreaCityInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
};
|
|
/**
|
* 关闭此对话框
|
*/
|
AreaCityInfoDlg.close = function() {
|
parent.layer.close(window.parent.AreaCity.layerIndex);
|
};
|
|
/**
|
* 收集数据
|
*/
|
AreaCityInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('provinceCode', Feng.get_chosen_selected( "#cityCode1"))
|
.set('provinceName')
|
.set('cityCode', Feng.get_chosen_selected( "#cityCode2"))
|
.set('cityName')
|
.set('countyCode', Feng.get_chosen_selected( "#cityCode"))
|
.set('countyName')
|
.set('isOpen', Feng.getRadioVal("isOpen"))
|
.set('isDelete')
|
.set('createTime');
|
};
|
|
/**
|
* 验证数据
|
*/
|
AreaCityInfoDlg.validate = function () {
|
if (Feng.get_chosen_selected( "#cityCode") == -1) {
|
Feng.info("请选择城市!");
|
return false;
|
}
|
return true;
|
};
|
|
/**
|
* 提交添加
|
*/
|
AreaCityInfoDlg.addSubmit = function() {
|
this.clearData();
|
this.collectData();
|
|
if (!this.validate()) {
|
return;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/areaCity/add", function(data){
|
if(data.code == 200){
|
Feng.success("添加成功!");
|
window.parent.AreaCity.table.refresh();
|
AreaCityInfoDlg.close();
|
} else {
|
Feng.error("添加失败!" + data.message);
|
}
|
},function(){
|
Feng.error("添加失败!");
|
});
|
ajax.set(this.areaCityInfoData);
|
ajax.start();
|
};
|
|
/**
|
* 提交修改
|
*/
|
AreaCityInfoDlg.editSubmit = function() {
|
this.clearData();
|
this.collectData();
|
|
if (!this.validate()) {
|
return;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/areaCity/update", function(data){
|
if(data.code == 200){
|
Feng.success("修改成功!");
|
window.parent.AreaCity.table.refresh();
|
AreaCityInfoDlg.close();
|
} else {
|
Feng.error("修改失败!" + data.message);
|
}
|
},function(data){
|
Feng.error("修改失败!");
|
});
|
ajax.set(this.areaCityInfoData);
|
ajax.start();
|
};
|
|
$(function() {
|
|
});
|