82 lines
4.3 KiB
JavaScript
82 lines
4.3 KiB
JavaScript
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|||
|
|
|
|||
|
|
var Controller = {
|
|||
|
|
index: function () {
|
|||
|
|
// 初始化表格参数配置
|
|||
|
|
Table.api.init({
|
|||
|
|
extend: {
|
|||
|
|
index_url: 'yq/base_config/early/index' + location.search,
|
|||
|
|
add_url: 'yq/base_config/early/add',
|
|||
|
|
edit_url: 'yq/base_config/early/edit',
|
|||
|
|
del_url: 'yq/base_config/early/del',
|
|||
|
|
multi_url: 'yq/base_config/early/multi',
|
|||
|
|
import_url: 'yq/base_config/early/import',
|
|||
|
|
table: 'event',
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var table = $("#table");
|
|||
|
|
//在普通搜索渲染后
|
|||
|
|
table.on('post-common-search.bs.table', function (event, table) {
|
|||
|
|
var form = $("form", table.$commonsearch);
|
|||
|
|
$("input[name='type.name']", form).addClass("selectpage").data("source", "yq/base_config/event_type/index").data("primaryKey", "name").data("field", "name").data("orderBy", "id desc");
|
|||
|
|
Form.events.cxselect(form);
|
|||
|
|
Form.events.selectpage(form);
|
|||
|
|
});
|
|||
|
|
// 初始化表格
|
|||
|
|
table.bootstrapTable({
|
|||
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|||
|
|
pk: 'id',
|
|||
|
|
sortName: 'id',
|
|||
|
|
fixedColumns: true,
|
|||
|
|
fixedRightNumber: 1,
|
|||
|
|
|
|||
|
|
columns: [
|
|||
|
|
[
|
|||
|
|
{checkbox: true},
|
|||
|
|
{field: 'id', title: __('Id')},
|
|||
|
|
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
|||
|
|
{field: 'type.name', title: __('Type_id'), formatter:Table.api.formatter.search},
|
|||
|
|
{field: 'trigger_type', title: __('Trigger_type'), searchList: {"1":__('自主触发'),"2":__('主动上报')}, formatter: Table.api.formatter.label},
|
|||
|
|
// {field: 'uid', title: __('Uid')},
|
|||
|
|
{field: 'lv', title: __('Lv'), searchList: {"1":__('一级(无限制)'),"2":__('二级(120分钟)'),"3":__('三级(60分钟)'),"4":__('四级(30分钟)')}, formatter: Table.api.formatter.label},
|
|||
|
|
// {field: 'sort', title: __('Sort')},
|
|||
|
|
{field: 'res_department', title: __('Res_department'), operate: 'FIND_IN_SET', searchList: {"1":__('应急'),"2":__('交通'),"3":__('运营')}, formatter: Table.api.formatter.label},
|
|||
|
|
{field: 'is_feedback', title: __('Is_feedback'), searchList: {"1":__('反馈'),"2":__('不反馈')}, formatter: Table.api.formatter.normal},
|
|||
|
|
{field: 'feedback_time', title: __('Feedback_time'), searchList: {'1' :__('2小时内'), '2' :__('6小时内'), '3' :__('12小时内'), '4' :__('36小时内'), '5' :__('无限制')}, formatter: Table.api.formatter.normal}, // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|||
|
|
{field: 'is_del', title: __('Is_del'), searchList: {"1":__('正常'),"2":__('禁用')}, formatter: Table.api.formatter.toggle},
|
|||
|
|
{field: 'operate',
|
|||
|
|
title: __('Operate'),
|
|||
|
|
table: table,
|
|||
|
|
events: Table.api.events.operate,
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
name: '配置',
|
|||
|
|
text: __('配置'),
|
|||
|
|
title: __('配置'),
|
|||
|
|
classname: 'btn btn-xs btn-success btn-magic btn-dialog',
|
|||
|
|
url: 'yq/base_config/early/edit',
|
|||
|
|
}],
|
|||
|
|
formatter: Table.api.formatter.operate}
|
|||
|
|
]
|
|||
|
|
]
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 为表格绑定事件
|
|||
|
|
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;
|
|||
|
|
});
|