define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'agreementyi/index',
add_url: 'agreementyi/add',
edit_url: 'agreementyi/edit',
del_url: 'agreementyi/del',
multi_url: 'agreementyi/multi',
table: 'agreementyi',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
searchFormVisible: true,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'jia', title: '甲方', operate: false, formatter: function (value, row, index) {
html = "
";
for (var i = 0; i < value.length; i++) {
html += "";
html += "";
html += value[i].jia;
html += " | ";
html += "";
html += "查看";
html += " | ";
html += "";
html += "下载PDF";
html += " | ";
html += "
";
}
html += "";
html += "福建米花信息科技有限公司(乙方) | ";
html += "";
html += "查看";
html += " | ";
html += "";
html += "下载PDF";
html += " | ";
html += "
";
html += "";
html += "广州市汇聚支付电子科技有限公司(乙方) | ";
html += "";
html += "查看";
html += " | ";
html += "";
html += "下载PDF";
html += " | ";
html += "
";
html += "
";
return html;
}
},
{field: 'card_holder', title: '乙方', operate: 'LIKE'},
{field: 'admin_id', title: __('Admin_id')},
{field: 'admin.username', title: '渠道账号', operate: 'LIKE'},
{field: 'admin.nickname', title: '渠道昵称', operate: 'LIKE'},
{field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange',formatter: Table.api.formatter.datetime}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
$('.multiexport').on('click', function () {
Layer.confirm('全部导出耗时较长,确认要全部导出吗?', {title: "全部导出"}, function (index) {
Layer.close(index);
window.location.href = '/admin/agreementyi/export';
}, function () {
layer.close();
})
});
$(".btn-export").click(function () {
ids = Table.api.selectedids(table);
window.location.href = '/admin/agreementyi/export/ids/' + ids;
return false;
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});