119 lines
5.0 KiB
JavaScript
119 lines
5.0 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'cardocr/card/index' + location.search,
|
|
add_url: 'cardocr/card/add',
|
|
edit_url: 'cardocr/card/edit',
|
|
del_url: 'cardocr/card/del',
|
|
multi_url: 'cardocr/card/multi',
|
|
table: 'cardocr',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'user_id', title: __('User_id')},
|
|
{field: 'user.nickname', title: __('User.nickname')},
|
|
{field: 'name', title: __('Name')},
|
|
{
|
|
field: 'sex',
|
|
title: __('Sex'),
|
|
searchList: {"男": __('男'), "女": __('女'), "未知": __('未知')},
|
|
formatter: Table.api.formatter.normal
|
|
},
|
|
{field: 'nation', title: __('Nation')},
|
|
{field: 'birth', title: __('Birth'), operate: 'RANGE', addclass: 'datetimerange'},
|
|
{field: 'address', title: __('Address')},
|
|
{field: 'idnum', title: __('Idnum')},
|
|
{field: 'authority', title: __('Authority')},
|
|
{
|
|
field: 'validdatestart',
|
|
title: __('Validdatestart'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange'
|
|
},
|
|
{field: 'validdateend', title: __('Validdateend'), operate: 'RANGE', addclass: 'datetimerange'},
|
|
{
|
|
field: 'status',
|
|
title: __('Status'),
|
|
formatter: Table.api.formatter.status,
|
|
searchList: {"2": __("Unaudited"), "1": __('Pass'), "0": __('Down')}
|
|
},
|
|
{
|
|
field: 'positive_img',
|
|
title: __('Positive_img'),
|
|
events: Table.api.events.image,
|
|
formatter: Table.api.formatter.image,
|
|
operate: false
|
|
},
|
|
{
|
|
field: 'back_img',
|
|
title: __('Back_img'),
|
|
events: Table.api.events.image,
|
|
formatter: Table.api.formatter.image,
|
|
operate: false
|
|
},
|
|
{field: 'memo', title: __('Memo')},
|
|
{
|
|
field: 'createtime',
|
|
title: __('Createtime'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange',
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
{
|
|
field: 'updatetime',
|
|
title: __('Updatetime'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange',
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
{
|
|
field: 'publishtime',
|
|
title: __('Publishtime'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange',
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
{
|
|
field: 'operate',
|
|
title: __('Operate'),
|
|
table: table,
|
|
events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
add: function () {
|
|
// Controller.api.bindevent();
|
|
Form.api.bindevent($("form[role=form]"));
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
}); |