12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'templatelist/index',
- multi_url: 'templatelist/multi',
- table: 'templatelist',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- sortName: 'id',
- search: false,
- commonSearch: false,
- columns: [
- [
- {field: 'template_id', title: '模版ID'},
- {field: 'primary_industry', title: '一级行业'},
- {field: 'deputy_industry', title: '二级行业'},
- {field: 'content', title: '详细内容'},
- {field: 'example', title: '内容示例'},
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|