/**
|
* 管理初始化
|
*/
|
var TRegion = {
|
id: "TRegionTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TRegion.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '城市名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '', field: 'code', visible: true, align: 'center', valign: 'middle'},
|
{title: '', field: 'citycode', visible: true, align: 'center', valign: 'middle'},
|
{title: '父级ID', field: 'parentId', visible: true, align: 'center', valign: 'middle'},
|
{title: '英文名称', field: 'english', visible: true, align: 'center', valign: 'middle'}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TRegion.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TRegion.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
TRegion.openAddTRegion = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tRegion/tRegion_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看详情
|
*/
|
TRegion.openTRegionDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tRegion/tRegion_update/' + TRegion.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除
|
*/
|
TRegion.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/tRegion/delete", function (data) {
|
Feng.success("删除成功!");
|
TRegion.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tRegionId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
TRegion.search = function () {
|
var queryData = {};
|
queryData['condition'] = $("#condition").val();
|
TRegion.table.refresh({query: queryData});
|
};
|
|
$(function () {
|
var defaultColunms = TRegion.initColumn();
|
var table = new BSTable(TRegion.id, "/tRegion/list", defaultColunms);
|
table.setPaginationType("client");
|
TRegion.table = table.init();
|
});
|