define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'guideagent/index',
add_url: 'guideagent/add',
edit_url: 'guideagent/edit',
del_url: 'guideagent/del',
multi_url: 'guideagent/multi',
table: 'guide_relation',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'gr.updatetime desc',
sortOrder:'',
search: false,
searchFormVisible: true,
columns: [
[
{checkbox: true},
// {field: 'id', title: __('Id'), operate: 'LIKE %...%'},
{field: 'admin_id', title: __('Admin_id'), operate: 'LIKE %...%'},
{field: 'a.username', title: __('Admin_username'), operate: 'LIKE %...%',formatter:function(value, row, index){
return row.username;
}},
{field: 'a.nickname', title: __('Admin_nickname'), operate: 'LIKE %...%',formatter:function(value, row, index){
return row.nickname;
}},
{field: 'ae.create_by', title: __('开户人ID'), operate: 'LIKE %...%',formatter:function(value, row, index){
return row.create_by;
}},
{field: 'a2.username', title: __('开户人账户'), operate: 'LIKE %...%',formatter:function(value, row, index){
return row.create_username;
}},
{field: 'a2.nickname', title: __('开户人昵称'), operate: 'LIKE %...%',formatter:function(value, row, index){
return row.create_nickname;
}},
{field: 'gd.id', title: __('Domain_host')+"ID", operate: 'LIKE %...%',formatter:function(value, row, index){
return (new String(row.hostid_concat)).split(",").join("
");
}},
{field: 'gd.host', title: __('Domain_host'), operate: 'LIKE %...%',formatter:function(value, row, index){
return (new String(row.host_concat)).split(",").join("
");
}},
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime,type: 'datetime', operate: 'RANGE',addclass:'datetimerange',formatter:function(value, row, index){
return (new String(row.createtime_concat)).split(",").join("
");
}},
{field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime,type: 'datetime', operate: 'RANGE',addclass:'datetimerange',formatter:function(value, row, index){
return (new String(row.updatetime_concat)).split(",").join("
");
}},
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate,formatter: Table.api.formatter.buttons, buttons:[
{name: 'del', text: '', icon: 'fa fa-trash',classname: 'btn btn-xs btn-danger btn-ajax', url: $.fn.bootstrapTable.defaults.extend.del_url,confirm:'确定删除此项?',success:function (data){
table.bootstrapTable('refresh');
}},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
$(":checkbox[name='btSelectAll']").click(function(){
$(this).closest("table").find(":checkbox").prop("checked", $(this).prop("checked"));
});
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});