147 lines
6.5 KiB
JavaScript
147 lines
6.5 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init();
|
|
|
|
//绑定事件
|
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
var panel = $($(this).attr("href"));
|
|
if (panel.length > 0) {
|
|
Controller.table[panel.attr("id")].call(this);
|
|
$(this).on('click', function (e) {
|
|
$($(this).attr("href")).find(".btn-refresh").trigger("click");
|
|
});
|
|
}
|
|
//移除绑定的事件
|
|
$(this).unbind('shown.bs.tab');
|
|
});
|
|
|
|
//必须默认触发shown.bs.tab事件
|
|
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
|
|
|
|
|
|
|
|
// var table = $("#table");
|
|
|
|
|
|
|
|
|
|
// 初始化表格
|
|
/*table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
commonSearch:false,
|
|
search:false,
|
|
columns: [
|
|
[
|
|
// {checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
// {field: 'dispatch_id', title: __('Dispatch_id')},
|
|
//{field: 'order_id', title: __('Order_id')},
|
|
//{field: 'worker_id', title: __('Worker_id')},
|
|
// {field: 'status', title: __('Status')},
|
|
{field: 'status_text', title: __('Status_text'), operate: 'LIKE'},
|
|
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
]
|
|
]
|
|
});*/
|
|
|
|
// 为表格绑定事件
|
|
//Table.api.bindevent(table);
|
|
},
|
|
|
|
|
|
|
|
table: {
|
|
first: function () {
|
|
// 表格1
|
|
var table1 = $("#table1");
|
|
table1.bootstrapTable({
|
|
url: 'orders/dispatchlog/index' + location.search,
|
|
toolbar: '#toolbar1',
|
|
sortName: 'id',
|
|
search: false,
|
|
commonSearch:false,
|
|
visible: false,
|
|
showToggle: false,
|
|
showColumns: false,
|
|
showExport: false,
|
|
columns: [
|
|
[
|
|
{field: 'id', title: __('Id')},
|
|
// {field: 'dispatch_id', title: __('Dispatch_id')},
|
|
//{field: 'order_id', title: __('Order_id')},
|
|
//{field: 'worker_id', title: __('Worker_id')},
|
|
// {field: 'status', title: __('Status')},
|
|
{field: 'status_text', title: __('Status_text'), operate: 'LIKE'},
|
|
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table1, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格1绑定事件
|
|
Table.api.bindevent(table1);
|
|
},
|
|
second: function () {
|
|
// 表格2
|
|
var table2 = $("#table2");
|
|
table2.bootstrapTable({
|
|
url: 'orders/dispatchrecord/index' + location.search,
|
|
/* extend: {
|
|
index_url: '',
|
|
add_url: '',
|
|
edit_url: '',
|
|
del_url: '',
|
|
multi_url: '',
|
|
table: '',
|
|
},*/
|
|
toolbar: '#toolbar2',
|
|
sortName: 'id',
|
|
search: false,
|
|
commonSearch:false,
|
|
visible: false,
|
|
showToggle: false,
|
|
showColumns: false,
|
|
showExport: false,
|
|
columns: [
|
|
[
|
|
{field: 'id', title: __('Id')},
|
|
//{field: 'dispatch_id', title: __('Dispatch_id')},
|
|
//{field: 'worker_id', title: __('Worker_id')},
|
|
{field: 'remark', title: __('跟进内容'), operate: 'LIKE', table: table2, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'need_notice', title: __('需要提醒'), searchList: {"0":__('否'),"1":__('是')}, formatter: Table.api.formatter.normal},
|
|
{field: 'notice_time', title: __('提醒时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
{field: 'status', title: __('状态'), searchList: {"0":__('进行中'),"1":__('已完成')}, formatter: Table.api.formatter.status},
|
|
{field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
//{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
]
|
|
]
|
|
});
|
|
// 为表格2绑定事件
|
|
Table.api.bindevent(table2);
|
|
}
|
|
},
|
|
|
|
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|