diff --git a/Tiobon.Core.Model/Base/Ghra/Ghra_StaffGroupDetail.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghra/Ghra_StaffGroupDetail.Dto.Base.cs index 08d1dcd1..8fb7f8b3 100644 --- a/Tiobon.Core.Model/Base/Ghra/Ghra_StaffGroupDetail.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghra/Ghra_StaffGroupDetail.Dto.Base.cs @@ -47,7 +47,7 @@ namespace Tiobon.Core.Model.Models /// 字段所选值 /// [Display(Name = "FieldValue"), Description("字段所选值"), MaxLength(-1, ErrorMessage = "字段所选值 不能超过 -1 个字符")] - public string FieldValue { get; set; } + public object FieldValue { get; set; } /// /// 备注 diff --git a/Tiobon.Core.Model/Models/Ghra/Ghra_StaffGroupDetail.cs b/Tiobon.Core.Model/Models/Ghra/Ghra_StaffGroupDetail.cs index 0251e3cb..8da0322d 100644 --- a/Tiobon.Core.Model/Models/Ghra/Ghra_StaffGroupDetail.cs +++ b/Tiobon.Core.Model/Models/Ghra/Ghra_StaffGroupDetail.cs @@ -49,7 +49,7 @@ namespace Tiobon.Core.Model.Models /// 字段所选值 /// [Display(Name = "FieldValue"), Description("字段所选值"), MaxLength(-1, ErrorMessage = "字段所选值 不能超过 -1 个字符")] - public string FieldValue { get; set; } + public object FieldValue { get; set; } /// /// 备注 diff --git a/Tiobon.Core.Services/Ghra/Ghra_StaffGroupServices.cs b/Tiobon.Core.Services/Ghra/Ghra_StaffGroupServices.cs index ea6e1e63..dacbd1d3 100644 --- a/Tiobon.Core.Services/Ghra/Ghra_StaffGroupServices.cs +++ b/Tiobon.Core.Services/Ghra/Ghra_StaffGroupServices.cs @@ -60,7 +60,23 @@ namespace Tiobon.Core.Services var StaffGroupDetail = await _StaffGroupDetailServices.Query(x => x.StaffGroupID == body.id); result.result.DT_TableDataT1[0].StaffGroupDetail = StaffGroupDetail.OrderBy(x => x.SortNo).ToList(); - + result.result.DT_TableDataT1[0].StaffGroupDetail.ForEach((x) => + { + if (x.FieldValue != null) + { + if (JsonHelper.IsJson(x.FieldValue.ToString())) + { + try + { + x.FieldValue = JsonHelper.JsonToObj>(x.FieldValue.ToString()); + } + catch (Exception) + { + x.FieldValue = JsonHelper.JsonToObj>(x.FieldValue.ToString()); + } + } + } + }); if (body.doType == "Copy") { result.result.DT_TableDataT1[0].StaffGroupNo = null; @@ -72,18 +88,20 @@ namespace Tiobon.Core.Services { var result = await base.QueryFilterPage(filter, condition, IsEnable); - //var a = await _StaffGroupDetailServices.Query(); - //result.result.DT_TableDataT1.ForEach(async x => - //{ - // x.DetailInfo = (await _StaffGroupDetailServices.Query(a => a.StaffGroupID == x.Id)) - // .Select(a => a.StaffField).ToString(); - //}); + + result.result.DT_TableDataT1.ForEach(async x => + { + x.DetailInfo = Db.Ado.SqlQuerySingle($@"select stuff((select distinct ',' + (select top 1 dbo.FLangKeyToValue(MKey,1,StaffInfoColumnName) from Ghra_StaffInfoColumn where IsEnable=1 and StaffInfoGroupId = 1 and IsRelease = 1 and StaffInfoColumnNo=a.StaffField) + from Ghra_StaffGroupDetail a + where StaffGroupID = {x.Id} + for XML path(''),type).value('.','nvarchar(max)'),1,1,'')"); + }); return result; } - public async Task> GetStaffInfoColumnData() - { + public async Task> GetStaffInfoColumnData() + { string sql = @$"select StaffInfoColumnNo, dbo.FLangKeyToValue(MKey,1,StaffInfoColumnName) StaffInfoColumnName, ColumnType elementType, @@ -92,7 +110,7 @@ namespace Tiobon.Core.Services else '' end dataSourceType, dbo.FS_GetdataSourceBySet('',DataSourceType, DataSource) dataSource , case when ColumnType in ('OrgTreeSelect','ApiSelect','StaffSelect') then 1 - else 0 end multipleSelect, + else 0 end multipleSelectInt, (select ParaDetailNo operatorNo,ParaDetailName operatorDesc,SqlFunction operatorIcon,SortNo from Ghrs_ParaDetail where IsEnable= 1 and ParaDetailNo in (select value from dbo.Fs1_GHR30_SplitString(case when ColumnType in ('OrgTreeSelect','ApiSelect','StaffSelect') @@ -115,33 +133,34 @@ namespace Tiobon.Core.Services and StaffInfoGroupId = 1 and IsRelease = 1 and StaffInfoColumnNo != 'AttachmentIDs' "; - + var result = Db.Ado.SqlQuery(sql); - result.ForEach( x => + result.ForEach(x => { - x.operatorData = JsonConvert.DeserializeObject>(x.OperatorDataStr); + x.operatorData = JsonConvert.DeserializeObject>(x.OperatorDataStr); }); return ServiceResult.OprateSuccess("查询成功!", result); } - public class StaffInfoColumn() + public class StaffInfoColumn() { - public string StaffInfoColumnNo { get; set; } + public string StaffInfoColumnNo { get; set; } public string StaffInfoColumnName { get; set; } public string elementType { get; set; } + public string dataType { get; set; } public string dataSourceType { get; set; } public string dataSource { get; set; } - public int multipleSelect { get; set; } - + public int multipleSelectInt { get; set; } + public bool multipleSelect => multipleSelectInt == 1 ? true : false; public string OperatorDataStr { get; set; } - public List operatorData { get; set; } + public List operatorData { get; set; } } public class OperatorData() { public string operatorNo { get; set; } public string ParaDetailName { get; set; } public string operatorIcon { get; set; } - public string SortNo { get; set; } + public string SortNo { get; set; } } }