DiverseYouthNightSchool/public/assets/js/backend/school/message.js

68 lines
4.3 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'school/message/index' + location.search,
add_url: 'school/message/add',
edit_url: 'school/message/edit',
del_url: 'school/message/del',
multi_url: 'school/message/multi',
import_url: 'school/message/import',
table: 'school_message',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'platform', title: __('Platform'), searchList: {"admin":__('Platform admin'),"user":__('Platform user'),"shop":__('Platform shop')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label},
{field: 'oper_type', title: __('Oper_type'), searchList: {"admin":__('Oper_type admin'),"user":__('Oper_type user'),"system":__('Oper_type system'),"shop":__('Oper_type shop')}, formatter: Table.api.formatter.normal},
{field: 'oper_id', title: __('Oper_id')},
{field: 'to_type', title: __('To_type'), searchList: {"admin":__('To_type admin'),"user":__('To_type user'),"system":__('To_type system'),"shop":__('To_type shop')}, formatter: Table.api.formatter.normal},
{field: 'to_id', title: __('To_id')},
{field: 'status', title: __('Status'), searchList: {"system":__('Status system'),"classes":__('Status classes'),"order":__('Status order')}, formatter: Table.api.formatter.status},
{field: 'mini_type', title: __('Mini_type'), searchList: {"order_notice":__('Mini_type order_notice'),"classes_auth":__('Mini_type classes_auth'),"classes_apply":__('Mini_type classes_apply'),"shop_apply":__('Mini_type shop_apply'),"classes_order_notice":__('Mini_type classes_order_notice'),"user_auth":__('Mini_type user_auth'),"aftercare":__('Mini_type aftercare'),"other":__('Mini_type other')}, formatter: Table.api.formatter.normal},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'params', title: __('Params'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
{field: 'admin.avatar', title: __('Admin.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{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();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});