define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard.min'], function ($, undefined, Backend, Table, Form, Clipboard) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'goods/goods/index', add_url: 'goods/goods/add', edit_url: 'goods/goods/edit', del_url: 'goods/goods/del', multi_url: 'goods/goods/multi', table: 'goods', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name')}, {field: 'app_image', title: __('App_image'), formatter: Table.api.formatter.image}, {field: 'day_rate', title: __('Day_rate'), operate:'BETWEEN'}, {field: 'term', title: __('Term')}, {field: 'position', title: __('Position')}, {field: 'url', title: __('Url'), formatter: Table.api.formatter.url}, {field: 'number', title: '申请人数'}, {field: 'shenpi', title: __('Shenpi')}, {field: 'weigh', title: __('Weigh')}, {field: 'status', title: __('Status'), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, { field: 'fuzhi', title: '点击复制推广链接', events: Controller.api.xiaobao, formatter: Controller.api.formatter.ip }, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] ] }); // 绑定TAB事件 $('.panel-heading a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var field = $(this).closest("ul").data("field"); var value = $(this).data("value"); var options = table.bootstrapTable('getOptions'); options.pageNumber = 1; options.queryParams = function (params) { var filter = {}; if (value !== '') { filter[field] = value; } params.filter = JSON.stringify(filter); return params; }; table.bootstrapTable('refresh', {}); return false; }); // 为表格绑定事件 Table.api.bindevent(table); var clipboard = new Clipboard('.btn-fuzhi'); clipboard.on('success', function(e) { alert('复制成功'); console.log(e); }); clipboard.on('error', function(e) { alert('复制失败'); console.log(e); }); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); }, formatter: {//渲染的方法 ip: function (value, row, index) { return '<a href="javascript:;" data-clipboard-text="'+Config.url+'/index/index/neirong/id/'+row.id+'.html?tuiguang='+Config.adminid+'" class="btn btn-xs btn-fuzhi btn-success" data-toggle="tooltip" title="" data-table-id="table" data-field-index="13" data-row-index="0" data-button-index="1" data-original-title="点击复制推广链接">点击复制推广链接</a>' ; }, }, xiaobao:{ 'click .btn-fuzhi': function (e, value, row, index) { } } }, }; return Controller;});
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。
未经允许不得转载:Str Tom工作室 » 列表表格复制行内内容