增加字典变维护的客户端脚本验证

This commit is contained in:
Argo-Lenovo 2016-10-30 12:11:08 +08:00
parent 6123cc4e1b
commit 5fa5ee3a76
1 changed files with 40 additions and 32 deletions

View File

@ -1,33 +1,41 @@
$(function () { $(function () {
var bsa = new BootstrapAdmin({ var bsa = new BootstrapAdmin({
url: '../api/Dicts', url: '../api/Dicts',
dataEntity: new DataEntity({ dataEntity: new DataEntity({
map: { map: {
ID: "dictID", ID: "dictID",
Category: "dictCate", Category: "dictCate",
Name: "dictName", Name: "dictName",
Code: "dictCode" Code: "dictCode"
} }
}) })
}); });
$('table').smartTable({ $('table').smartTable({
url: '../api/Dicts', //请求后台的URL* url: '../api/Dicts', //请求后台的URL*
sortName: 'Category', sortName: 'Category',
queryParams: function (params) { return $.extend(params, { name: $("#txt_dict_name").val(), category: $("#txt_dict_cate").val() }); }, queryParams: function (params) { return $.extend(params, { name: $("#txt_dict_name").val(), category: $("#txt_dict_cate").val() }); },
columns: [{ checkbox: true }, columns: [{ checkbox: true },
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter }, { title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
{ title: "字典种类", field: "Category", sortable: true }, { title: "字典种类", field: "Category", sortable: true },
{ title: "字典名称", field: "Name", sortable: false }, { title: "字典名称", field: "Name", sortable: false },
{ title: "字典代码", field: "Code", sortable: false } { title: "字典代码", field: "Code", sortable: false }
] ]
}); });
// validate // validate
$('#dataForm').autoValidate({ $('#dataForm').autoValidate({
groupName: { dictCate: {
required: true, required: true,
maxlength: 50 maxlength: 50
} },
}); dictName: {
required: true,
maxlength: 50
},
dictCode: {
required: true,
maxlength: 50
}
});
}); });