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.
70 lines
3.0 KiB
70 lines
3.0 KiB
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'qingdong/notice/feedback/index',
|
|
add_url: 'qingdong/notice/feedback/add',
|
|
edit_url: 'qingdong/notice/feedback/edit',
|
|
del_url: 'qingdong/notice/feedback/del',
|
|
multi_url: 'qingdong/notice/feedback/multi',
|
|
table: 'feedback',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id'), sortable: true},
|
|
{field: 'staff.name', title: __('员工姓名'), operate: false},
|
|
{field: 'content', title: __('反馈内容'), operate: false },
|
|
{field: 'file_ids', title: __('图片'), events: Table.api.events.image, formatter: Table.api.formatter.images, operate: false},
|
|
{field: 'createtime', title: __('提出时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
|
$(table).data("operate-edit",null);
|
|
return Table.api.formatter.operate.call(this, value, row, index);
|
|
}}
|
|
]
|
|
],
|
|
//启用普通表单搜索
|
|
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);
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|