12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'notice/index',
- add_url: 'notice/add',
- edit_url: 'notice/edit',
- // del_url: 'notice/del',
- multi_url: 'notice/multi',
- table: 'notice',
- },
- showToggle:false,
- showColumns:false,
- showExport:false,
- searchFormVisible: true,
- search:false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true, visible:(Config.group<=2 || Config.group==6)},
- // {field: 'id', title: __('Id'),operate:false},
- {field: 'title', title: __('Title'),formatter: Controller.api.formatter.link,operate: 'LIKE %...%'},
- {field: 'show_level', title: __('Show_level'), visible:false, searchList: {"show_level 1":'超管可见',"show_level 2":'超管、普管可见',"show_level 3":'超管、普管、渠道商可见',"show_level 4":'超管、普管、渠道商、代理商可见'},operate:false},
- {field: 'show_level_text', title: __('Show_level'), visible:(Config.group<=2 || Config.group==6), operate:false},
- {field: 'dialog_type', title: __('Dialog_type'), visible:false, searchList: {"dialog_type 1":__('Dialog_type 1'),"dialog_type 2":__('Dialog_type 2'),"dialog_type 3":__('Dialog_type 3')},operate:false},
- {field: 'dialog_type_text', title: __('Dialog_type'), visible:(Config.group<=2 || Config.group==6), operate:false},
- {field: 'status', title: __('Status'), visible:(Config.group<=2 || Config.group==6), searchList: {"normal":__('status normal'),"hidden":__('status hidden')}, formatter: Controller.api.formatter.toggle,operate:false},
- // {field: 'status_text', title: __('Status'), operate:false},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,operate:false},
- {field: 'operate', title: __('Operate'), visible:(Config.group<=2 || Config.group==6), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $(document).on('click','.layer-open',function () {
- Fast.api.open($(this).attr('href'), '公告', {});
- return false;
- })
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- show: function () {
- $(document).on('click', '.btn-close', function () {
- Fast.api.close();
- });
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- link: function (value, row, index) {
- return '<a href="notice/show/ids/' + row.id + '" class="layer-open">' + value + '</a>';
- },
- toggle: function (value, row, index) {
- return '<i class="fa ' + (value == 'normal' ? 'fa-toggle-on' : 'fa-toggle-off') + ' text-success fa-2x btn-change" data-params="status=' + (value == 'normal' ? 'hidden' : 'normal') + '" data-id="' + row.id + '"></i>';
- }
- }
- }
- };
- return Controller;
- });
|