You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
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;
|
|
});
|