123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'training/training_info/index' + location.search,
- add_url: 'training/training_info/add',
- edit_url: 'training/training_info/edit',
- del_url: 'training/training_info/del',
- multi_url: 'training/training_info/multi',
- import_url: 'training/training_info/import',
- table: 'training_info',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'cid', title: __('Cid')},
- {field: 'training_id', title: __('Training_id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'Phone', title: __('Phone'), operate: 'LIKE'},
- {field: 'num', title: __('Num')},
- {field: 'turn_up', title: __('Turn_up'), operate: 'LIKE'},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
- {field: 'SN', title: __('Sn'), operate: 'LIKE'},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'sendtime', title: __('Sendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, 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 () {
- $("#c-training_id").data("params", function (obj) {
- return {custom: {cid: $("#c-cid").val()}};
- });
- Controller.api.bindevent();
- },
- edit: function () {
- $("#c-training_id").data("params", function (obj) {
- return {custom: {cid: $("#c-cid").val()}};
- });
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|