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.
82 lines
3.0 KiB
82 lines
3.0 KiB
define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'qingdong/notice/notice/index',
|
|
add_url: 'qingdong/notice/notice/add',
|
|
edit_url: 'qingdong/notice/notice/edit',
|
|
del_url: 'qingdong/notice/notice/del',
|
|
table: 'notice'
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{field: 'state', checkbox: true},
|
|
{field: 'title', title: __('标题'), operate:'like'},
|
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
|
{
|
|
field: 'operate',
|
|
title: __('Operate'),
|
|
table: table,
|
|
events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
],
|
|
//启用普通表单搜索
|
|
search:false,
|
|
commonSearch: true,
|
|
searchFormVisible: true,
|
|
onLoadSuccess:function(){
|
|
// 这里就是数据渲染结束后的回调函数
|
|
$('.btn-editone').html('编辑');
|
|
$('.fa-pencil').remove();
|
|
$('.btn-delone').html('删除');
|
|
$('.fa-trash').remove();
|
|
$('.btn-editone').removeClass('btn-success')
|
|
$('.btn-editone').removeClass('btn')
|
|
$('.btn-delone').removeClass('btn')
|
|
$('.btn-delone').removeClass('btn-danger')
|
|
}
|
|
});
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
$('.search').hide();
|
|
$('.btn-import').hide();
|
|
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
|
|
},
|
|
|
|
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;
|
|
});
|