| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
- var Controller = {
- index : function () {
- // 初始化表格参数配置
- Table.api.init({
- extend : {
- index_url : 'qingdong/general/field/index',
- edit_url : 'qingdong/general/field/edit',
- table : 'field'
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url : $.fn.bootstrapTable.defaults.extend.index_url,
- templateView: true,
- columns : [
- [
- {field : 'name', title : __('标题'), width : 200},
- {field : 'data', title : '可选字段'},
- {
- field : 'operate',
- title : __('Operate'),
- table : table,
- events : Table.api.events.operate,
- formatter : Table.api.formatter.operate
- }
- ]
- ],
- pageList:['ALL'],
- pagination:false,
- //启用普通表单搜索
- commonSearch : false,
- searchFormVisible : false,
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $('.search').hide();
- $('.btn-import').hide();
- },
- edit : function () {
- Controller.api.bindevent();
- },
- api : {
- bindevent : function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter : {
- thumb : function (value, row, index) {
- var style = row.storage == 'upyun' ? '!/fwfh/120x90' : '';
- return '<img src="' + row.image + '" data-tips-image alt="" title="封面图" style="max-height:90px;max-width:120px">';
- },
- }
- }
- };
- return Controller;
- });
|