define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'package/index' + location.search, add_url: 'package/add', edit_url: 'package/edit', // del_url: 'package/del', multi_url: 'package/multi', import_url: 'package/import', table: 'package', dragsort_url:false } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh', fixedColumns: true, fixedRightNumber: 1, search:false, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'type', title: __('Type'), searchList: Config.typeList, formatter: Table.api.formatter.status}, // {field: 'company_id', title: __('Company_id'), operate: false, visible:false}, {field: 'company.name', title: __('Company.name'), operate: 'LIKE'}, {field: 'title', title: __('Title'), operate: 'LIKE'}, {field: 'info', title: __('Info'), operate: 'LIKE'}, // {field: 'servicetype_id', title: __('Servicetype_id'), operate: false, visible:false}, {field: 'servicetype.title', title: __('Servicetype.title'), operate: 'LIKE'}, {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, {field: 'price', title: __('Price'), operate:'BETWEEN'}, {field: 'oldprice', title: __('Oldprice'), operate:'BETWEEN'}, {field: 'num', title: __('Num'), operate:'BETWEEN'}, {field: 'weigh', title: __('Weigh'), operate: false}, {field: 'status', title: __('Status'), searchList: Config.statusList, formatter: Table.api.formatter.status}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons:[ { name: 'package_gift', text: '赠送列表', title: '赠送列表', classname: 'btn btn-xs btn-primary btn-dialog', url:'packagegift/index/package_id/{ids}?dialog=1', icon: 'fa fa-list', target: '_self', extend: 'data-area=["90%","90%"]', hidden:function($row){ if($row.type == 2){ return false; } return true; } }, ]} ] ] }); // 为表格绑定事件 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; });