define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard'], function ($, undefined, Backend, Table, Form, Clipboard) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'guide/wx/index', add_url: 'guide/wx/add', edit_url: 'guide/wx/edit', table: 'guide_wx', }, showToggle: false, visible: false, showExport: false, search:false, searchFormVisible: true, }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'),operate: 'LIKE %...%'}, {field: 'qrcode_image', title: __('Qrcode_image'), formatter: Table.api.formatter.image,operate:false}, {field: 'subscribe_url', title: __('引导关注链接'),operate:false}, {field: 'state', title: __('State'), visible:false, searchList: {"0":__('State 0'),"1":__('State 1')}}, {field: 'state_text', title: __('State'), operate:false}, {field: 'createtime', title: __('Createtime'), operate: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); var clipboard = new Clipboard('.many_copy', { target: function(trigger) { trigger = document.querySelector('#many_copy_dom'); Toastr.success('复制成功'); return trigger; } }); clipboard.on('error',function (data) { Toastr.error('复制失败'); }) }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });