diff --git a/Bootstrap.Admin/Models/QueryDictOption.cs b/Bootstrap.Admin/Models/QueryDictOption.cs index 702f9756..92a414c1 100644 --- a/Bootstrap.Admin/Models/QueryDictOption.cs +++ b/Bootstrap.Admin/Models/QueryDictOption.cs @@ -13,7 +13,7 @@ namespace Bootstrap.Admin.Models /// /// 字典种类 /// - public string Category { get; set; } + public string Define { get; set; } /// /// 字典表查询 /// @@ -25,9 +25,9 @@ namespace Bootstrap.Admin.Models { data = data.Where(t => t.Name.Contains(Name)); } - if (!string.IsNullOrEmpty(Category)) + if (!string.IsNullOrEmpty(Define)) { - data = data.Where(t => t.Category.Contains(Category)); + data = data.Where(t => t.Define.ToString() == Define); } var ret = new QueryData(); ret.total = data.Count(); diff --git a/Bootstrap.Admin/Scripts/Dicts.js b/Bootstrap.Admin/Scripts/Dicts.js index b5425682..0b98cfe6 100644 --- a/Bootstrap.Admin/Scripts/Dicts.js +++ b/Bootstrap.Admin/Scripts/Dicts.js @@ -7,7 +7,7 @@ Category: "dictCate", Name: "dictName", Code: "dictCode", - Define:"dictDefine" + Define: "dictDefine" } }) }); @@ -15,13 +15,13 @@ $('table').smartTable({ url: '../api/Dicts', //请求后台的URL(*) 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(), define: $("#txt_dict_cate").val() }); }, columns: [{ checkbox: true }, { title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter }, - { title: "字典种类", field: "Category", sortable: true }, - { title: "字典名称", field: "Name", sortable: false }, - { title: "字典代码", field: "Code", sortable: true }, - { title: "字典定义", field: "Define", sortable: false } + { title: "字典分项", field: "Category", sortable: true }, + { title: "字典名称", field: "Name", sortable: true }, + { title: "字典代码", field: "Code", sortable: false }, + { title: "字典类别", field: "DefineName", sortable: true } ] }); diff --git a/Bootstrap.Admin/Views/Admin/Dicts.cshtml b/Bootstrap.Admin/Views/Admin/Dicts.cshtml index ba762f20..86072446 100644 --- a/Bootstrap.Admin/Views/Admin/Dicts.cshtml +++ b/Bootstrap.Admin/Views/Admin/Dicts.cshtml @@ -1,56 +1,68 @@ -@model NavigatorBarModel -@{ - ViewBag.Title = "字典表管理"; - Layout = "~/Views/Shared/_Default.cshtml"; -} -@section Javascript { - -} -@section header { - @Html.Partial("Header", Model) -} -@section navigator { - @Html.Partial("Navigator", Model) -} -@section query { -
-
- - -
-
- - -
-
- -
-
-} -@section modal { - - +@model NavigatorBarModel +@{ + ViewBag.Title = "字典表管理"; + Layout = "~/Views/Shared/_Default.cshtml"; +} +@section Javascript { + +} +@section header { + @Html.Partial("Header", Model) +} +@section navigator { + @Html.Partial("Navigator", Model) +} +@section query { +
+
+ + +
+
+ + +
+ + + +
+
+
+ +
+
+} +@section modal { + + } \ No newline at end of file diff --git a/Bootstrap.DataAccess/Dict.cs b/Bootstrap.DataAccess/Dict.cs index 8ddc4875..8dc39a43 100644 --- a/Bootstrap.DataAccess/Dict.cs +++ b/Bootstrap.DataAccess/Dict.cs @@ -1,37 +1,35 @@ -namespace Bootstrap.DataAccess -{ - /// - /// 字典表实体 - /// author:renshuo - /// date:2016.10.27 - /// - public class Dict - { - /// - /// 字典主键 - /// 数据库自增 - /// - public int ID { get; set; } - - /// - /// 分类 - /// - public string Category { get; set; } - - /// - /// 名称 - /// - public string Name { get; set; } - - /// - /// 代号 - /// - public string Code { get; set; } - - /// - /// 1表示系统使用,0表示用户自定义 - /// 默认为1 - /// - public int Define { get; set; } - } -} +namespace Bootstrap.DataAccess +{ + /// + /// 字典表实体 + /// author:renshuo + /// date:2016.10.27 + /// + public class Dict + { + /// + /// 字典主键 数据库自增 + /// + public int ID { get; set; } + /// + /// 分类 + /// + public string Category { get; set; } + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 代号 + /// + public string Code { get; set; } + /// + /// 1表示系统使用,0表示用户自定义 默认为1 + /// + public int Define { get; set; } + /// + /// 获得/设置 字典定义类别名称 + /// + public string DefineName { get; set; } + } +} diff --git a/Bootstrap.DataAccess/DictHelper.cs b/Bootstrap.DataAccess/DictHelper.cs index d4fe18d7..11d5cf48 100644 --- a/Bootstrap.DataAccess/DictHelper.cs +++ b/Bootstrap.DataAccess/DictHelper.cs @@ -23,7 +23,7 @@ namespace Bootstrap.DataAccess { var ret = CacheManager.GetOrAdd(DictDataKey, CacheSection.RetrieveIntervalByKey(DictDataKey), key => { - string sql = "select * from Dicts"; + string sql = "select ID, Category, Name, Code, Define, case Define when 0 then '系统使用' else '用户自定义' end DefineName from Dicts"; List Dicts = new List(); DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql); try @@ -38,7 +38,8 @@ namespace Bootstrap.DataAccess Category = (string)reader[1], Name = (string)reader[2], Code = (string)reader[3], - Define = (int)reader[4] + Define = (int)reader[4], + DefineName = (string)reader[5] }); } }