allocatr/public/assets/js/backend/orders/abnormal.js
2025-03-29 20:54:18 +08:00

92 lines
4.5 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'orders/abnormal/index' + location.search,
add_url: 'orders/abnormal/add',
edit_url: 'orders/abnormal/edit',
del_url: 'orders/abnormal/del',
multi_url: 'orders/abnormal/multi',
import_url: 'orders/abnormal/import',
table: 'order_abnormal',
}
});
var table = $("#table");
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='abnormal_id']", form).addClass("selectpage").data("source", "setting/abnormal/index").data("primaryKey", "id").data("field", "title").data("orderBy", "sort desc,id desc").data("pageSize",10);
Form.events.cxselect(form);
Form.events.selectpage(form);
});
$.fn.bootstrapTable.locales[Table.defaults.locale]['formatSearch'] = function(){return "订单编号/客户电话/客户姓名";};
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
search:true,
columns: [
[
{field: 'id', title: __('Id'),operate: false},
{field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
{field: 'abnormal_id', title: __('Abnormal_id'),visible:false},
{field: 'abnormal_title', title: __('Abnormal_title'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
// {field: 'order.worker_name', title: __('Order.worker_name'), operate: 'LIKE'},
// {field: 'order.worker_tel', title: __('Order.worker_tel'), operate: 'LIKE'},
//{field: 'handle_admin_id', title: __('Handle_admin_id')},
{field: 'handle_admin_user', title: __('Handle_admin_user'), operate: 'LIKE'},
{field: 'handle_time', title: __('Handle_time'), operate:false, addclass:'datetimerange', autocomplete:false},
{field: 'admin_user', title: __('Admin_user'), operate: 'LIKE'},
// {field: 'admin_id', title: __('Admin_id')},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
// buttons:[
// {
// name:"detail",
// text:"",
// title:"详情",
// classname:"btn btn-xs btn-info btn-view btn-dialog",
// icon:'fa fa-eye',
// url: 'orders/abnormal/edit/'
//
// }
// ]
}
]
]
});
// 为表格绑定事件
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;
});