define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'product/index' + location.search, add_url: 'product/add', edit_url: 'product/edit', del_url: 'product/del', multi_url: 'product/multi', import_url: 'product/import', table: 'product', earchFormVisible: 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: 'sort', title: __('Sort'),editable: true}, {field: 'name', title: __('Name'), operate: 'LIKE'}, {field: 'category.name', title: '保险分类',operate:'LIKE'}, {field: 'company.name', title: '保险公司',operate: 'LIKE'}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'p_image', title: __('P_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'status', title: __('Status')}, {field: 'attribute', title: '在售状态', searchList: {"新上架产品":__('新上架产品'),"在售产品":__('在售产品'),"停售产品":__('停售产品')}, formatter: Table.api.formatter.normal}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter:Table.api.formatter.operate // formatter:function (value, row, index) { // var that = $.extend({}, this); // var table = $(that.table).clone(true); // // operate-edit编辑 perate-del删除 // //判断什么时候显示什么时候不显示 // if (row.status === 0) { // $(table).data("operate-edit", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del // } // that.table = table; // return Table.api.formatter.operate.call(that, value, row, index); // } } ] ] }); // 为表格绑定事件 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; });