1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'viplog/index' + location.search,
- // add_url: 'viplog/add',
- // edit_url: 'viplog/edit',
- // del_url: 'viplog/del',
- // multi_url: 'viplog/multi',
- // import_url: 'viplog/import',
- table: 'vip_log',
- }
- });
- 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: 'user_id', title: __('User_id')},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- {field: 'vip_id', title: __('Vip_id')},
- {field: 'title', title: __('Title'), operate: 'LIKE'},
- {field: 'level', title: __('Level'), operate: 'LIKE'},
- {field: 'growthvalue', title: __('Growthvalue')},
- {field: 'free', title: __('Free')},
- {field: 'price', title: __('Price'), operate: 'LIKE'},
- {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'vipdiscount', title: __('Vipdiscount')},
- {field: 'birthdiscount', title: __('Birthdiscount')},
- {field: 'manypeople', title: __('Manypeople')},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'vip.title', title: __('Vip.title'), operate: 'LIKE'},
- // {field: 'vip.level', title: __('Vip.level'), operate: 'LIKE'},
- // {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;
- });
|