diff --git a/Vue.Net/VOL.System/IServices/System/Partial/ISys_DictionaryService.cs b/Vue.Net/VOL.System/IServices/System/Partial/ISys_DictionaryService.cs index 87cae4f1..a58c0bb9 100644 --- a/Vue.Net/VOL.System/IServices/System/Partial/ISys_DictionaryService.cs +++ b/Vue.Net/VOL.System/IServices/System/Partial/ISys_DictionaryService.cs @@ -11,6 +11,7 @@ namespace VOL.System.IServices /// Task> GetBuilderDictionary(); Task GetVueDictionary(string[] dicNos); + Task GetVueDictionary_VT(string[] dicNos); object GetTableDictionary(Dictionary keyData); Task GetSearchDictionary(string dicNo, string value); diff --git a/Vue.Net/VOL.System/Services/System/Partial/Sys_DictionaryService.cs b/Vue.Net/VOL.System/Services/System/Partial/Sys_DictionaryService.cs index 64f0b2c3..5f98aa9c 100644 --- a/Vue.Net/VOL.System/Services/System/Partial/Sys_DictionaryService.cs +++ b/Vue.Net/VOL.System/Services/System/Partial/Sys_DictionaryService.cs @@ -43,6 +43,7 @@ namespace VOL.System.Services dbSql = s.DbSql, list = s.Sys_DictionaryList.OrderByDescending(o => o.OrderNo) .Select(list => new { key = list.DicValue, value = list.DicName }), + CompanyField = string.IsNullOrWhiteSpace(s.CompanyField)?"": s.CompanyField }).ToList()); @@ -66,6 +67,41 @@ namespace VOL.System.Services }).ToList(); } + public async Task GetVueDictionary_VT(string[] dicNos) + { + if (dicNos == null || dicNos.Count() == 0) return new string[] { }; + var dicConfig = await Task.FromResult( + DictionaryManager.GetDictionaries(dicNos, false).Select(s => new + { + dicNo = s.DicNo, + config = s.Config, + dbSql = s.DbSql, + list = s.Sys_DictionaryList.OrderByDescending(o => o.OrderNo) + .Select(list => new { value = list.DicValue, text = list.DicName }), + + CompanyField = string.IsNullOrWhiteSpace(s.CompanyField) ? "" : s.CompanyField + }).ToList()); + + object GetSourceData(string dicNo, string dbSql, string CompanyField, object data) + { + // 2020.05.01增加根据用户信息加载字典数据源sql + dbSql = DictionaryHandler.GetCustomDBSql(dicNo, dbSql, CompanyField); + if (string.IsNullOrEmpty(dbSql)) + { + return data as object; + } + + return repository.DapperContext.QueryList(dbSql, null); + } + return dicConfig.Select(item => new + { + item.dicNo, + item.config, + item.CompanyField, + data = GetSourceData(item.dicNo, item.dbSql, item.CompanyField, item.list) + }).ToList(); + } + /// /// 通过远程搜索 diff --git a/Vue.Net/VOL.WebApi/Controllers/System/Partial/Sys_DictionaryController.cs b/Vue.Net/VOL.WebApi/Controllers/System/Partial/Sys_DictionaryController.cs index f4eb2356..a7df542e 100644 --- a/Vue.Net/VOL.WebApi/Controllers/System/Partial/Sys_DictionaryController.cs +++ b/Vue.Net/VOL.WebApi/Controllers/System/Partial/Sys_DictionaryController.cs @@ -21,6 +21,13 @@ namespace VOL.System.Controllers return Content((await Service.GetVueDictionary(dicNos)).Serialize()); } + [HttpPost, Route("GetVueDictionary_VT")] + [ApiActionPermission()] + public async Task GetVueDictionary_VT([FromBody] string[] dicNos) + { + return Content((await Service.GetVueDictionary_VT(dicNos)).Serialize()); + } + /// /// 20200806 获取分公司列表 AllowAnonymous允许不经验证进行调用 /// @@ -32,6 +39,12 @@ namespace VOL.System.Controllers return Content((await Service.GetVueDictionary(new string[]{ "company" })).Serialize()); } + [HttpGet, Route("getCompany_VT"), AllowAnonymous] + public async Task GetCompany_VT() + { + return Content((await Service.GetVueDictionary_VT(new string[] { "company" })).Serialize()); + } + /// /// 20200806 获取分公司列表 AllowAnonymous允许不经验证进行调用 ///