2016-10-30 12:11:08 +08:00
|
|
|
|
$(function () {
|
2016-12-22 17:04:38 +08:00
|
|
|
|
$('#panelResultHeader').html('查询结果<span class="hidden-400 text-danger">(仅 Administrators 角色成员可删除数据)<span>');
|
2016-10-30 12:11:08 +08:00
|
|
|
|
var bsa = new BootstrapAdmin({
|
2016-11-18 20:49:44 +08:00
|
|
|
|
url: Dicts.url,
|
2016-10-30 12:11:08 +08:00
|
|
|
|
dataEntity: new DataEntity({
|
|
|
|
|
map: {
|
|
|
|
|
ID: "dictID",
|
|
|
|
|
Category: "dictCate",
|
|
|
|
|
Name: "dictName",
|
2016-11-03 11:24:34 +08:00
|
|
|
|
Code: "dictCode",
|
2016-11-03 21:53:10 +08:00
|
|
|
|
Define: "dictDefine"
|
2016-10-30 12:11:08 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('table').smartTable({
|
2016-11-18 20:49:44 +08:00
|
|
|
|
url: Dicts.url,
|
2016-10-30 12:11:08 +08:00
|
|
|
|
sortName: 'Category',
|
2016-11-28 19:46:09 +08:00
|
|
|
|
queryParams: function (params) { return $.extend(params, { category: $('#txt_dict_cate').val(), name: $("#txt_dict_name").val(), define: $("#txt_dict_define").selectval() }); },
|
2016-10-30 12:11:08 +08:00
|
|
|
|
columns: [{ checkbox: true },
|
|
|
|
|
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
2016-11-03 21:53:10 +08:00
|
|
|
|
{ title: "字典分项", field: "Category", sortable: true },
|
2016-11-17 20:01:28 +08:00
|
|
|
|
{ title: "字典名称", field: "Name", sortable: false },
|
2016-11-03 21:53:10 +08:00
|
|
|
|
{ title: "字典代码", field: "Code", sortable: false },
|
2016-12-09 20:13:22 +08:00
|
|
|
|
{ title: "字典类别", field: "Define", sortable: true, formatter: function (value, row, index) { return value == "0" ? "系统使用" : "自定义"; } }
|
2016-10-30 12:11:08 +08:00
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// validate
|
|
|
|
|
$('#dataForm').autoValidate({
|
|
|
|
|
dictCate: {
|
|
|
|
|
required: true,
|
|
|
|
|
maxlength: 50
|
|
|
|
|
},
|
|
|
|
|
dictName: {
|
|
|
|
|
required: true,
|
|
|
|
|
maxlength: 50
|
|
|
|
|
},
|
|
|
|
|
dictCode: {
|
|
|
|
|
required: true,
|
|
|
|
|
maxlength: 50
|
2016-11-03 11:24:34 +08:00
|
|
|
|
},
|
|
|
|
|
dictDefine: {
|
|
|
|
|
required: false,
|
|
|
|
|
maxlength: 50
|
2016-10-30 12:11:08 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2016-11-08 15:54:40 +08:00
|
|
|
|
// select
|
2016-11-28 19:46:09 +08:00
|
|
|
|
$('.btn-select').select();
|
2016-11-17 20:01:28 +08:00
|
|
|
|
|
|
|
|
|
// autocomplete
|
2016-11-18 20:49:44 +08:00
|
|
|
|
$.bc({
|
|
|
|
|
Id: 1, url: Dicts.url, data: { type: 'category' }, swal: false,
|
|
|
|
|
callback: function (result) {
|
2016-12-09 20:13:22 +08:00
|
|
|
|
var data = result.map(function (ele, index) { return ele.Category; });
|
2016-11-18 20:49:44 +08:00
|
|
|
|
$('#txt_dict_cate').typeahead({
|
2016-12-09 20:13:22 +08:00
|
|
|
|
source: data,
|
2016-11-18 20:49:44 +08:00
|
|
|
|
autoSelect: true
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-11-17 20:01:28 +08:00
|
|
|
|
});
|
2016-10-29 16:46:02 +08:00
|
|
|
|
});
|