|
|
@ -51,29 +51,43 @@ namespace BBWYB.Client.ViewModels |
|
|
|
|
|
|
|
|
|
|
|
IList<Department> departmentList = null; |
|
|
|
var response = mdsApiService.GetShopDetailList(); |
|
|
|
if (!response.Success) |
|
|
|
throw new Exception(response.Msg); |
|
|
|
departmentList = response.Data.Where(d => d.Name.Contains("供应链")).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var res = shopService.GetDepartmentList(); |
|
|
|
if (!res.Success) |
|
|
|
throw new Exception(res.Msg); |
|
|
|
var allDepartmentList = res.Data.Map<IList<Department>>(); |
|
|
|
var shopList = new List<Shop>(); |
|
|
|
foreach (var d in allDepartmentList) |
|
|
|
shopList.AddRange(d.ShopList); |
|
|
|
GlobalContext.User.ShopList = shopList; |
|
|
|
|
|
|
|
//if (managerDepartment.Contains(GlobalContext.User.TeamName) ||
|
|
|
|
// managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m)))
|
|
|
|
//{
|
|
|
|
// var res = shopService.GetDepartmentList();
|
|
|
|
// if (!res.Success)
|
|
|
|
// throw new Exception(res.Msg);
|
|
|
|
// var allDepartmentList = res.Data.Map<IList<Department>>();
|
|
|
|
|
|
|
|
if (managerDepartment.Contains(GlobalContext.User.TeamName) || |
|
|
|
managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) |
|
|
|
{ |
|
|
|
var res = shopService.GetDepartmentList(); |
|
|
|
if (!res.Success) |
|
|
|
throw new Exception(res.Msg); |
|
|
|
var allDepartmentList = res.Data.Map<IList<Department>>(); |
|
|
|
|
|
|
|
|
|
|
|
var shopList = new List<Shop>(); |
|
|
|
foreach (var d in allDepartmentList) |
|
|
|
shopList.AddRange(d.ShopList); |
|
|
|
GlobalContext.User.ShopList = shopList; |
|
|
|
departmentList = allDepartmentList.Where(d => d.Name.Contains("供应链")).ToList(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var response = mdsApiService.GetShopDetailList(); |
|
|
|
if (!response.Success) |
|
|
|
throw new Exception(response.Msg); |
|
|
|
departmentList = response.Data.Where(d => d.Name.Contains("供应链")).ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
// var shopList = new List<Shop>();
|
|
|
|
// foreach (var d in allDepartmentList)
|
|
|
|
// shopList.AddRange(d.ShopList);
|
|
|
|
// GlobalContext.User.ShopList = shopList;
|
|
|
|
// departmentList = allDepartmentList.Where(d => d.Name.Contains("供应链")).ToList();
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// var response = mdsApiService.GetShopDetailList();
|
|
|
|
// if (!response.Success)
|
|
|
|
// throw new Exception(response.Msg);
|
|
|
|
// departmentList = response.Data.Where(d => d.Name.Contains("供应链")).ToList();
|
|
|
|
//}
|
|
|
|
|
|
|
|
if (departmentList.Count == 0) |
|
|
|
throw new Exception("缺少有效的部门数据"); |
|
|
|