增加返回值为value/text的vuedictionary方法

temp
ddlucky 2 years ago
parent 2a57db729b
commit e4a2403be1

@ -11,6 +11,7 @@ namespace VOL.System.IServices
/// <returns></returns>
Task<List<string>> GetBuilderDictionary();
Task<object> GetVueDictionary(string[] dicNos);
Task<object> GetVueDictionary_VT(string[] dicNos);
object GetTableDictionary(Dictionary<string, object[]> keyData);
Task<object> GetSearchDictionary(string dicNo, string value);

@ -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<object> 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<object>(dbSql, null);
}
return dicConfig.Select(item => new
{
item.dicNo,
item.config,
item.CompanyField,
data = GetSourceData(item.dicNo, item.dbSql, item.CompanyField, item.list)
}).ToList();
}
/// <summary>
/// 通过远程搜索

@ -21,6 +21,13 @@ namespace VOL.System.Controllers
return Content((await Service.GetVueDictionary(dicNos)).Serialize());
}
[HttpPost, Route("GetVueDictionary_VT")]
[ApiActionPermission()]
public async Task<IActionResult> GetVueDictionary_VT([FromBody] string[] dicNos)
{
return Content((await Service.GetVueDictionary_VT(dicNos)).Serialize());
}
/// <summary>
/// 20200806 获取分公司列表 AllowAnonymous允许不经验证进行调用
/// </summary>
@ -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<IActionResult> GetCompany_VT()
{
return Content((await Service.GetVueDictionary_VT(new string[] { "company" })).Serialize());
}
/// <summary>
/// 20200806 获取分公司列表 AllowAnonymous允许不经验证进行调用
/// </summary>

Loading…
Cancel
Save