1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user_coupons_log/index' + location.search,
- add_url: 'user_coupons_log/add',
- edit_url: 'user_coupons_log/edit',
- del_url: 'user_coupons_log/del',
- multi_url: 'user_coupons_log/multi',
- import_url: 'user_coupons_log/import',
- table: 'user_coupons_log',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'company_id', title: __('Company_id')},
- {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
- {field: 'user_id', title: __('User_id')},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'coupons_id', title: __('Coupons_id')},
- {field: 'coupon_name', title: __('Coupon_name'), operate: 'LIKE'},
- {field: 'coupons.info', title: __('Coupons.info'), operate: false},
- {field: 'coupons.days', title: __('Coupons.days'), operate: false},
- {field: 'user_coupon_id', title: __('User_coupon_id')},
- {field: 'staff_id', title: __('Staff_id')},
- {field: 'staff.truename', title: __('Staff.truename'), operate: 'LIKE'},
- {field: 'createtime', title: __('Createtime'), 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 () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|