/**
|
* 跨城站点管理管理初始化
|
*/
|
var SpecialAreaBilling = {
|
id: "SpecialAreaBillingTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
SpecialAreaBilling.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '站点名称', field: 'areaName', visible: true, align: 'center', valign: 'middle'},
|
{title: '计费系数', field: 'priceCoefficient', visible: true, align: 'center', valign: 'middle'},
|
{title: '备注', field: 'remark', visible: true, align: 'center', valign: 'middle'},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.state != '' && row.state != null) {
|
if(row.state == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="正常" onfocus="TUser.tooltip()">正常</p>']
|
}else if(row.state == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="冻结" onfocus="TUser.tooltip()">冻结</p>']
|
}
|
}
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
SpecialAreaBilling.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
SpecialAreaBilling.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加跨城站点管理
|
*/
|
SpecialAreaBilling.add = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加特殊区域计费',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/specialAreaBilling/add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看跨城站点管理详情
|
*/
|
SpecialAreaBilling.edit = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑特殊区域计费',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/specialAreaBilling/edit/' + SpecialAreaBilling.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除车辆管理
|
*/
|
SpecialAreaBilling.delete = function () {
|
if (this.check()) {
|
swal({
|
title: "您是否确认删除?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/delete", function (data) {
|
swal("删除成功", "您已经成功删除了。", "success");
|
TCar.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",SpecialAreaBilling.seItem.id);
|
ajax.start();
|
});
|
}
|
};SpecialAreaBilling.freeze = function () {
|
if (this.check()) {
|
swal({
|
title: "您是否确认冻结?",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "冻结",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/freeze", function (data) {
|
Feng.success("冻结成功");
|
SpecialAreaBilling.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",SpecialAreaBilling.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
SpecialAreaBilling.thaw = function () {
|
if (this.check()) {
|
swal({
|
title: "您是否确认解冻?",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "解冻",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/specialAreaBilling/thaw", function (data) {
|
Feng.success("解冻成功");
|
SpecialAreaBilling.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",SpecialAreaBilling.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 查询跨城站点管理列表
|
*/
|
SpecialAreaBilling.search = function () {
|
var queryData = {};
|
queryData['areaName'] = $("#areaName").val();
|
SpecialAreaBilling.table.refresh({query: queryData});
|
};
|
|
SpecialAreaBilling.resetSearch = function () {
|
$("#areaName").val("");
|
SpecialAreaBilling.search();
|
};
|
|
$(function () {
|
var defaultColunms = SpecialAreaBilling.initColumn();
|
var table = new BSTable(SpecialAreaBilling.id, "/specialAreaBilling/list", defaultColunms);
|
table.setPaginationType("server");
|
SpecialAreaBilling.table = table.init();
|
});
|