BootstrapAdmin/Bootstrap.Admin/wwwroot/js/dicts.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-06-07 00:45:47 +08:00
$(function () {
$('table').lgbTable({
2018-06-07 00:45:47 +08:00
url: Dicts.url,
dataBinder: {
2018-06-07 00:45:47 +08:00
map: {
Id: "#dictID",
Category: "#dictCate",
Name: "#dictName",
Code: "#dictCode",
Define: "#dictDefine"
2018-06-07 00:45:47 +08:00
}
},
smartTable: {
sortName: 'Category',
queryParams: function (params) { return $.extend(params, { category: $('#txt_dict_cate').val(), name: $("#txt_dict_name").val(), define: $("#txt_dict_define").val() }); },
columns: [
{ title: "字典标签", field: "Category", sortable: true },
{ title: "字典名称", field: "Name", sortable: true },
{ title: "字典代码", field: "Code", sortable: true },
{ title: "字典分类", field: "Define", sortable: true, formatter: function (value) { return value === "0" ? "系统使用" : "自定义"; } }
]
}
2018-06-07 00:45:47 +08:00
});
// autocomplete
$.bc({
url: "api/Category", method: 'get',
2018-06-07 00:45:47 +08:00
callback: function (result) {
var data = result.map(function (ele, index) { return ele.Category; });
$('#txt_dict_cate').typeahead({
source: data,
autoSelect: true
});
}
});
2016-10-29 16:46:02 +08:00
});