car4s/public/assets/js/backend/user4s/inslog.js
2022-06-05 14:30:14 +08:00

85 lines
3.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user4s/inslog/index' + location.search,
add_url: 'user4s/inslog/add',
edit_url: 'user4s/inslog/edit',
del_url: 'user4s/inslog/del',
multi_url: 'user4s/inslog/multi',
import_url: 'user4s/inslog/import',
table: 'user4s_inslog',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
showToggle: false,
maintainSelected: true,
columns: [
[
//{checkbox: true},
//{field: 'id', title: __('Id'),operate: false},
//{field: 'user4s_id', title: __('User4s_id'),operate: false},
//{field: 'admin_id', title: __('Admin_id'),operate: false},
{field: 'user.name', title: __('会员姓名'), operate: 'LIKE'},
{field: 'user.name', title: __('会员电话'), operate: 'LIKE',visible: false},
{field: 'inscom', title: __('Inscom'), operate: 'LIKE'},
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
{field: 'description', title: __('Description'), operate: 'LIKE'},
{field: 'star', title: __('Star')},
{field: 'createtime', title: __('Createtime'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false},
{field: 'admin.id', title: __('Admin.id'),operate: false,visible: false},
{field: 'admin.username', title: __('操作员'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
],
queryParams: function (params) {
//这里可以追加搜索条件
var filter = JSON.parse(params.filter);
var op = JSON.parse(params.op);
//这里可以动态赋值比如从URL中获取admin_id的值filter.admin_id=Fast.api.query('admin_id');
filter.user4s_id = Fast.api.query('user4s_id');
op.user4s_id = "=";
if (filter.user4s_id == null || filter.user4s_id == "") {
delete filter.user4s_id;
delete op.user4s_id;
}
params.filter = JSON.stringify(filter);
params.op = JSON.stringify(op);
console.log(params);
return params;
},
});
// 为表格绑定事件
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;
});