1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'wechat/wechat_qrcode/index' + location.search,
- add_url: 'wechat/wechat_qrcode/add',
- edit_url: 'wechat/wechat_qrcode/edit',
- del_url: 'wechat/wechat_qrcode/del',
- multi_url: 'wechat/wechat_qrcode/multi',
- import_url: 'wechat/wechat_qrcode/import',
- table: 'wechat_qrcode',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'third_type', title: __('Third_type'), operate: 'LIKE'},
- {field: 'third_id', title: __('Third_id')},
- {field: 'ticket', title: __('Ticket'), operate: 'LIKE'},
- {field: 'expire_seconds', title: __('Expire_seconds')},
- {field: 'status', title: __('Status')},
- {field: 'add_time', title: __('Add_time'), operate: 'LIKE'},
- {field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
- {field: 'qrcode_url', title: __('Qrcode_url'), operate: 'LIKE', formatter: Table.api.formatter.url},
- {field: 'scan', title: __('Scan')},
- {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;
- });
|