/**
|
* 初始化跨城站点管理详情对话框
|
*/
|
var SpecialAreaBillingInfoDlg = {
|
specialAreaBillingInfoData : {},
|
validateFields: {
|
name: {
|
validators: {
|
notEmpty: {
|
message: '站点名称不能为空'
|
}
|
}
|
},
|
provinceCode: {
|
validators: {
|
notEmpty: {
|
message: '请选择站点所属省'
|
}
|
}
|
},
|
}
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
SpecialAreaBillingInfoDlg.validate = function () {
|
$('#siteInfoForm').data("bootstrapValidator").resetForm();
|
$('#siteInfoForm').bootstrapValidator('validate');
|
return $("#siteInfoForm").data('bootstrapValidator').isValid();
|
};
|
|
|
/**
|
* 清除数据
|
*/
|
SpecialAreaBillingInfoDlg.clearData = function() {
|
this.specialAreaBillingInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
SpecialAreaBillingInfoDlg.set = function(key, val) {
|
this.specialAreaBillingInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
SpecialAreaBillingInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
SpecialAreaBillingInfoDlg.close = function() {
|
parent.layer.close(window.parent.SpecialAreaBilling.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
SpecialAreaBillingInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('name')
|
.set('province')
|
.set('provinceCode')
|
.set('city')
|
.set('cityCode')
|
.set('district')
|
.set('districtCode')
|
.set('state')
|
.set('insertTime')
|
.set('insertUserId');
|
}
|
|
/**
|
* 提交添加
|
*/
|
SpecialAreaBillingInfoDlg.addSubmit = function() {
|
|
var areaName = $("#areaName").val();
|
if ("" == areaName ){
|
Feng.error("请填写特殊区域名称");
|
return;
|
}
|
var priceCoefficient = $("#priceCoefficient").val();
|
if ("" == priceCoefficient ){
|
Feng.error("请填写价格系数");
|
return;
|
}
|
var subArr=[];
|
$(".areaValueClass").each(function () {
|
subArr.push({
|
coordinate:$(this).find("input[name*='coordinate1']").val(),
|
})
|
});
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/addSpecialAreaBilling", function(data){
|
if(data.status == 200){
|
Feng.success("添加成功!");
|
window.parent.SpecialAreaBilling.table.refresh();
|
SpecialAreaBillingInfoDlg.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("areaName",areaName);
|
ajax.set("priceCoefficient",priceCoefficient);
|
ajax.set("remark",$("#remark").val());
|
var state = $("#state").is(":checked");
|
var status = 1;
|
if (state){
|
status = 1;
|
} else {
|
status = 2;
|
}
|
ajax.set("state",status);
|
ajax.set("coordinate",coordinate);
|
ajax.start();
|
}
|
/**
|
* 提交添加
|
*/
|
SpecialAreaBillingInfoDlg.addSubmit = function() {
|
|
var areaName = $("#areaName").val();
|
if ("" == areaName ){
|
Feng.error("请填写特殊区域名称");
|
return;
|
}
|
var priceCoefficient = $("#priceCoefficient").val();
|
if ("" == priceCoefficient ){
|
Feng.error("请填写价格系数");
|
return;
|
}
|
var subArr=[];
|
$(".areaValueClass").each(function () {
|
subArr.push({
|
coordinate:$(this).find("input[name*='coordinate1']").val(),
|
})
|
});
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/addSpecialAreaBilling", function(data){
|
if(data.status == 200){
|
Feng.success("添加成功!");
|
window.parent.SpecialAreaBilling.table.refresh();
|
SpecialAreaBillingInfoDlg.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("areaName",areaName);
|
ajax.set("priceCoefficient",priceCoefficient);
|
ajax.set("remark",$("#remark").val());
|
var state = $("#state").is(":checked");
|
var status = 1;
|
if (state){
|
status = 1;
|
} else {
|
status = 2;
|
}
|
ajax.set("state",status);
|
ajax.set("coordinate",coordinate);
|
ajax.start();
|
}
|
SpecialAreaBillingInfoDlg.editSubmit = function() {
|
|
var areaName = $("#areaName").val();
|
if ("" == areaName ){
|
Feng.error("请填写特殊区域名称");
|
return;
|
}
|
var priceCoefficient = $("#priceCoefficient").val();
|
if ("" == priceCoefficient ){
|
Feng.error("请填写价格系数");
|
return;
|
}
|
var subArr=[];
|
$(".areaValueClass").each(function () {
|
subArr.push({
|
coordinate:$(this).find("input[name*='coordinate1']").val(),
|
})
|
});
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/editSpecialAreaBilling", function(data){
|
if(data.status == 200){
|
Feng.success("修改!");
|
window.parent.SpecialAreaBilling.table.refresh();
|
SpecialAreaBillingInfoDlg.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("areaName",areaName);
|
ajax.set("priceCoefficient",priceCoefficient);
|
ajax.set("remark",$("#remark").val());
|
ajax.set("id",$("#id").val());
|
var state = $("#state").is(":checked");
|
var status = 1;
|
if (state){
|
status = 1;
|
} else {
|
status = 2;
|
}
|
ajax.set("state",status);
|
ajax.set("coordinate",coordinate);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
|
$(function() {
|
Feng.initValidator("siteInfoForm", SpecialAreaBillingInfoDlg.validateFields);
|
});
|
|
|
//省改变
|
SpecialAreaBillingInfoDlg.provinceChange = function (e) {
|
var provinceCode=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){
|
if(data!=null){
|
var content='<option value="">选择市</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#cityCode").empty().append(content);
|
$("#districtCode").empty().append('<option value="">选择区</option>');
|
}
|
});
|
ajax.set("code",provinceCode);
|
ajax.start();
|
}
|
//市改变
|
SpecialAreaBillingInfoDlg.cityChange = function (e) {
|
var cityCode=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){
|
if(data!=null){
|
var content='<option value="">选择区</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#districtCode").empty().append(content);
|
}
|
});
|
ajax.set("code",cityCode);
|
ajax.start();
|
}
|
/**
|
* 类型改变执行
|
* @param e
|
*/
|
SpecialAreaBillingInfoDlg.areaTypeClick = function (e) {
|
if (1 == e){//行政区域
|
$("#areaType1Div").show();
|
$("#areaType2Div").hide();
|
} else if (2 == e){
|
$("#areaType2Div").show();
|
$("#areaType1Div").hide();
|
}
|
}
|
|
//站点区域省改变
|
SpecialAreaBillingInfoDlg.provinceChange1 = function (e) {
|
var provinceCode=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){
|
if(data!=null){
|
var content='<option value="">选择市</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#cityCode1").empty().append(content);
|
$("#districtCode1").empty().append('<option value="">选择区</option>');
|
}
|
});
|
ajax.set("code",provinceCode);
|
ajax.start();
|
}
|
//站点区域市改变
|
SpecialAreaBillingInfoDlg.cityChange1 = function (e) {
|
var cityCode=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){
|
if(data!=null){
|
var content='<option value="">选择区</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#districtCode1").empty().append(content);
|
}
|
});
|
ajax.set("code",cityCode);
|
ajax.start();
|
}
|
|
/**
|
* 添加区域
|
*/
|
SpecialAreaBillingInfoDlg.addArea = function () {
|
|
var areaType = $("input[name='areaType']:checked").val();
|
var b = false;
|
$(".areaValueClass").each(function () {
|
var areaType1 = $(this).find("input[name*='areaType1']").val();
|
if(areaType != areaType1){
|
b = true;
|
return
|
}
|
});
|
if(b){
|
Feng.error("电子围栏和行政区域不能混合使用");
|
return;
|
}
|
|
if (1 == areaType){
|
var provinceCode1 = $("#provinceCode1").val();
|
var province1 = $("#provinceCode1 option:selected").text();
|
var cityCode1 = $("#cityCode1").val();
|
var city1 = $("#cityCode1 option:selected").text();
|
var districtCode1 = $("#districtCode1").val();
|
var district1 = $("#districtCode1 option:selected").text();
|
if ("" == provinceCode1){
|
Feng.error("请选择行政区域所属省");
|
return;
|
}
|
}else if (2 == areaType) {
|
if("" == coordinate){
|
Feng.error('请在地图上规划区域');
|
return;
|
}
|
}
|
}
|
//删除数据
|
function deleteSub(e) {
|
$(e).parent().parent().remove();
|
}
|