diff --git a/Tiobon.Core.Api/Controllers/CommonController.cs b/Tiobon.Core.Api/Controllers/CommonController.cs index c56302f1..44ac5ae6 100644 --- a/Tiobon.Core.Api/Controllers/CommonController.cs +++ b/Tiobon.Core.Api/Controllers/CommonController.cs @@ -34,4 +34,17 @@ public class CommonController : BaseApiController return await _commonServices.GetMenuAsync(param); } #endregion + + #region 获取菜单 + /// + /// 获取菜单 + /// + /// + /// + [HttpPost, Route("GetModuleInfo")] + public async Task> GetModuleInfoAsync([FromBody] ModuleParam param) + { + return await _commonServices.GetModuleInfoAsync(param); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index fecd742b..fc165fb3 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -230,6 +230,13 @@ + + + 获取菜单 + + + + 构造函数 diff --git a/Tiobon.Core.Common/DB/Dapper/Utilities/DbAccess.cs b/Tiobon.Core.Common/DB/Dapper/Utilities/DbAccess.cs index 5610ffb8..fee6644b 100644 --- a/Tiobon.Core.Common/DB/Dapper/Utilities/DbAccess.cs +++ b/Tiobon.Core.Common/DB/Dapper/Utilities/DbAccess.cs @@ -100,14 +100,14 @@ public class DbAccess public static object ExecuteScalar(string cmd, object param = null, CommandType? commandType = null, bool beginTransaction = false) => Instance.ExecuteScalar(cmd, param, commandType, beginTransaction); public static async Task ExecuteScalarAsync(string cmd, object param = null, CommandType? commandType = null, bool beginTransaction = false) => await Instance.ExecuteScalarAsync(cmd, param, commandType, beginTransaction); - public static int ExcuteNonQuery(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false) => Instance.ExcuteNonQuery(cmd, param, commandType, beginTransaction); + public static int ExcuteNonQuery(string cmd, object param = null, CommandType? commandType = null, bool beginTransaction = false) => Instance.ExcuteNonQuery(cmd, param, commandType, beginTransaction); public static (List, List) QueryMultiple(string cmd, object param = null, CommandType? commandType = null, bool beginTransaction = false) => Instance.QueryMultiple(cmd, param, commandType, beginTransaction); public static (List, List, List) QueryMultiple(string cmd, object param = null, CommandType? commandType = null, bool beginTransaction = false) => Instance.QueryMultiple(cmd, param, commandType, beginTransaction); - public static int ExecuteDML(string cmd, object param, CommandType? commandType = null, IDbTransaction dbTransaction = null) => Instance.ExecuteDML(cmd, param, commandType, dbTransaction); + public static int ExecuteDML(string cmd, object param = null, CommandType? commandType = null, IDbTransaction dbTransaction = null) => Instance.ExecuteDML(cmd, param, commandType, dbTransaction); - public static async Task ExecuteDMLAsync(string cmd, object param, CommandType? commandType = null, IDbTransaction dbTransaction = null) => await Instance.ExecuteDMLAsync(cmd, param, commandType, dbTransaction); + public static async Task ExecuteDMLAsync(string cmd, object param = null, CommandType? commandType = null, IDbTransaction dbTransaction = null) => await Instance.ExecuteDMLAsync(cmd, param, commandType, dbTransaction); public static int Add(T entity, Expression> updateFileds = null, bool beginTransaction = false) { diff --git a/Tiobon.Core.IServices/ICommonServices.cs b/Tiobon.Core.IServices/ICommonServices.cs index 57c760be..b3d513d5 100644 --- a/Tiobon.Core.IServices/ICommonServices.cs +++ b/Tiobon.Core.IServices/ICommonServices.cs @@ -18,5 +18,5 @@ public interface ICommonServices : IBaseServices> Task> GetMenuAsync([FromBody] MenuParam param); - + Task> GetModuleInfoAsync([FromBody] ModuleParam param); } diff --git a/Tiobon.Core.Model/ViewModels/Menu.cs b/Tiobon.Core.Model/ViewModels/Menu.cs index 574b16f2..7b57eba4 100644 --- a/Tiobon.Core.Model/ViewModels/Menu.cs +++ b/Tiobon.Core.Model/ViewModels/Menu.cs @@ -27,6 +27,93 @@ public class DT_SubMenu public class DT_MenuColType { public string MenuColType { get; set; } +} + +public class ModuleParam +{ + public int langId { get; set; } + public string menuName { get; set; } + public string timestamp { get; set; } + public string token { get; set; } + public dynamic jsonParam { get; set; } +} +public class ModuleReturn +{ + public JM_PageControlT1 JM_PageControlT1 { get; set; } = new JM_PageControlT1(); + public JM_TableColumnT1 JM_TableColumnT1 { get; set; } = new JM_TableColumnT1(); + public List DT_PageMutiMsg { get; set; } -} \ No newline at end of file + public DT_Procedure DT_Procedure { get; set; } = new DT_Procedure(); +} + +public class JM_PageControlT1 +{ + public List Toolbar { get; set; } +} +public class Toolbar +{ + public string fnKey { get; set; } + public string fnKeyValue { get; set; } + public string fnTitle { get; set; } + public string fnType { get; set; } + public string position { get; set; } + public string icon { get; set; } + public bool display { get; set; } +} +public class JM_TableColumnT1 +{ + public List TableColumn { get; set; } +} +public class TableColumn +{ + public string PageSettingQueryId { get; set; } + public string elementType { get; set; } + public string field { get; set; } + public string label { get; set; } + public string Meky { get; set; } + public string multipleSelect { get; set; } + public string dataType { get; set; } + public string required { get; set; } + public string palceholder { get; set; } + public string dataSourceType { get; set; } + public string dataSource { get; set; } + public string sortable { get; set; } + public string sortOrder { get; set; } + public string defaultHidden { get; set; } + public string ConfigIsShow { get; set; } + public string filterable { get; set; } + public string width { get; set; } + public string align { get; set; } + public string fixed1 { get; set; } + public string editable { get; set; } + public string searchable { get; set; } + public string searchRequired { get; set; } + public string searchColumnSeq { get; set; } + public string multipleSearchValue { get; set; } + public string maxTagCount { get; set; } + public string selfDefine { get; set; } + public string selectUI { get; set; } + public string isPrimaryKey { get; set; } + public string isSorted { get; set; } + public string isHidden { get; set; } + public string isSearched { get; set; } + public string SortNo { get; set; } + public string searchCanOperator { get; set; } + public string searchColumnDefaultValue { get; set; } + public string AppColumnType { get; set; } +} + +public class DT_PageMutiMsg +{ + public string field { get; set; } + public string label { get; set; } +} + + +public class DT_Procedure +{ + public string EditProcedure { get; set; } + public string IUDProcedure { get; set; } + public string QueryProcedure { get; set; } +} diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index f630bb9a..cc6c295c 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using SqlSugar; using Tiobon.Core.Common; using Tiobon.Core.Common.DB.Dapper; using Tiobon.Core.IServices; @@ -20,7 +21,6 @@ public partial class CommonServices : BaseServices>, ICommon _httpContextAccessor = httpContextAccessor; } #region 获取菜单 - /// /// 获取菜单 /// @@ -83,7 +83,590 @@ public partial class CommonServices : BaseServices>, ICommon } return new ServiceResult() { Success = true, Message = "查询成功", Data = result, }; + } + #endregion + + #region 获取模块信息 + /// + /// 获取模块信息 + /// + /// + /// + public async Task> GetModuleInfoAsync([FromBody] ModuleParam param) + { + var result = new ModuleReturn(); + + #region 定义页面的操作按钮 + string sql = @"SELECT fnKey, + fnKeyValue, + [dbo].[FLangKeyToValue] (fnKeyValue, {2}, fnKeyValue) fnTitle, + fnType, + position, + icon, + 'true' display + FROM (SELECT CASE + WHEN substring (fnKey, 3, 99) + 'YN' = 'NewYN' THEN 1 + WHEN substring (fnKey, 3, 99) + 'YN' = 'ToExcelYN' THEN 2 + WHEN substring (fnKey, 3, 99) + 'YN' = 'FromExcelYN' THEN 3 + WHEN substring (fnKey, 3, 99) + 'YN' = 'BatchUpdateYN' THEN 4 + WHEN substring (fnKey, 3, 99) + 'YN' = 'BatchDelYN' THEN 5 + WHEN substring (fnKey, 3, 99) + 'YN' = 'LogYN' THEN 6 + WHEN substring (fnKey, 3, 99) + 'YN' = 'ManualYN' THEN 7 + WHEN substring (fnKey, 3, 99) + 'YN' = 'UpdateYN' THEN 2 + WHEN substring (fnKey, 3, 99) + 'YN' = 'DelYN' THEN 4 + WHEN substring (fnKey, 3, 99) + 'YN' = 'CopyYN' THEN 3 + WHEN substring (fnKey, 3, 99) + 'YN' = 'DetailYN' THEN 1 + ELSE 8 + END fnKeySeq, + substring (fnKey, 3, 99) + 'YN' fnKey, + 'Ghr_FnKey_' + fnKey fnKeyValue, + CASE + WHEN substring (fnKey, 3, 99) + 'YN' IN ('NewYN', + 'ToExcelYN', + 'FromExcelYN', + 'BatchUpdateYN', + 'BatchDelYN', + 'RecycleYN', + 'CancelRecycleYN', + 'ManualYN', + 'LogYN', + 'BatchDelYN', + 'BatchUpdateYN') + THEN + 'table' + WHEN substring (fnKey, 3, 99) + 'YN' IN ('UpdateYN', + 'DelYN', + 'CopyYN', + 'DetailYN') + THEN + 'row' + WHEN substring (fnKey, 3, 99) + 'YN' IN ('QueryYN', + 'AdvanceQueryYN', + 'QuerySettingYN', + '') + THEN + 'search' + ELSE + '' + END fnType, + 'left' position, + CASE substring (fnKey, 3, 99) + 'YN' + WHEN 'NewYN' THEN 'ghr-icon-add' + WHEN 'ToExcelYN' THEN 'ghr-file-export' + WHEN 'FromExcelYN' THEN 'ghr-file-import' + WHEN 'UpdateYN' THEN 'ghr-icon-edit' + WHEN 'BatchUpdateYN' THEN 'ghr-batch-update' + WHEN 'DelYN' THEN 'ghr-icon-trash' + WHEN 'BatchDelYN' THEN 'ghr-batch-del' + WHEN 'LogYN' THEN 'ghr-log' + WHEN 'ManualYN' THEN 'ghr-operation-manual' + WHEN 'CopyYN' THEN 'ghr-icon-copy' + WHEN 'DetailYN' THEN 'ghr-icon-eye-open' + ELSE '' + END icon + FROM (SELECT max (c.IsWaterMark) IsWaterMark, + max (c.IsPWDAgain) IsPWDAgain, + max (c.IsFromExcel) IsFromExcel, + max (c.IsToExcel) IsToExcel, + max (c.IsNew) IsNew, + max (c.IsDetail) IsDetail, + max (c.IsDel) IsDel, + max (c.IsDel) IsBatchDel, + max (c.IsUpdate) IsUpdate, + max (c.IsUpdate) IsBatchUpdate, + max (c.IsQuery) IsQuery, + max (c.IsPrint) IsPrint, + 0 IsLog, + max (c.IsManual) IsManual, + max (c.IsCopy) IsCopy + FROM Ghrs_UserRole a, Ghrs_RoleMenu c, Ghrs_Menu d + WHERE a.IsEnable = 1 + AND c.IsEnable = 1 + AND d.IsEnable = 1 + AND EXISTS + (SELECT 1 + FROM Ghrs_Role kk + WHERE kk.roleid = a.roleid AND kk.IsEnable = 1) + AND a.UserID = '{1}' + AND a.RoleId = c.RoleID + AND c.MenuId = d.MenuId + AND d.MenuNo = '{0}') kk + UNPIVOT (fnKeyValue + FOR fnKey + IN (IsWaterMark, + IsPWDAgain, + IsFromExcel, + IsToExcel, + IsNew, + IsDetail, + IsUpdate, + IsDel, + IsQuery, + IsPrint, + IsLog, + IsManual, + IsCopy, + IsBatchUpdate, + IsBatchDel)) AS tt + WHERE fnKeyValue > 0 + UNION ALL + SELECT NULL fnKeySeq, + 'QuerySettingYN' fnKey, + 'GHR_Common_000064' fnTitle, + 'search' fnType, + 'left' position, + NULL icon + UNION ALL + SELECT NULL fnKeySeq, + 'LabelYN' fnKey, + 'GHR_Common_000065' fnTitle, + NULL fnType, + NULL position, + NULL icon + UNION ALL + SELECT NULL fnKeySeq, + 'MoreStyleYN' fnKey, + 'GHR_Common_000066' fnTitle, + NULL fnType, + NULL position, + NULL icon + UNION ALL + SELECT NULL fnKeySeq, + 'SetDefault' fnKey, + [dbo].[FLangKeyToValue]('GHR_Common_000000',{2},'恢复默认') fnTitle, + 'table' fnType, + 'left' position, + 'ghr-icon-setDefault' icon + UNION ALL + SELECT NULL fnKeySeq, + 'GridView' fnKey, + 'GHR_Common_000067' fnTitle, + 'table' fnType, + 'right' position, + 'ant-design:setting-outlined' icon + UNION ALL + SELECT NULL fnKeySeq, + 'DataSort' fnKey, + 'GHR_Common_000045' fnTitle, + 'table', + 'left', + 'ghr-data-sort' + UNION ALL + SELECT NULL fnKeySeq, + 'Muti' fnKey, + 'GHR_Common_000062' fnTitle, + 'row', + 'left', + 'ghr-icon-global') A + WHERE fnKey NOT IN + (SELECT b.field + FROM Ghrs_UserPageSettingQueryColumn a, Ghrs_PageSettingQuery b + WHERE a.PageSettingQueryId = b.PageSettingQueryId + AND a.UserID = '{1}' + AND b.PageNo = '{0}' + AND a.IsEnable = 1 + AND b.IsEnable = 1 + AND a.isHidden = 'true' + AND b.elementType = 'FnKey') order by fnKeySeq"; + + sql = string.Format(sql, param.menuName, App.User.ID, param.langId); + result.JM_PageControlT1.Toolbar = DbAccess.QueryList(sql); + + #endregion + + #region 定义表格页面的栏位, 含 表格栏位, 常用查询栏位, 高级查询栏位,可编辑栏位 + + + Db.Ado.BeginTran(); + sql = @"IF OBJECT_ID('tempdb.[dbo].[#TmpInitPageSettingQuery]') IS NOT NULL DROP TABLE [dbo].[#TmpInitPageSettingQuery] + CREATE TABLE [dbo].[#TmpInitPageSettingQuery](pageColumnID int) alter TABLE [dbo].[#TmpInitPageSettingQuery] + add [elementType] [nvarchar](1000) , [field] [nvarchar](1000) ,[label] [nvarchar](1000) , + [meky] [nvarchar](100) , [multipleSelect] [nvarchar](1000) , [dataType] [nvarchar](1000) , + [required] [nvarchar](1000) , [palceholder] [nvarchar](1000) , [dataSourceType] [nvarchar](1000) , + [dataSource] [nvarchar](1000) , [sortable] [nvarchar](1000) , [sortOrder] [nvarchar](1000) , + [defaultHidden] [nvarchar](1000) ,[ConfigIsShow] [nvarchar](1000) , [filterable] [nvarchar](1000) , [width] int, + [align] [nvarchar](1000) , [fixed] [nvarchar](1000) , + [editable] [nvarchar](1000) , [searchable] [nvarchar](1000) , [searchRequired] [nvarchar](1000) , + [searchColumnSeq] int , [multipleSearchValue] [nvarchar](1000) , [maxTagCount] [nvarchar](1000) , + [selfDefine] [nvarchar](2000) , [selectUI] [nvarchar](1000) , [isPrimaryKey] [nvarchar](1000) , + isSorted nvarchar(10),isHidden nvarchar(10),isSearched nvarchar(10),sortNo int, + [searchOperator] nvarchar(max),searchColumnDefaultValue nvarchar(1000),AppColumnType nvarchar(100)"; + int count = Db.Ado.ExecuteCommand(sql); + + + sql = @"SELECT count (1) UserHasSetting + FROM Ghrs_UserPageSettingQueryColumn a, Ghrs_PageSettingQuery b + WHERE b.PageNo = '{0}' + AND b.IsEnable = 1 + AND b.field ! = 'Muti' + AND a.UserID = '{1}' + AND a.IsEnable = 1 + AND a.PageSettingQueryId = b.PageSettingQueryId"; + sql = string.Format(sql, param.menuName, App.User.ID); + int UserHasSetting = Db.Ado.GetInt(sql); + if (UserHasSetting == 0) + { + sql = @"insert into [dbo].[#TmpInitPageSettingQuery] + select PageSettingQueryId,elementType,field,label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false'isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue,'' AppColumnType + from Ghrs_PageSettingQuery where PageNo='F_Title' and elementType not in ( 'PageGroup') and IsEnable=1 + order by SortNo"; + count = Db.Ado.ExecuteCommand(sql); + } + else + { + sql = @"insert into [dbo].[#TmpInitPageSettingQuery] + select a.PageSettingQueryId,elementType,field,label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,b.APIDataSourceID) dataSource, + sortable,isnull(a.sortOrder,b.sortOrder),defaultHidden, ConfigIsShow,filterable, + case when isnull(a.width,b.width) ='' then '100' else isnull(a.width,b.width) end ,align,a.fixed,editable, searchable,searchRequired,isnull(a.searchColumnSeq,b.searchColumnSeq),multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + a.isSorted isSorted, isnull(a.isHidden,'false') isHidden, + case when a.searchColumnSeq is null or a.searchColumnSeq='' then 'false' else 'true' end isSearched,a.SortNo, + b.searchCanOperator ,'' searchColumnDefaultValue,'' AppColumnType + from Ghrs_UserPageSettingQueryColumn a,Ghrs_PageSettingQuery b + where b.PageNo='F_Title' and b.IsEnable=1 and b.elementType not in ( 'PageGroup') + and a.UserID=1 and a.IsEnable=1 and a.PageSettingQueryId=b.PageSettingQueryId + order by a.SortNo,b.SortNo + + insert into [dbo].[#TmpInitPageSettingQuery] + select PageSettingQueryId,elementType,field,label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false' isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue ,'' AppColumnType + from Ghrs_PageSettingQuery where PageNo='F_Title' and elementType not in ( 'PageGroup') and IsEnable=1 + and elementtype='FnKey' + and not exists (select 1 from [dbo].[#TmpInitPageSettingQuery] kk + where kk.pageColumnID=Ghrs_PageSettingQuery.PageSettingQueryId + and kk.field=Ghrs_PageSettingQuery.field + and kk.elementtype=Ghrs_PageSettingQuery.elementtype) + order by SortNo "; + count = Db.Ado.ExecuteCommand(sql); + } + + + sql = @" + -- 多语言的栏位的特别更新 + if OBJECT_ID('tempdb.[dbo].[#TempInitUserPageFnKey]') IS NOT NULL + begin + insert into [dbo].[#TmpInitPageSettingQuery] + select 0,elementType,field,label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false'isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue ,'' AppColumnType + from Ghrs_PageSettingQuery where field='Muti' and IsEnable=1 + and elementtype='FnKey' and pageno='F_Dept' + and exists (select 1 from [dbo].[#TempInitUserPageFnKey] where fnKey='Muti') + and not exists (select 1 from [dbo].[#TmpInitPageSettingQuery] kk + where kk.pageColumnID=Ghrs_PageSettingQuery.PageSettingQueryId + and kk.field=Ghrs_PageSettingQuery.field + and kk.elementtype=Ghrs_PageSettingQuery.elementtype) + order by SortNo + -- 明细按钮的宽度 + insert into [dbo].[#TmpInitPageSettingQuery] + select 0,elementType,'DetailYN',label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false'isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue,'' AppColumnType + from Ghrs_PageSettingQuery where field='Muti' and IsEnable=1 + and elementtype='FnKey' and pageno='F_Dept' + and exists (select 1 from [dbo].[#TempInitUserPageFnKey] where fnKey='DetailYN') + and not exists (select 1 from [dbo].[#TmpInitPageSettingQuery] kk + where field='DetailYN' and elementtype='FnKey') + order by SortNo + end + else + begin + insert into [dbo].[#TmpInitPageSettingQuery] + select 0,elementType,field,label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false'isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue ,'' AppColumnType + from Ghrs_PageSettingQuery where field='Muti' and IsEnable=1 + and elementtype='FnKey' and pageno='F_Dept' + and not exists (select 1 from [dbo].[#TmpInitPageSettingQuery] kk + where kk.pageColumnID=Ghrs_PageSettingQuery.PageSettingQueryId + and kk.field=Ghrs_PageSettingQuery.field + and kk.elementtype=Ghrs_PageSettingQuery.elementtype) + order by SortNo + -- 明细按钮的宽度 + insert into [dbo].[#TmpInitPageSettingQuery] + select 0,elementType,'DetailYN',label,Meky,multipleSelect,dataType,required,palceholder,dataSourceType, + dbo.FS_GetdataSourceBySet(dataSource,APIDataSourceType,Ghrs_PageSettingQuery.APIDataSourceID) dataSource, + sortable,sortOrder,defaultHidden, ConfigIsShow,filterable, + case when width='' then '100' else width end ,align,fixed,editable, searchable,searchRequired,searchColumnSeq,multipleSearchValue,maxTagCount,selfDefine,selectUI,isPrimaryKey, + 'false'isSorted, 'false' isHidden, + case when searchColumnSeq is null or searchColumnSeq='' then 'false' else 'true' end isSearched,SortNo, + searchCanOperator,'' searchColumnDefaultValue ,'' AppColumnType + from Ghrs_PageSettingQuery where field='Muti' and IsEnable=1 + and elementtype='FnKey' and pageno='F_Dept' + and not exists (select 1 from [dbo].[#TmpInitPageSettingQuery] kk + where field='DetailYN' and elementtype='FnKey') + order by SortNo + end + -- 更新可编辑 + if OBJECT_ID('tempdb.[dbo].[#TempInitUserPageFnKey]') IS NOT NULL + begin + update [dbo].[#TmpInitPageSettingQuery] set editable='false' + where ( not exists (select 1 from [dbo].[#TempInitUserPageFnKey] where fnKey='UpdateYN' + and 'F_Title' not in ('F_Staff~1','F_StaffToDo','F_StaffQuery', + 'F_StaffChangeToDo','F_StaffChangeToEnable','F_StaffChangeQuery', + 'F_SalaryChangeToDo','F_SalaryChange','F_SalaryChangeQuery' + ) + ) and + not exists (select 1 from [dbo].[#TempInitUserPageFnKey] where fnKey='TBD2YN' + and 'F_Title' in ('F_Staff~1','F_StaffToDo','F_StaffQuery') ) and + not exists (select 1 from [dbo].[#TempInitUserPageFnKey] where fnKey='TBD5YN' + and 'F_Title' in ('F_StaffChangeToDo','F_StaffChangeToEnable','F_StaffChangeQuery' , + 'F_SalaryChangeToDo','F_SalaryChange','F_SalaryChangeQuery') + ) + ) + and 'F_Title' not in ( 'F_SchedulePeriodSetup') + end + -- 更新栏位说明(从多语言里面) + update [dbo].[#TmpInitPageSettingQuery] set label=[dbo].[FLangKeyToValue](Meky,1,label); + update [dbo].[#TmpInitPageSettingQuery] set width=50 where elementType='FnKey' or field='Muti' ;"; + count = Db.Ado.ExecuteCommand(sql); + + sql = @"select pageColumnID,elementType, field,label,meky, multipleSelect, dataType, + required, palceholder, dataSourceType,dataSource, sortable, sortOrder, + defaultHidden, ConfigIsShow, filterable, width,align, fixed,editable, searchable, + searchRequired,searchColumnSeq, multipleSearchValue, maxTagCount, + selfDefine, selectUI, isPrimaryKey,isSorted,isHidden,isSearched,sortNo, + ( select ParaDetailNo operator, + [dbo].[FLangKeyToValue](MKey,1,ParaDetailName) operatorDesc, + SqlFunction operatorIcon + from Ghrs_ParaDetail where ParaMasterId=13 and IsEnable=1 + and ParaDetailNo in (select Value from dbo.Fs1_GHR30_SplitString2(searchOperator,',')) + order by (select positon from dbo.Fs1_GHR30_SplitString2(searchOperator,',') + where value= ParaDetailNo) + FOR JSON Path ) searchOperator , + iif(ISJSON(searchColumnDefaultValue)=1,JSON_QUERY(searchColumnDefaultValue),null) searchColumnDefaultValue , + AppColumnType + from [dbo].[#TmpInitPageSettingQuery] + order by sortno"; + result.JM_TableColumnT1.TableColumn = Db.Ado.SqlQuery(sql); + Db.Ado.CommitTran(); + + sql = @"SELECT Langkey field, + CASE 1 + WHEN 1 THEN isnull (Value01, LangValue) + WHEN 2 THEN isnull (Value02, LangValue) + WHEN 3 THEN isnull (Value03, LangValue) + WHEN 4 THEN isnull (Value04, LangValue) + WHEN 5 THEN isnull (Value05, LangValue) + WHEN 6 THEN isnull (Value06, LangValue) + WHEN 7 THEN isnull (Value07, LangValue) + WHEN 8 THEN isnull (Value08, LangValue) + WHEN 9 THEN isnull (Value09, LangValue) + WHEN 10 THEN isnull (Value10, LangValue) + END label +FROM Ghrs_LangKey +WHERE IsEnable = 1 + AND (LangKey LIKE 'GHR_Page%' OR LangKey LIKE 'GHR_Common%')"; + result.DT_PageMutiMsg = Db.Ado.SqlQuery(sql); + + sql = "select QueryProcedure, EditProcedure, IUDProcedure from Ghrs_Menu where MenuNo='F_Title'"; + DataTable dt = Db.Ado.GetDataTable(sql); + if(dt.Rows.Count > 0) + { + result.DT_Procedure.QueryProcedure = dt.Rows[0]["QueryProcedure"].ToString(); + result.DT_Procedure.EditProcedure = dt.Rows[0]["EditProcedure"].ToString(); + result.DT_Procedure.IUDProcedure = dt.Rows[0]["IUDProcedure"].ToString(); + } + //if (UserHasSetting == 0) + //{ + // sql = @"SELECT PageSettingQueryId, + // elementType, + // field, + // label, + // Meky, + // multipleSelect, + // dataType, + // required, + // palceholder, + // dataSourceType, + // dbo.FS_GetdataSourceBySet + // (dataSource, APIDataSourceType, Ghrs_PageSettingQuery.APIDataSourceID) + // dataSource, + // sortable, + // sortOrder, + // defaultHidden, + // ConfigIsShow, + // filterable, + // CASE WHEN width = '' THEN '100' ELSE width END width, + // align, + // fixed fixed1, + // editable, + // searchable, + // searchRequired, + // searchColumnSeq, + // multipleSearchValue, + // maxTagCount, + // selfDefine, + // selectUI, + // isPrimaryKey, + // 'false' + // isSorted, + // 'false' + // isHidden, + // CASE + // WHEN searchColumnSeq IS NULL OR searchColumnSeq = '' THEN 'false' + // ELSE 'true' + // END + // isSearched, + // SortNo, + // searchCanOperator, + // '' + // searchColumnDefaultValue, + // '' + // AppColumnType + // FROM Ghrs_PageSettingQuery + // WHERE PageNo = '{0}' + // AND elementType NOT IN ('PageGroup') + // AND IsEnable = 1 + // ORDER BY SortNo"; + // sql = string.Format(sql, param.menuName); + //} + + //else + //{ + // sql = @"SELECT a.PageSettingQueryId, + // elementType, + // field, + // label, + // Meky, + // multipleSelect, + // dataType, + // required, + // palceholder, + // dataSourceType, + // dbo.FS_GetdataSourceBySet + // (dataSource, APIDataSourceType, b.APIDataSourceID) + // dataSource, + // sortable, + // isnull (a.sortOrder, b.sortOrder), + // defaultHidden, + // ConfigIsShow, + // filterable, + // CASE + // WHEN isnull (a.width, b.width) = '' THEN '100' + // ELSE isnull (a.width, b.width) + // END width, + // align, + // a.fixed fixed1, + // editable, + // searchable, + // searchRequired, + // isnull (a.searchColumnSeq, b.searchColumnSeq) searchColumnSeq, + // multipleSearchValue, + // maxTagCount, + // selfDefine, + // selectUI, + // isPrimaryKey, + // a.isSorted + // isSorted, + // isnull (a.isHidden, 'false') + // isHidden, + // CASE + // WHEN a.searchColumnSeq IS NULL OR a.searchColumnSeq = '' + // THEN + // 'false' + // ELSE + // 'true' + // END + // isSearched, + // a.SortNo, + // b.searchCanOperator, + // '' + // searchColumnDefaultValue, + // '' + // AppColumnType + // FROM Ghrs_UserPageSettingQueryColumn a, Ghrs_PageSettingQuery b + // WHERE b.PageNo = '{0}' + // AND b.IsEnable = 1 + // AND b.elementType NOT IN ('PageGroup') + // AND a.UserID = '{1}' + // AND a.IsEnable = 1 + // AND a.PageSettingQueryId = b.PageSettingQueryId + // ORDER BY a.SortNo, b.SortNo"; + // sql = string.Format(sql, param.menuName, App.User.ID); + + // sql = @"SELECT PageSettingQueryId, + // elementType, + // field, + // label, + // Meky, + // multipleSelect, + // dataType, + // required, + // palceholder, + // dataSourceType, + // dbo.FS_GetdataSourceBySet + // (dataSource, APIDataSourceType, Ghrs_PageSettingQuery.APIDataSourceID) + // dataSource, + // sortable, + // sortOrder, + // defaultHidden, + // ConfigIsShow, + // filterable, + // CASE WHEN width = '' THEN '100' ELSE width END width, + // align, + // fixed fixed1, + // editable, + // searchable, + // searchRequired, + // searchColumnSeq, + // multipleSearchValue, + // maxTagCount, + // selfDefine, + // selectUI, + // isPrimaryKey, + // 'false' + // isSorted, + // 'false' + // isHidden, + // CASE + // WHEN searchColumnSeq IS NULL OR searchColumnSeq = '' THEN 'false' + // ELSE 'true' + // END + // isSearched, + // SortNo, + // searchCanOperator, + // '' + // searchColumnDefaultValue, + // '' + // AppColumnType + // FROM Ghrs_PageSettingQuery + // WHERE PageNo = '{0}' + // AND elementType NOT IN ('PageGroup') + // AND IsEnable = 1 + // AND elementtype = 'FnKey' ORDER BY SortNo"; + // sql = string.Format(sql, param.menuName ); + //} + + //result.JM_TableColumnT1 = DbAccess.QueryList(sql); + + #endregion + + return new ServiceResult() { Success = true, Message = "查询成功", Data = result, }; } #endregion