define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { $(document).on("click",".allgroups",function(){ if($(this).prop("checked")){ $(".checkgroup").prop("checked",true); }else{ $(".checkgroup").prop("checked",false); } }); $(document).on("click",".checkgroup",function(){ $(".allgroups").prop("checked",$(".checkgroup:checked").length 0) { Controller.table[panel.attr("id")].call(this); } //移除绑定的事件 $(this).unbind('shown.bs.tab'); }); //必须默认触发shown.bs.tab事件 $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab"); $(document).on('click','.layer-open',function () { Fast.api.open($(this).attr('href'), '公告', {}); return false; }) }, table: { first: function () { var table = $("#table1"); // 初始化渠道商表格 table.bootstrapTable({ url: 'notice/index?notice_type=1', pk: 'id', sortName: 'createtime', toolbar : "#toolbar1", extend: { add_url: 'notice/add?notice_type=1', edit_url: 'notice/edit', del_url: 'notice/del', multi_url: 'notice/multi', table: 'notice', }, columns: [ [ {checkbox: true, visible: adminShowGroups.indexOf(Config.group) > -1}, // {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:adminShowGroups.indexOf(Config.group) > -1, operate:false}, { field: 'dialog_type', title: __('Dialog_type'), visible: false, searchList: { "1": __('Dialog_type 1'), "2": __('Dialog_type 2'), "3": __('Dialog_type 3') }, operate: false }, { field: 'dialog_type_text', title: __('Dialog_type'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'groupsname', title: __('显示范围'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'status', title: __('Status'), visible: adminEditGroups.indexOf(Config.group) > -1, 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', visible: adminShowGroups.indexOf(Config.group) > -1, addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'updatetime', title: __('时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'operate', title: __('Operate'), visible: adminEditGroups.indexOf(Config.group) > -1, table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate } ] ] }); // 为表格1绑定事件 Table.api.bindevent(table); Controller.api.bindevent(); }, second: function () { var table = $("#table2"); // 初始化渠道商表格 table.bootstrapTable({ url: 'notice/index?notice_type=2', pk: 'id', sortName: 'createtime', toolbar : "#toolbar2", extend: { add_url: 'notice/add?notice_type=2', edit_url: 'notice/edit', del_url: 'notice/del', multi_url: 'notice/multi', table: 'notice', }, columns: [ [ {checkbox: true, visible: adminShowGroups.indexOf(Config.group) > -1}, // {field: 'id', title: __('Id'),operate:false}, { field: 'title', title: __('Title'), formatter: Controller.api.formatter.link, operate: 'LIKE %...%' }, { field: 'dialog_type', title: __('Dialog_type'), visible: false, searchList: { "1": __('Dialog_type 1'), "2": __('Dialog_type 2'), "3": __('Dialog_type 3') }, operate: false }, { field: 'dialog_type_text', title: __('Dialog_type'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'groupsname', title: __('显示范围'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'status', title: __('Status'), visible: adminEditGroups.indexOf(Config.group) > -1, 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', visible: adminShowGroups.indexOf(Config.group) > -1, addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'updatetime', title: __('时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'operate', title: __('Operate'), visible: adminEditGroups.indexOf(Config.group) > -1, table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate } ] ] }); // 为表格1绑定事件 Table.api.bindevent(table); Controller.api.bindevent(); }, third: function () { var table = $("#table3"); // 初始化渠道商表格 table.bootstrapTable({ url: 'notice/index?notice_type=3', pk: 'id', sortName: 'createtime', toolbar : "#toolbar3", extend: { add_url: 'notice/add?notice_type=3', edit_url: 'notice/edit', del_url: 'notice/del', multi_url: 'notice/multi', table: 'notice', }, columns: [ [ {checkbox: true, visible: adminShowGroups.indexOf(Config.group) > -1}, // {field: 'id', title: __('Id'),operate:false}, { field: 'title', title: __('Title'), formatter: Controller.api.formatter.link, operate: 'LIKE %...%' }, { field: 'dialog_type', title: __('Dialog_type'), visible: false, searchList: { "1": __('Dialog_type 1'), "2": __('Dialog_type 2'), "3": __('Dialog_type 3') }, operate: false }, { field: 'dialog_type_text', title: __('Dialog_type'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'groupsname', title: __('显示范围'), visible: adminShowGroups.indexOf(Config.group) > -1, operate: false }, { field: 'status', title: __('Status'), visible: adminEditGroups.indexOf(Config.group) > -1, 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', visible: adminShowGroups.indexOf(Config.group) > -1, addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'updatetime', title: __('时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate: false }, { field: 'operate', title: __('Operate'), visible: adminEditGroups.indexOf(Config.group) > -1, table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate } ] ] }); // 为表格1绑定事件 Table.api.bindevent(table); Controller.api.bindevent(); }, }, add: function () { Controller.api.bindevent(); $('#c-dialog_type').change(function(){ var dialogType = $(this).children('option:selected').val(); if (dialogType == 5){ $('.pop_num').show(); }else{ $('.pop_num').hide(); } }); }, edit: function () { Controller.api.bindevent(); var dialog = $('#c-dialog_type').children('option:selected').val(); if (dialog == 5){ $('.pop_num').show(); } $('#c-dialog_type').change(function(){ var dialogType = $(this).children('option:selected').val(); if (dialogType == 5){ $('.pop_num').show(); }else{ $('.pop_num').hide(); } }); }, 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) { titleRed = ''; img = ''; if (row.important_type == 1) { titleRed = ' style="color: #d81e06; font-size: 14px; font-weight:1000"'; img = ''; } return '' + value + img + ''; }, toggle: function (value, row, index) { return ''; } } } }; return Controller; });