allocatr/public/assets/js/backend/oa/schedule.js
2025-03-22 18:47:00 +08:00

72 lines
4.0 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'oa/schedule/index' + location.search,
add_url: 'oa/schedule/add',
edit_url: 'oa/schedule/edit',
del_url: 'oa/schedule/del',
multi_url: 'oa/schedule/multi',
import_url: 'oa/schedule/import',
table: 'schedule',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'admin_id', title: __('Admin_id')},
{field: 'exec_admin_id', title: __('Exec_admin_id')},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
{field: 'date', title: __('Date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'admin.id', title: __('Admin.id')},
{field: 'admin.username', title: __('Admin.username'), operate: 'LIKE'},
{field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
{field: 'admin.password', title: __('Admin.password'), operate: 'LIKE'},
{field: 'admin.salt', title: __('Admin.salt'), operate: 'LIKE'},
{field: 'admin.avatar', title: __('Admin.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'admin.email', title: __('Admin.email'), operate: 'LIKE'},
{field: 'admin.mobile', title: __('Admin.mobile'), operate: 'LIKE'},
{field: 'admin.loginfailure', title: __('Admin.loginfailure')},
{field: 'admin.logintime', title: __('Admin.logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'admin.loginip', title: __('Admin.loginip'), operate: 'LIKE'},
{field: 'admin.createtime', title: __('Admin.createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'admin.updatetime', title: __('Admin.updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'admin.token', title: __('Admin.token'), operate: 'LIKE'},
{field: 'admin.status', title: __('Admin.status'), operate: 'LIKE', formatter: Table.api.formatter.status},
{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;
});