From 612359f92a91eb9fddca35564acae2500cfa6b77 Mon Sep 17 00:00:00 2001 From: zpc Date: Wed, 3 Sep 2025 02:48:11 +0800 Subject: [PATCH] 333 --- CoreCms.Net.Configuration/GlobalConstVars.cs | 1 + .../ISQReservationParticipantsRepository.cs | 103 +++ .../SQ/ISQReservationParticipantsServices.cs | 99 +++ CoreCms.Net.Model/CoreCms.Net.Model.csproj | 1 + .../Entities/SQ/SQReservationParticipants.cs | 116 +++ .../Entities/SQ/SQReservations.cs | 299 ++++---- CoreCms.Net.Model/Entities/SQ/SQRooms.cs | 2 +- .../SQ/SQReservationParticipantsDto.cs | 30 + .../ViewModels/SQ/SQReservationsDto.cs | 18 + .../SQ/SQReservationParticipantsRepository.cs | 242 ++++++ .../SQ/SQReservationParticipantsServices.cs | 137 ++++ .../SQ/SQReservationParticipantsController.cs | 689 ++++++++++++++++++ .../SQ/SQReservationsController.cs | 75 +- .../Controllers/SQ/SQRoomsController.cs | 4 +- CoreCms.Net.Web.Admin/Doc.xml | 85 ++- CoreCms.Net.Web.Admin/Program.cs | 3 +- ...485-SQReservations导出(查询结果).xls | Bin 0 -> 5632 bytes ...831-SQReservations导出(选择结果).xls | Bin 0 -> 5120 bytes .../sq/sqreservationparticipants/create.html | 88 +++ .../sq/sqreservationparticipants/details.html | 90 +++ .../sq/sqreservationparticipants/edit.html | 88 +++ .../sq/sqreservationparticipants/index.html | 419 +++++++++++ .../views/sq/sqreservations/create.html | 130 ++-- .../views/sq/sqreservations/details.html | 410 ++++++----- .../wwwroot/views/sq/sqreservations/edit.html | 519 ++++++++----- .../views/sq/sqreservations/index.html | 219 +++++- .../wwwroot/views/sq/sqrooms/create.html | 4 +- .../wwwroot/views/sq/sqrooms/edit.html | 4 +- .../wwwroot/views/sq/sqrooms/index.html | 4 +- 29 files changed, 3284 insertions(+), 595 deletions(-) create mode 100644 CoreCms.Net.IRepository/SQ/ISQReservationParticipantsRepository.cs create mode 100644 CoreCms.Net.IServices/SQ/ISQReservationParticipantsServices.cs create mode 100644 CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs create mode 100644 CoreCms.Net.Model/ViewModels/SQ/SQReservationParticipantsDto.cs create mode 100644 CoreCms.Net.Model/ViewModels/SQ/SQReservationsDto.cs create mode 100644 CoreCms.Net.Repository/SQ/SQReservationParticipantsRepository.cs create mode 100644 CoreCms.Net.Services/SQ/SQReservationParticipantsServices.cs create mode 100644 CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationParticipantsController.cs create mode 100644 CoreCms.Net.Web.Admin/wwwroot/files/2025-09-03/20250903002308485-SQReservations导出(查询结果).xls create mode 100644 CoreCms.Net.Web.Admin/wwwroot/files/2025-09-03/20250903002415831-SQReservations导出(选择结果).xls create mode 100644 CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/create.html create mode 100644 CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/details.html create mode 100644 CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/edit.html create mode 100644 CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/index.html diff --git a/CoreCms.Net.Configuration/GlobalConstVars.cs b/CoreCms.Net.Configuration/GlobalConstVars.cs index 962489b..407a58d 100644 --- a/CoreCms.Net.Configuration/GlobalConstVars.cs +++ b/CoreCms.Net.Configuration/GlobalConstVars.cs @@ -281,6 +281,7 @@ public const string CacheSQRooms = "CacheSQRooms"; public const string CacheSQRoomUnavailableTimes = "CacheSQRoomUnavailableTimes"; public const string CacheSQReservations = "CacheSQReservations"; + public const string CacheSQReservationParticipants = "CacheSQReservationParticipants"; diff --git a/CoreCms.Net.IRepository/SQ/ISQReservationParticipantsRepository.cs b/CoreCms.Net.IRepository/SQ/ISQReservationParticipantsRepository.cs new file mode 100644 index 0000000..0f280b4 --- /dev/null +++ b/CoreCms.Net.IRepository/SQ/ISQReservationParticipantsRepository.cs @@ -0,0 +1,103 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + + +namespace CoreCms.Net.IRepository +{ + /// + /// 预约记录表 工厂接口 + /// + public interface ISQReservationParticipantsRepository : IBaseRepository + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + new Task InsertAsync(SQReservationParticipants entity); + + + /// + /// 重写异步更新方法 + /// + /// + /// + new Task UpdateAsync(SQReservationParticipants entity); + + + /// + /// 重写异步更新方法 + /// + /// + /// + new Task UpdateAsync(List entity); + + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + new Task DeleteByIdAsync(object id); + + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + new Task DeleteByIdsAsync(int[] ids); + + #endregion + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + Task> GetCaChe(); + + /// + /// 更新cache + /// + Task> UpdateCaChe(); + + #endregion + + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + new Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + + } +} diff --git a/CoreCms.Net.IServices/SQ/ISQReservationParticipantsServices.cs b/CoreCms.Net.IServices/SQ/ISQReservationParticipantsServices.cs new file mode 100644 index 0000000..23e1c56 --- /dev/null +++ b/CoreCms.Net.IServices/SQ/ISQReservationParticipantsServices.cs @@ -0,0 +1,99 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IServices +{ + /// + /// 预约记录表 服务工厂接口 + /// + public interface ISQReservationParticipantsServices : IBaseServices + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + new Task InsertAsync(SQReservationParticipants entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + new Task UpdateAsync(SQReservationParticipants entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + new Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + new Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + new Task DeleteByIdsAsync(int[] ids); + + #endregion + + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + Task> GetCaChe(); + + /// + /// 更新cache + /// + Task> UpdateCaChe(); + + #endregion + + #region 重写根据条件查询分页数据 + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + new Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + #endregion + } +} diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.csproj b/CoreCms.Net.Model/CoreCms.Net.Model.csproj index 5479a18..ababc3c 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.csproj +++ b/CoreCms.Net.Model/CoreCms.Net.Model.csproj @@ -5,6 +5,7 @@ + diff --git a/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs b/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs new file mode 100644 index 0000000..95b5720 --- /dev/null +++ b/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs @@ -0,0 +1,116 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + +using SqlSugar; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace CoreCms.Net.Model.Entities +{ + /// + /// 预约记录表 + /// + public partial class SQReservationParticipants + { + /// + /// 构造函数 + /// + public SQReservationParticipants() + { + } + + /// + /// 参与记录ID + /// + [Display(Name = "参与记录ID")] + + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 id { get; set; } + + + /// + /// 预约ID + /// + [Display(Name = "预约ID")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 reservation_id { get; set; } + + + /// + /// 参与者ID(关联用户表,暂时占位) + /// + [Display(Name = "参与者ID(关联用户表,暂时占位)")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 user_id { get; set; } + + + /// + /// 角色:0=参与者,1=发起者 + /// + [Display(Name = "角色:0=参与者,1=发起者")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 role { get; set; } + + + /// + /// 加入时间 + /// + [Display(Name = "加入时间")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.DateTime join_time { get; set; } + + + /// + /// 退出时间 + /// + [Display(Name = "退出时间")] + + + + + + public System.DateTime? quit_time { get; set; } + + + /// + /// 状态,0正常,1已退出 + /// + [Display(Name = "状态,0正常,1已退出")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 status { get; set; } + + + } +} diff --git a/CoreCms.Net.Model/Entities/SQ/SQReservations.cs b/CoreCms.Net.Model/Entities/SQ/SQReservations.cs index 14facf7..ae9f726 100644 --- a/CoreCms.Net.Model/Entities/SQ/SQReservations.cs +++ b/CoreCms.Net.Model/Entities/SQ/SQReservations.cs @@ -9,6 +9,7 @@ ***********************************************************************/ using SqlSugar; + using System.ComponentModel; using System.ComponentModel.DataAnnotations; @@ -25,248 +26,252 @@ namespace CoreCms.Net.Model.Entities public SQReservations() { } - + /// /// 预约ID /// [Display(Name = "预约ID")] - + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 id { get; set; } - - + + + + public System.Int32 id { get; set; } + + /// /// 组局名称 /// [Display(Name = "组局名称")] - + [Required(ErrorMessage = "请输入{0}")] - [StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")] - - - public System.String title { get; set; } - - + [StringLength(maximumLength: 100, ErrorMessage = "{0}不能超过{1}字")] + + + public System.String title { get; set; } + + /// /// 房间ID /// [Display(Name = "房间ID")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 room_id { get; set; } - - + + + + public System.Int32 room_id { get; set; } + + /// /// 房间名称(冗余存储,比如 304号-大包,30元/小时) /// [Display(Name = "房间名称(冗余存储,比如 304号-大包,30元/小时)")] - + [Required(ErrorMessage = "请输入{0}")] - [StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")] - - - public System.String room_name { get; set; } - - + [StringLength(maximumLength: 100, ErrorMessage = "{0}不能超过{1}字")] + + + public System.String room_name { get; set; } + + /// /// 开始时间 /// [Display(Name = "开始时间")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.DateTime start_time { get; set; } - - + + + + public System.DateTime start_time { get; set; } + + /// /// 结束时间 /// [Display(Name = "结束时间")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.DateTime end_time { get; set; } - - + + + + public System.DateTime end_time { get; set; } + + /// /// 时长(分钟) /// [Display(Name = "时长(分钟)")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 duration_minutes { get; set; } - - + + + + public System.Int32 duration_minutes { get; set; } + + /// /// 人数 /// [Display(Name = "人数")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 player_count { get; set; } - - + + + + public System.Int32 player_count { get; set; } + + /// /// 玩法类型(如:补克) /// [Display(Name = "玩法类型(如:补克)")] - + [Required(ErrorMessage = "请输入{0}")] - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - - public System.String game_type { get; set; } - - + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + + + public System.String game_type { get; set; } + /// /// 具体规则(如:斗地主) /// [Display(Name = "具体规则(如:斗地主)")] - + [Required(ErrorMessage = "请输入{0}")] - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - - public System.String game_rule { get; set; } - - + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String game_rule { get; set; } + + /// /// 其他补充 /// [Display(Name = "其他补充")] - - - [StringLength(maximumLength:255,ErrorMessage = "{0}不能超过{1}字")] - - - public System.String extra_info { get; set; } - - + + + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] + + + public System.String extra_info { get; set; } + + /// /// 是否禁烟:0=不限制,1=禁烟,2=不禁烟 /// [Display(Name = "是否禁烟:0=不限制,1=禁烟,2=不禁烟")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 is_smoking { get; set; } - - + + + + public System.Int32 is_smoking { get; set; } + + /// /// 性别限制:0=不限,1=男,2=女 /// [Display(Name = "性别限制:0=不限,1=男,2=女")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 gender_limit { get; set; } - - + + + + public System.Int32 gender_limit { get; set; } + + /// /// 最低信誉分 /// [Display(Name = "最低信誉分")] - - - - - - public System.Decimal? credit_limit { get; set; } - - + + + + + + public System.Decimal? credit_limit { get; set; } + + /// /// 最小年龄限制 /// [Display(Name = "最小年龄限制")] - - - - - - public System.Int32? min_age { get; set; } - - + + + + + + public System.Int32? min_age { get; set; } + + /// /// 最大年龄限制,0=不限 /// [Display(Name = "最大年龄限制,0=不限")] - - - - - - public System.Int32? max_age { get; set; } - - + + + + + + public System.Int32? max_age { get; set; } + + /// /// 鸽子费(保证金) /// [Display(Name = "鸽子费(保证金)")] - - - - - - public System.Decimal? deposit_fee { get; set; } - - + + + + + + public System.Decimal? deposit_fee { get; set; } + + /// /// 状态:0=待开始,1=进行中,2=已结束,3=取消 /// [Display(Name = "状态:0=待开始,1=进行中,2=已结束,3=取消")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 status { get; set; } - - + + + + public System.Int32 status { get; set; } + + /// /// 创建时间 /// [Display(Name = "创建时间")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.DateTime created_at { get; set; } - - + + + + public System.DateTime created_at { get; set; } + + /// /// 更新时间 /// [Display(Name = "更新时间")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.DateTime updated_at { get; set; } - - + + + + public System.DateTime updated_at { get; set; } + + + /// + /// 备注 + /// + [Display(Name = "备注")] + + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] + public System.String remarks { get; set; } } } diff --git a/CoreCms.Net.Model/Entities/SQ/SQRooms.cs b/CoreCms.Net.Model/Entities/SQ/SQRooms.cs index 5eaf5e4..b439687 100644 --- a/CoreCms.Net.Model/Entities/SQ/SQRooms.cs +++ b/CoreCms.Net.Model/Entities/SQ/SQRooms.cs @@ -41,7 +41,7 @@ namespace CoreCms.Net.Model.Entities /// /// 房间号(如:304号-大包) /// - [Display(Name = "房间号(如:304号-大包)")] + [Display(Name = "房间名称")] [Required(ErrorMessage = "请输入{0}")] [StringLength(maximumLength: 100, ErrorMessage = "{0}不能超过{1}字")] diff --git a/CoreCms.Net.Model/ViewModels/SQ/SQReservationParticipantsDto.cs b/CoreCms.Net.Model/ViewModels/SQ/SQReservationParticipantsDto.cs new file mode 100644 index 0000000..00e996a --- /dev/null +++ b/CoreCms.Net.Model/ViewModels/SQ/SQReservationParticipantsDto.cs @@ -0,0 +1,30 @@ +using AutoMapper; + +using CoreCms.Net.Model.Entities; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Model.ViewModels.SQ +{ + [AutoMap(typeof(SQReservationParticipants))] + public class SQReservationParticipantsDto : SQReservationParticipants + { + /// + /// 组局名称 + /// + public string ReservationName { get; set; } + /// + /// 用户昵称 + /// + public string UserName { get; set; } + + /// + /// 用户头像 + /// + public string AvatarImage { get; set; } + } +} diff --git a/CoreCms.Net.Model/ViewModels/SQ/SQReservationsDto.cs b/CoreCms.Net.Model/ViewModels/SQ/SQReservationsDto.cs new file mode 100644 index 0000000..e587f04 --- /dev/null +++ b/CoreCms.Net.Model/ViewModels/SQ/SQReservationsDto.cs @@ -0,0 +1,18 @@ +using AutoMapper; + +using CoreCms.Net.Model.Entities; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Model.ViewModels.SQ +{ + [AutoMap(typeof(SQReservations))] + public class SQReservationsDto : SQReservations + { + public List Participants { get; set; } + } +} diff --git a/CoreCms.Net.Repository/SQ/SQReservationParticipantsRepository.cs b/CoreCms.Net.Repository/SQ/SQReservationParticipantsRepository.cs new file mode 100644 index 0000000..9170e7d --- /dev/null +++ b/CoreCms.Net.Repository/SQ/SQReservationParticipantsRepository.cs @@ -0,0 +1,242 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Caching.Manual; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Repository +{ + /// + /// 预约记录表 接口实现 + /// + public class SQReservationParticipantsRepository : BaseRepository, ISQReservationParticipantsRepository + { + private readonly IUnitOfWork _unitOfWork; + public SQReservationParticipantsRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public new async Task InsertAsync(SQReservationParticipants entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0; + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure; + if (bl) + { + await UpdateCaChe(); + } + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public new async Task UpdateAsync(SQReservationParticipants entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync(); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + //事物处理过程开始 + oldModel.id = entity.id; + oldModel.reservation_id = entity.reservation_id; + oldModel.user_id = entity.user_id; + oldModel.role = entity.role; + oldModel.join_time = entity.join_time; + oldModel.quit_time = entity.quit_time; + oldModel.status = entity.status; + + //事物处理过程结束 + var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + if (bl) + { + await UpdateCaChe(); + } + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public new async Task UpdateAsync(List entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + if (bl) + { + await UpdateCaChe(); + } + + return jm; + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public new async Task DeleteByIdAsync(object id) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + if (bl) + { + await UpdateCaChe(); + } + + return jm; + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public new async Task DeleteByIdsAsync(int[] ids) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable().In(ids).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + if (bl) + { + await UpdateCaChe(); + } + + return jm; + } + + #endregion + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + public async Task> GetCaChe() + { + var cache = ManualDataCache.Instance.Get>(GlobalConstVars.CacheSQReservationParticipants); + if (cache != null) + { + return cache; + } + return await UpdateCaChe(); + } + + /// + /// 更新cache + /// + public async Task> UpdateCaChe() + { + var list = await DbClient.Queryable().With(SqlWith.NoLock).ToListAsync(); + ManualDataCache.Instance.Set(GlobalConstVars.CacheSQReservationParticipants, list); + return list; + } + + #endregion + + + #region 重写根据条件查询分页数据 + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public new async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + RefAsync totalCount = 0; + List page; + if (blUseNoLock) + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new SQReservationParticipants + { + id = p.id, + reservation_id = p.reservation_id, + user_id = p.user_id, + role = p.role, + join_time = p.join_time, + quit_time = p.quit_time, + status = p.status, + + }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); + } + else + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new SQReservationParticipants + { + id = p.id, + reservation_id = p.reservation_id, + user_id = p.user_id, + role = p.role, + join_time = p.join_time, + quit_time = p.quit_time, + status = p.status, + + }).ToPageListAsync(pageIndex, pageSize, totalCount); + } + var list = new PageList(page, pageIndex, pageSize, totalCount); + return list; + } + + #endregion + + } +} diff --git a/CoreCms.Net.Services/SQ/SQReservationParticipantsServices.cs b/CoreCms.Net.Services/SQ/SQReservationParticipantsServices.cs new file mode 100644 index 0000000..37ad4e7 --- /dev/null +++ b/CoreCms.Net.Services/SQ/SQReservationParticipantsServices.cs @@ -0,0 +1,137 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.IServices; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + + +namespace CoreCms.Net.Services +{ + /// + /// 预约记录表 接口实现 + /// + public class SQReservationParticipantsServices : BaseServices, ISQReservationParticipantsServices + { + private readonly ISQReservationParticipantsRepository _dal; + private readonly IUnitOfWork _unitOfWork; + + public SQReservationParticipantsServices(IUnitOfWork unitOfWork, ISQReservationParticipantsRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public new async Task InsertAsync(SQReservationParticipants entity) + { + return await _dal.InsertAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public new async Task UpdateAsync(SQReservationParticipants entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public new async Task UpdateAsync(List entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public new async Task DeleteByIdAsync(object id) + { + return await _dal.DeleteByIdAsync(id); + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public new async Task DeleteByIdsAsync(int[] ids) + { + return await _dal.DeleteByIdsAsync(ids); + } + + #endregion + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + public async Task> GetCaChe() + { + return await _dal.GetCaChe(); + } + + /// + /// 更新cache + /// + public async Task> UpdateCaChe() + { + return await _dal.UpdateCaChe(); + } + + #endregion + + #region 重写根据条件查询分页数据 + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public new async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock); + } + #endregion + + } +} diff --git a/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationParticipantsController.cs b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationParticipantsController.cs new file mode 100644 index 0000000..dc6ee3e --- /dev/null +++ b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationParticipantsController.cs @@ -0,0 +1,689 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/9/3 0:53:58 + * Description: 暂无 + ***********************************************************************/ + + +using System; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.Entities.Expression; +using CoreCms.Net.Model.FromBody; +using CoreCms.Net.Model.ViewModels.UI; +using CoreCms.Net.Filter; +using CoreCms.Net.Loging; +using CoreCms.Net.IServices; +using CoreCms.Net.Utility.Helper; +using CoreCms.Net.Utility.Extensions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using NPOI.HSSF.UserModel; +using SqlSugar; +using CoreCms.Net.Web.Admin.Infrastructure; +using AutoMapper; +using System.Collections.Generic; +using CoreCms.Net.Model.ViewModels.SQ; +using Essensoft.Paylink.Alipay.Domain; + +namespace CoreCms.Net.Web.Admin.Controllers +{ + /// + /// 预约记录表 + /// + [Description("预约记录表")] + [Route("api/[controller]/[action]")] + [ApiController] + [RequiredErrorForAdmin] + [Authorize] + public class SQReservationParticipantsController : ControllerBase + { + private readonly IWebHostEnvironment _webHostEnvironment; + private readonly ISQReservationParticipantsServices _SQReservationParticipantsServices; + private readonly IMapper _mapper; + private readonly ICoreCmsUserServices _userServices; + private readonly ISQReservationsServices _SQReservationsServices; + /// + /// 构造函数 + /// + public SQReservationParticipantsController(IWebHostEnvironment webHostEnvironment + , ISQReservationParticipantsServices SQReservationParticipantsServices + , IMapper mapper + , ICoreCmsUserServices userServices + , ISQReservationsServices SQReservationsServices + ) + { + _webHostEnvironment = webHostEnvironment; + _SQReservationParticipantsServices = SQReservationParticipantsServices; + _mapper = mapper; + _userServices = userServices; + _SQReservationsServices = SQReservationsServices; + } + + #region 获取列表============================================================ + // POST: Api/SQReservationParticipants/GetPageList + /// + /// 获取列表 + /// + /// + [HttpPost] + [Description("获取列表")] + public async Task GetPageList() + { + var jm = new AdminUiCallBack(); + var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1); + var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30); + var where = PredicateBuilder.True(); + //获取排序字段 + var orderField = Request.Form["orderField"].FirstOrDefault(); + + Expression> orderEx = orderField switch + { + "id" => p => p.id, + "reservation_id" => p => p.reservation_id, + "user_id" => p => p.user_id, + "role" => p => p.role, + "join_time" => p => p.join_time, + "quit_time" => p => p.quit_time, + "status" => p => p.status, + _ => p => p.id + }; + + //设置排序方式 + var orderDirection = Request.Form["orderDirection"].FirstOrDefault(); + var orderBy = orderDirection switch + { + "asc" => OrderByType.Asc, + "desc" => OrderByType.Desc, + _ => OrderByType.Desc + }; + //查询筛选 + + //参与记录ID int + var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); + if (id > 0) + { + where = where.And(p => p.id == id); + } + //预约ID int + var reservation_id = Request.Form["reservation_id"].FirstOrDefault().ObjectToInt(0); + if (reservation_id > 0) + { + where = where.And(p => p.reservation_id == reservation_id); + } + //参与者ID(关联用户表,暂时占位) int + var user_id = Request.Form["user_id"].FirstOrDefault().ObjectToInt(0); + if (user_id > 0) + { + where = where.And(p => p.user_id == user_id); + } + List userids = null; + //参与者ID(关联用户表,暂时占位) int + var user_name = Request.Form["user_name"].FirstOrDefault(); + if (!string.IsNullOrEmpty(user_name)) + { + var _userIds = await _userServices.QueryListByClauseAsync(it => it.userName.Contains(user_name)); + if (_userIds == null || _userIds.Count == 0) + { + userids = new List(); + } + else + { + userids = _userIds.Select(it => it.id).ToList(); + } + + //where = where.And(p => p.user_id == user_id); + } + if (userids != null) + { + where = where.And(p => userids.Contains(p.user_id)); + } + //角色:0=参与者,1=发起者 int + var role = Request.Form["role"].FirstOrDefault().ObjectToInt(0); + if (role > 0) + { + where = where.And(p => p.role == role); + } + //user_name + //加入时间 datetime + var join_time = Request.Form["join_time"].FirstOrDefault(); + if (!string.IsNullOrEmpty(join_time)) + { + if (join_time.Contains("到")) + { + var dts = join_time.Split("到"); + var dtStart = dts[0].Trim().ObjectToDate(); + where = where.And(p => p.join_time > dtStart); + var dtEnd = dts[1].Trim().ObjectToDate(); + where = where.And(p => p.join_time < dtEnd); + } + else + { + var dt = join_time.ObjectToDate(); + where = where.And(p => p.join_time > dt); + } + } + //退出时间 datetime + var quit_time = Request.Form["quit_time"].FirstOrDefault(); + if (!string.IsNullOrEmpty(quit_time)) + { + if (quit_time.Contains("到")) + { + var dts = quit_time.Split("到"); + var dtStart = dts[0].Trim().ObjectToDate(); + where = where.And(p => p.quit_time > dtStart); + var dtEnd = dts[1].Trim().ObjectToDate(); + where = where.And(p => p.quit_time < dtEnd); + } + else + { + var dt = quit_time.ObjectToDate(); + where = where.And(p => p.quit_time > dt); + } + } + //状态,0正常,1已退出 int + var status = Request.Form["status"].FirstOrDefault().ObjectToInt(-1); + if (status > -1) + { + where = where.And(p => p.status == status); + } + //获取数据 + var list = await _SQReservationParticipantsServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true); + var pageList = _mapper.Map>(list); + if (pageList != null && pageList.Count > 0) + { + var reIds = pageList.Select(it => it.reservation_id).ToList(); + var userIds = pageList.Select(it => it.user_id).ToList(); + var re = await _SQReservationsServices.QueryListByClauseAsync(p => reIds.Contains(p.id)); + var users = await _userServices.QueryListByClauseAsync(p => userIds.Contains(p.id)); + foreach (var item in pageList) + { + var reservation = re.FirstOrDefault(it => it.id == item.reservation_id); + if (reservation != null) + { + item.ReservationName = reservation.title; + } + var user = users.FirstOrDefault(it => it.id == item.user_id); + if (user != null) + { + item.UserName = user.userName; + } + } + } + //返回数据 + jm.data = pageList; + jm.code = 0; + jm.count = list.TotalCount; + jm.msg = "数据调用成功!"; + return jm; + } + #endregion + + #region 首页数据============================================================ + // POST: Api/SQReservationParticipants/GetIndex + /// + /// 首页数据 + /// + /// + [HttpPost] + [Description("首页数据")] + public AdminUiCallBack GetIndex() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0 }; + return jm; + } + #endregion + + #region 创建数据============================================================ + // POST: Api/SQReservationParticipants/GetCreate + /// + /// 创建数据 + /// + /// + [HttpPost] + [Description("创建数据")] + public AdminUiCallBack GetCreate() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0 }; + return jm; + } + #endregion + + #region 创建提交============================================================ + // POST: Api/SQReservationParticipants/DoCreate + /// + /// 创建提交 + /// + /// + /// + [HttpPost] + [Description("创建提交")] + public async Task DoCreate([FromBody] SQReservationParticipants entity) + { + var jm = await _SQReservationParticipantsServices.InsertAsync(entity); + return jm; + } + #endregion + + #region 编辑数据============================================================ + // POST: Api/SQReservationParticipants/GetEdit + /// + /// 编辑数据 + /// + /// + /// + [HttpPost] + [Description("编辑数据")] + public async Task GetEdit([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQReservationParticipantsServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 编辑提交============================================================ + // POST: Api/SQReservationParticipants/Edit + /// + /// 编辑提交 + /// + /// + /// + [HttpPost] + [Description("编辑提交")] + public async Task DoEdit([FromBody] SQReservationParticipants entity) + { + var jm = await _SQReservationParticipantsServices.UpdateAsync(entity); + return jm; + } + #endregion + + #region 删除数据============================================================ + // POST: Api/SQReservationParticipants/DoDelete/10 + /// + /// 单选删除 + /// + /// + /// + [HttpPost] + [Description("单选删除")] + public async Task DoDelete([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQReservationParticipantsServices.ExistsAsync(p => p.id == entity.id, true); + if (!model) + { + jm.msg = GlobalConstVars.DataisNo; + return jm; + } + jm = await _SQReservationParticipantsServices.DeleteByIdAsync(entity.id); + + return jm; + } + #endregion + + #region 批量删除============================================================ + // POST: Api/SQReservationParticipants/DoBatchDelete/10,11,20 + /// + /// 批量删除 + /// + /// + /// + [HttpPost] + [Description("批量删除")] + public async Task DoBatchDelete([FromBody] FMArrayIntIds entity) + { + var jm = await _SQReservationParticipantsServices.DeleteByIdsAsync(entity.id); + return jm; + } + + #endregion + + #region 预览数据============================================================ + // POST: Api/SQReservationParticipants/GetDetails/10 + /// + /// 预览数据 + /// + /// + /// + [HttpPost] + [Description("预览数据")] + public async Task GetDetails([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQReservationParticipantsServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 选择导出============================================================ + // POST: Api/SQReservationParticipants/SelectExportExcel/10 + /// + /// 选择导出 + /// + /// + /// + [HttpPost] + [Description("选择导出")] + public async Task SelectExportExcel([FromBody] FMArrayIntIds entity) + { + var jm = new AdminUiCallBack(); + + //创建Excel文件的对象 + var book = new HSSFWorkbook(); + //添加一个sheet + var mySheet = book.CreateSheet("Sheet1"); + //获取list数据 + var listModel = await _SQReservationParticipantsServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc, true); + //给sheet1添加第一行的头部标题 + var headerRow = mySheet.CreateRow(0); + var headerStyle = ExcelHelper.GetHeaderStyle(book); + + var cell0 = headerRow.CreateCell(0); + cell0.SetCellValue("参与记录ID"); + cell0.CellStyle = headerStyle; + mySheet.SetColumnWidth(0, 10 * 256); + + var cell1 = headerRow.CreateCell(1); + cell1.SetCellValue("预约ID"); + cell1.CellStyle = headerStyle; + mySheet.SetColumnWidth(1, 10 * 256); + + var cell2 = headerRow.CreateCell(2); + cell2.SetCellValue("参与者ID(关联用户表,暂时占位)"); + cell2.CellStyle = headerStyle; + mySheet.SetColumnWidth(2, 10 * 256); + + var cell3 = headerRow.CreateCell(3); + cell3.SetCellValue("角色:0=参与者,1=发起者"); + cell3.CellStyle = headerStyle; + mySheet.SetColumnWidth(3, 10 * 256); + + var cell4 = headerRow.CreateCell(4); + cell4.SetCellValue("加入时间"); + cell4.CellStyle = headerStyle; + mySheet.SetColumnWidth(4, 10 * 256); + + var cell5 = headerRow.CreateCell(5); + cell5.SetCellValue("退出时间"); + cell5.CellStyle = headerStyle; + mySheet.SetColumnWidth(5, 10 * 256); + + var cell6 = headerRow.CreateCell(6); + cell6.SetCellValue("状态,0正常,1已退出"); + cell6.CellStyle = headerStyle; + mySheet.SetColumnWidth(6, 10 * 256); + + headerRow.Height = 30 * 20; + var commonCellStyle = ExcelHelper.GetCommonStyle(book); + + //将数据逐步写入sheet1各个行 + for (var i = 0; i < listModel.Count; i++) + { + var rowTemp = mySheet.CreateRow(i + 1); + + var rowTemp0 = rowTemp.CreateCell(0); + rowTemp0.SetCellValue(listModel[i].id.ToString()); + rowTemp0.CellStyle = commonCellStyle; + + var rowTemp1 = rowTemp.CreateCell(1); + rowTemp1.SetCellValue(listModel[i].reservation_id.ToString()); + rowTemp1.CellStyle = commonCellStyle; + + var rowTemp2 = rowTemp.CreateCell(2); + rowTemp2.SetCellValue(listModel[i].user_id.ToString()); + rowTemp2.CellStyle = commonCellStyle; + + var rowTemp3 = rowTemp.CreateCell(3); + rowTemp3.SetCellValue(listModel[i].role.ToString()); + rowTemp3.CellStyle = commonCellStyle; + + var rowTemp4 = rowTemp.CreateCell(4); + rowTemp4.SetCellValue(listModel[i].join_time.ToString()); + rowTemp4.CellStyle = commonCellStyle; + + var rowTemp5 = rowTemp.CreateCell(5); + rowTemp5.SetCellValue(listModel[i].quit_time.ToString()); + rowTemp5.CellStyle = commonCellStyle; + + var rowTemp6 = rowTemp.CreateCell(6); + rowTemp6.SetCellValue(listModel[i].status.ToString()); + rowTemp6.CellStyle = commonCellStyle; + + } + // 导出excel + string webRootPath = _webHostEnvironment.WebRootPath; + string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; + string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQReservationParticipants导出(选择结果).xls"; + string filePath = webRootPath + tpath; + DirectoryInfo di = new DirectoryInfo(filePath); + if (!di.Exists) + { + di.Create(); + } + FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create); + book.Write(fileHssf); + fileHssf.Close(); + + jm.code = 0; + jm.msg = GlobalConstVars.ExcelExportSuccess; + jm.data = tpath + fileName; + + return jm; + } + #endregion + + #region 查询导出============================================================ + // POST: Api/SQReservationParticipants/QueryExportExcel/10 + /// + /// 查询导出 + /// + /// + [HttpPost] + [Description("查询导出")] + public async Task QueryExportExcel() + { + var jm = new AdminUiCallBack(); + + var where = PredicateBuilder.True(); + //查询筛选 + + //参与记录ID int + var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); + if (id > 0) + { + where = where.And(p => p.id == id); + } + //预约ID int + var reservation_id = Request.Form["reservation_id"].FirstOrDefault().ObjectToInt(0); + if (reservation_id > 0) + { + where = where.And(p => p.reservation_id == reservation_id); + } + //参与者ID(关联用户表,暂时占位) int + var user_id = Request.Form["user_id"].FirstOrDefault().ObjectToInt(0); + if (user_id > 0) + { + where = where.And(p => p.user_id == user_id); + } + //角色:0=参与者,1=发起者 int + var role = Request.Form["role"].FirstOrDefault().ObjectToInt(0); + if (role > 0) + { + where = where.And(p => p.role == role); + } + //加入时间 datetime + var join_time = Request.Form["join_time"].FirstOrDefault(); + if (!string.IsNullOrEmpty(join_time)) + { + var dt = join_time.ObjectToDate(); + where = where.And(p => p.join_time > dt); + } + //退出时间 datetime + var quit_time = Request.Form["quit_time"].FirstOrDefault(); + if (!string.IsNullOrEmpty(quit_time)) + { + var dt = quit_time.ObjectToDate(); + where = where.And(p => p.quit_time > dt); + } + //状态,0正常,1已退出 int + var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0); + if (status > 0) + { + where = where.And(p => p.status == status); + } + //获取数据 + //创建Excel文件的对象 + var book = new HSSFWorkbook(); + //添加一个sheet + var mySheet = book.CreateSheet("Sheet1"); + //获取list数据 + var listModel = await _SQReservationParticipantsServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc, true); + //给sheet1添加第一行的头部标题 + var headerRow = mySheet.CreateRow(0); + var headerStyle = ExcelHelper.GetHeaderStyle(book); + + var cell0 = headerRow.CreateCell(0); + cell0.SetCellValue("参与记录ID"); + cell0.CellStyle = headerStyle; + mySheet.SetColumnWidth(0, 10 * 256); + + var cell1 = headerRow.CreateCell(1); + cell1.SetCellValue("预约ID"); + cell1.CellStyle = headerStyle; + mySheet.SetColumnWidth(1, 10 * 256); + + var cell2 = headerRow.CreateCell(2); + cell2.SetCellValue("参与者ID(关联用户表,暂时占位)"); + cell2.CellStyle = headerStyle; + mySheet.SetColumnWidth(2, 10 * 256); + + var cell3 = headerRow.CreateCell(3); + cell3.SetCellValue("角色:0=参与者,1=发起者"); + cell3.CellStyle = headerStyle; + mySheet.SetColumnWidth(3, 10 * 256); + + var cell4 = headerRow.CreateCell(4); + cell4.SetCellValue("加入时间"); + cell4.CellStyle = headerStyle; + mySheet.SetColumnWidth(4, 10 * 256); + + var cell5 = headerRow.CreateCell(5); + cell5.SetCellValue("退出时间"); + cell5.CellStyle = headerStyle; + mySheet.SetColumnWidth(5, 10 * 256); + + var cell6 = headerRow.CreateCell(6); + cell6.SetCellValue("状态,0正常,1已退出"); + cell6.CellStyle = headerStyle; + mySheet.SetColumnWidth(6, 10 * 256); + + + headerRow.Height = 30 * 20; + var commonCellStyle = ExcelHelper.GetCommonStyle(book); + + //将数据逐步写入sheet1各个行 + for (var i = 0; i < listModel.Count; i++) + { + var rowTemp = mySheet.CreateRow(i + 1); + + + var rowTemp0 = rowTemp.CreateCell(0); + rowTemp0.SetCellValue(listModel[i].id.ToString()); + rowTemp0.CellStyle = commonCellStyle; + + + + var rowTemp1 = rowTemp.CreateCell(1); + rowTemp1.SetCellValue(listModel[i].reservation_id.ToString()); + rowTemp1.CellStyle = commonCellStyle; + + + + var rowTemp2 = rowTemp.CreateCell(2); + rowTemp2.SetCellValue(listModel[i].user_id.ToString()); + rowTemp2.CellStyle = commonCellStyle; + + + + var rowTemp3 = rowTemp.CreateCell(3); + rowTemp3.SetCellValue(listModel[i].role.ToString()); + rowTemp3.CellStyle = commonCellStyle; + + + + var rowTemp4 = rowTemp.CreateCell(4); + rowTemp4.SetCellValue(listModel[i].join_time.ToString()); + rowTemp4.CellStyle = commonCellStyle; + + + + var rowTemp5 = rowTemp.CreateCell(5); + rowTemp5.SetCellValue(listModel[i].quit_time.ToString()); + rowTemp5.CellStyle = commonCellStyle; + + + + var rowTemp6 = rowTemp.CreateCell(6); + rowTemp6.SetCellValue(listModel[i].status.ToString()); + rowTemp6.CellStyle = commonCellStyle; + + + } + // 写入到excel + string webRootPath = _webHostEnvironment.WebRootPath; + string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; + string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQReservationParticipants导出(查询结果).xls"; + string filePath = webRootPath + tpath; + DirectoryInfo di = new DirectoryInfo(filePath); + if (!di.Exists) + { + di.Create(); + } + FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create); + book.Write(fileHssf); + fileHssf.Close(); + + jm.code = 0; + jm.msg = GlobalConstVars.ExcelExportSuccess; + jm.data = tpath + fileName; + + return jm; + } + #endregion + + + + } +} diff --git a/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs index acaaef1..f1d68ba 100644 --- a/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs @@ -33,6 +33,8 @@ using SqlSugar; using CoreCms.Net.Web.Admin.Infrastructure; using CoreCms.Net.Services; using System.Collections.Generic; +using AutoMapper; +using CoreCms.Net.Model.ViewModels.SQ; namespace CoreCms.Net.Web.Admin.Controllers { @@ -51,6 +53,9 @@ namespace CoreCms.Net.Web.Admin.Controllers private readonly ISQRoomsServices _SQRoomsServices; private readonly ISysDictionaryDataServices _sysDictionaryDataServices; private readonly ISysDictionaryServices _sysDictionaryServices; + private readonly ISQReservationParticipantsServices _SQReservationParticipantsServices; + private readonly IMapper _mapper; + private readonly ICoreCmsUserServices _userServices; /// /// 构造函数 /// @@ -59,6 +64,11 @@ namespace CoreCms.Net.Web.Admin.Controllers , ISQRoomsServices SQRoomsServices , ISysDictionaryServices sysDictionaryServices , ISysDictionaryDataServices sysDictionaryDataServices + , ISQReservationParticipantsServices sQReservationParticipantsServices + , IMapper mapper + , +ICoreCmsUserServices userServices + ) { _webHostEnvironment = webHostEnvironment; @@ -66,6 +76,9 @@ namespace CoreCms.Net.Web.Admin.Controllers _SQRoomsServices = SQRoomsServices; _sysDictionaryServices = sysDictionaryServices; _sysDictionaryDataServices = sysDictionaryDataServices; + _SQReservationParticipantsServices = sQReservationParticipantsServices; + _mapper = mapper; + _userServices = userServices; } #region 获取列表============================================================ @@ -290,8 +303,39 @@ namespace CoreCms.Net.Web.Admin.Controllers } //获取数据 var list = await _SQReservationsServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true); + var pageList = _mapper.Map>(list); + var rIds = list.Select(it => it.id).ToList(); + if (rIds != null && rIds.Count > 0) + { + var participants = await _SQReservationParticipantsServices.QueryListByClauseAsync(it => rIds.Contains(it.reservation_id), "", true); + List userList = new List(); + if (participants != null && participants.Count > 0) + { + var userIds = participants.Select(it => it.user_id).ToList(); + userList = await _userServices.QueryListByClauseAsync(it => userIds.Contains(it.id), "", true); + } + foreach (var item in pageList) + { + var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it=>it.role).ThenBy(it=>it.status).ToList(); + var dto = _mapper.Map>(temp); + if (userList != null && userList.Count > 0) + { + foreach (var p in dto) + { + var u = userList.FirstOrDefault(it => it.id == p.user_id); + if (u != null) + { + p.UserName = u.nickName; + p.AvatarImage = u.avatarImage; + } + } + + } + item.Participants = dto; + } + } //返回数据 - jm.data = list; + jm.data = pageList; jm.code = 0; jm.count = list.TotalCount; jm.msg = "数据调用成功!"; @@ -326,7 +370,7 @@ namespace CoreCms.Net.Web.Admin.Controllers }); } //返回数据 - var jm = new AdminUiCallBack { code = 0, msg="" }; + var jm = new AdminUiCallBack { code = 0, msg = "" }; jm.data = new { roomOptions = data, dicOptions = options }; return jm; @@ -360,6 +404,9 @@ namespace CoreCms.Net.Web.Admin.Controllers [Description("创建提交")] public async Task DoCreate([FromBody] SQReservations entity) { + entity.created_at = DateTime.Now; + entity.updated_at = DateTime.Now; + entity.remarks = "后台管理手动创建!"; var jm = await _SQReservationsServices.InsertAsync(entity); return jm; } @@ -402,6 +449,14 @@ namespace CoreCms.Net.Web.Admin.Controllers [Description("编辑提交")] public async Task DoEdit([FromBody] SQReservations entity) { + var e = _SQReservationsServices.QueryById(entity.id); + if (e == null) + { + throw new ArgumentNullException("未找到数据"); + } + entity.created_at = e.created_at; + entity.remarks = e.remarks; + entity.updated_at = DateTime.Now; var jm = await _SQReservationsServices.UpdateAsync(entity); return jm; } @@ -514,7 +569,7 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(2, 10 * 256); var cell3 = headerRow.CreateCell(3); - cell3.SetCellValue("房间名称(冗余存储,比如 304号-大包,30元/小时)"); + cell3.SetCellValue("房间名称"); cell3.CellStyle = headerStyle; mySheet.SetColumnWidth(3, 10 * 256); @@ -539,12 +594,12 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(7, 10 * 256); var cell8 = headerRow.CreateCell(8); - cell8.SetCellValue("玩法类型(如:补克)"); + cell8.SetCellValue("玩法类型"); cell8.CellStyle = headerStyle; mySheet.SetColumnWidth(8, 10 * 256); var cell9 = headerRow.CreateCell(9); - cell9.SetCellValue("具体规则(如:斗地主)"); + cell9.SetCellValue("具体规则"); cell9.CellStyle = headerStyle; mySheet.SetColumnWidth(9, 10 * 256); @@ -554,12 +609,12 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(10, 10 * 256); var cell11 = headerRow.CreateCell(11); - cell11.SetCellValue("是否禁烟:0=不限制,1=禁烟,2=不禁烟"); + cell11.SetCellValue("是否禁烟"); cell11.CellStyle = headerStyle; mySheet.SetColumnWidth(11, 10 * 256); var cell12 = headerRow.CreateCell(12); - cell12.SetCellValue("性别限制:0=不限,1=男,2=女"); + cell12.SetCellValue("性别限制"); cell12.CellStyle = headerStyle; mySheet.SetColumnWidth(12, 10 * 256); @@ -574,17 +629,17 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(14, 10 * 256); var cell15 = headerRow.CreateCell(15); - cell15.SetCellValue("最大年龄限制,0=不限"); + cell15.SetCellValue("最大年龄限制"); cell15.CellStyle = headerStyle; mySheet.SetColumnWidth(15, 10 * 256); var cell16 = headerRow.CreateCell(16); - cell16.SetCellValue("鸽子费(保证金)"); + cell16.SetCellValue("鸽子费"); cell16.CellStyle = headerStyle; mySheet.SetColumnWidth(16, 10 * 256); var cell17 = headerRow.CreateCell(17); - cell17.SetCellValue("状态:0=待开始,1=进行中,2=已结束,3=取消"); + cell17.SetCellValue("状态"); cell17.CellStyle = headerStyle; mySheet.SetColumnWidth(17, 10 * 256); diff --git a/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomsController.cs b/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomsController.cs index 140741d..45c03cf 100644 --- a/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomsController.cs @@ -327,7 +327,7 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(0, 10 * 256); var cell1 = headerRow.CreateCell(1); - cell1.SetCellValue("房间号"); + cell1.SetCellValue("房间名称"); cell1.CellStyle = headerStyle; mySheet.SetColumnWidth(1, 10 * 256); @@ -463,7 +463,7 @@ namespace CoreCms.Net.Web.Admin.Controllers mySheet.SetColumnWidth(0, 10 * 256); var cell1 = headerRow.CreateCell(1); - cell1.SetCellValue("房间号"); + cell1.SetCellValue("房间名称"); cell1.CellStyle = headerStyle; mySheet.SetColumnWidth(1, 10 * 256); diff --git a/CoreCms.Net.Web.Admin/Doc.xml b/CoreCms.Net.Web.Admin/Doc.xml index 355b25f..336fced 100644 --- a/CoreCms.Net.Web.Admin/Doc.xml +++ b/CoreCms.Net.Web.Admin/Doc.xml @@ -3658,12 +3658,95 @@ + + + 预约记录表 + + + + + 构造函数 + + + + + 获取列表 + + + + + + 首页数据 + + + + + + 创建数据 + + + + + + 创建提交 + + + + + + + 编辑数据 + + + + + + + 编辑提交 + + + + + + + 单选删除 + + + + + + + 批量删除 + + + + + + + 预览数据 + + + + + + + 选择导出 + + + + + + + 查询导出 + + + 预约表 - + 构造函数 diff --git a/CoreCms.Net.Web.Admin/Program.cs b/CoreCms.Net.Web.Admin/Program.cs index b645b48..5dd522a 100644 --- a/CoreCms.Net.Web.Admin/Program.cs +++ b/CoreCms.Net.Web.Admin/Program.cs @@ -28,6 +28,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Yitter.IdGenerator; +using CoreCms.Net.Model.ViewModels.SQ; var builder = WebApplication.CreateBuilder(args); @@ -49,7 +50,7 @@ builder.Services.AddCorsSetup(); //session֧(sessioncacheд洢) builder.Services.AddSession(); // AutoMapper֧ -builder.Services.AddAutoMapper(typeof(AutoMapperConfiguration)); +builder.Services.AddAutoMapper(typeof(AutoMapperConfiguration).Assembly, typeof(SQReservationParticipantsDto).Assembly); //ʹ SignalR builder.Services.AddSignalR(); diff --git a/CoreCms.Net.Web.Admin/wwwroot/files/2025-09-03/20250903002308485-SQReservations导出(查询结果).xls b/CoreCms.Net.Web.Admin/wwwroot/files/2025-09-03/20250903002308485-SQReservations导出(查询结果).xls new file mode 100644 index 0000000000000000000000000000000000000000..dd5ed1c19a88d2b870326655938b000e34af1c7d GIT binary patch literal 5632 zcmeHKTWpj?6rTU@?sm7`UbZczl-sfedZ+(xyIfjpi^_vR+wK;HriF#3OCelSsst~v zU`dLVsDX+PMnYnYyePgvqG%-H!9)^81QTz7uO>!KMWev)_s#6Tm(mg*G)83F^Ur)| z&di)WbI#11&p!2BIreVpRWYtKi41YmbO}caUrT9=d?9pT@@|@@$u73hyjT8176^-N z_!|^nu}o}5Js@^*EAO}z3%h3h+%*5V%?ugni{&VRl~{d1Y!bavk4?83HE~yg&=c!Z zkBOyj<+jDwzqRN8#bNB;0I{~=r`th{`Am=#0TqA>K}Db`pkmNePzh)ns1!6EGy^mfGz&BvA=Qy zoB!61BJmAoc8b$fA4S(jx;xwbh@AAb6@Qkk6j~snd~ zYJE^6Qqda0#6d(aVl+a9Qin*G93^4ez-ELxwl8&{(mc*lW2qFDvWB;`Bv)?0d4Urm zp{X_6QZ_zR>YE&QMV??n{A$7+iSm(`d^&~Xk69hJ=W~N6lAnyvStpXeoB0~uE>SFd zRx3OFZgp7v%1QV&lklr1;kzc}^WCHICR^fi1EWmTo)hc z_d%BT9eRgeeRKE2;vqKA?r!bLS@F{@G+TPdM#-I_n&djoBcZPLRo!oOxXmv%?d$U5 zW;Ad!{?=J5%De2HZj<=IP@Tx@xfXTd&8LaTCtcT~W20zZ*d6I-(;>8L(LJM1(-A&; z*k$6de6MYLG)rj5cU;{3^fMzXo#wu-QZqWdJmfO7g|;))*?#uGw6J0yi5e@L+T`3% zhAy>5hnIz>2(51Y{1tn5UEW@58lqX`v~|3)Fzhz{Xp`$U1Cq3z^^N|8>8yqzSU4H#1DK)#Q-pe#hp@(} z$akyRgb$#@0QvDwGZq+dPkar`;$LDIb^ba(CN}t=K5-z>7+i#5^%+VnKYULrwh-HI z?;IN)CvG%01k+i;09Y7({@{_w4-x3-_ooX4{I~oZuG(PYS>_aPAg=gqtU(+dM*Sn| z$Dz+=EmE})NoFgxCH@eJKuGJu$>s6HFoOj;DO1C=C@1Bi)?>dORT zN~4eyh{=sYE+D2k3S|K?;ZZ0Xh^dc4ZXhN>3grNK6DT)LGA|9~1I>Wc6$zAT7ahKmvVt7vVodg;GbS_9#kgcKCNA+~nI^_4_^J<@;9?A0{r&FkzfcC~!+db#kaO?- zopbK}pPqZqy@#*9bkCi8zi3`oP@|;Dt+-R{%jCwgvA9Gmz?9vJ$KzCSjNu0Tk0KD3 z|T^GcW;8(TM+;om^q&gc7Q40pu0B$%vs*!%*oaE-w8QWh3T3F&Iadz zbHR85#0|~^=Yu`q`@jX@P2fWCW^fU>7<@l?3wSGd8`ulp4)%ddz&pUD;GN(ya5=aF zTnVlMZ=A(De-51v?4sQ!*IZZATM=XC{ya{^1?y#XE`A2?l~L|{>(J4WVY{Ik@A)Z7Oq3~2567ZFQ1~|(kum2 zCN_y*uzkxXYR?lAJ(o`5Q|9#M=A|#!;=ZU}=BYW`bT%T33Pv)tgZOOhGSDjkPEO@%41SVQh#LteRt+_|cpb&tW9 zY`5F(usZM*>hJPCTq%FWVii{`EzaH@v#UNYW>tNDEM4^y6V-cSws^m~XP(FH)yc97 zS=)6e8XXV5gcsMq-@AtDt(%aDiOWY8<+Q=~k8dKhQ*XR8`G`Es;g!jj-t6w*CNOLs zT$oKrIZQ|;^2LE0(S=zUT$_vxb7&XiM)c&YBW@3$ebpJq<@ZtBXcPwLPh3Cp^fS}@ zF?_1CtNqHE&0!3m?EJPZ`oi8$466_B>^?Q|(J%(HV8S#pn%?T@*)xMLUK}&}u}X3HufBwL3kNSmImBKbpLArxq+txFZvg&;y!)r7E2Exyw^xUUndeLeGf zoOFquNntmA=D#^64G}6QifHVW+Z1oIfp&dd&#V5(F9wQgNxp@Bf zZyp`&XpSg(rIJ^v_Bkbq!N#Og97H@_ata!&VU}U1mGzWr&xsGK4}tk-5x?PwzofZl zvp3{1XdLpa`mHGFGUyZhwXopRWuh+f92SHM}r$)#3*Q#3&a9gBNq_kp^+PiMX^SCKrD|n$_HYhOvD%zAX+9e zfLJ_hoh3z=2E?LT>#P{Fyw=DDRG36|AeP)(mkz|@TO$V$%W#dHKrF~L$^c?%u2Cis zi*${$fLN|;lnvxfqMQ_6ZVGY%ZBJUdQ*?PizN9W6i2ne5hkfIT@<^fape0W(a*L&f iO@g){?mQtN29Px9@PPH0Eknv9$Zh`TdKpIdH2n=hgW@Xy literal 0 HcmV?d00001 diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/create.html new file mode 100644 index 0000000..1f251b2 --- /dev/null +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/create.html @@ -0,0 +1,88 @@ + + diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/details.html new file mode 100644 index 0000000..d7506ea --- /dev/null +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/details.html @@ -0,0 +1,90 @@ + + \ No newline at end of file diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/edit.html new file mode 100644 index 0000000..d492122 --- /dev/null +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/edit.html @@ -0,0 +1,88 @@ + + diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/index.html new file mode 100644 index 0000000..bdee75e --- /dev/null +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservationparticipants/index.html @@ -0,0 +1,419 @@ +预约记录表 + +
+
+ +
+
+ + + +
+
+
+ + + + + + + + + diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/create.html index eded790..459ddb8 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/create.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/create.html @@ -30,7 +30,7 @@
- +
@@ -38,7 +38,7 @@
- +
@@ -57,7 +57,12 @@
- +
@@ -91,7 +96,7 @@
- +
@@ -99,7 +104,9 @@
- + + +
@@ -110,7 +117,9 @@
- + + +
@@ -118,7 +127,7 @@
- +
@@ -129,7 +138,7 @@
- +
@@ -137,7 +146,7 @@
- +
@@ -148,7 +157,9 @@
- + + +
@@ -156,26 +167,12 @@
- -
-
- - - -
-
-
- -
- -
-
-
-
-
- -
- +
@@ -228,7 +225,7 @@ if (Array.isArray(dicOptions) && dicOptions.length) { dicOptions.forEach(function (gameType) { if (gameType && (gameType.id !== undefined) && gameType.name) { - $gameTypeSelect.append(''); + $gameTypeSelect.append(''); } }); } @@ -241,7 +238,7 @@ if (selectedId) { var parent = null; for (var i = 0; i < (dicOptions || []).length; i++) { - if (String(dicOptions[i].id) === String(selectedId)) { + if (String(dicOptions[i].name) === String(selectedId)) { parent = dicOptions[i]; break; } @@ -249,7 +246,7 @@ if (parent && Array.isArray(parent.children) && parent.children.length) { parent.children.forEach(function (rule) { if (rule && (rule.id !== undefined) && rule.name) { - $gameRuleSelect.append(''); + $gameRuleSelect.append(''); } }); } @@ -261,25 +258,31 @@ laydate.render({ elem: '#createTime-SQReservations-start_time', type: 'datetime', + fullPanel: true, + min: new Date().getTime()-1000, // 开始时间不能小于当前时间 done: function(value, date) { calculateDuration(); + // 更新结束时间的最小值 + var startTime = new Date(value); + laydate.render({ + elem: '#createTime-SQReservations-end_time', + type: 'datetime', + min: startTime.getTime(), + done: function(endValue, endDate) { + calculateDuration(); + } + }); } }); laydate.render({ elem: '#createTime-SQReservations-end_time', type: 'datetime', + fullPanel: true, + min: new Date().getTime()-1000, // 结束时间不能小于当前时间 done: function(value, date) { calculateDuration(); } }); - laydate.render({ - elem: '#createTime-SQReservations-created_at', - type: 'datetime' - }); - laydate.render({ - elem: '#createTime-SQReservations-updated_at', - type: 'datetime' - }); // 计算时长函数 function calculateDuration() { @@ -306,8 +309,53 @@ verifygame_type: [/^.{0,50}$/,'玩法类型最大只允许输入50位字符'], verifygame_rule: [/^.{0,50}$/,'具体规则最大只允许输入50位字符'], verifyextra_info: [/^.{0,255}$/,'其他补充最大只允许输入255位字符'], + minAge: function(value) { + if (value != 0 && value < 18) { + return '最小年龄不能小于18岁'; + } + }, + maxAge: function(value) { + if (value > 100) { + return '最大年龄不能超过100岁'; + } + }, + startTime: function(value) { + if (value) { + var startTime = new Date(value); + var now = new Date(); + // if (startTime < now) { + // return '开始时间不能小于当前时间'; + // } + } + }, + endTime: function(value) { + if (value) { + var endTime = new Date(value); + var startTime = new Date($('#createTime-SQReservations-start_time').val()); + if (endTime <= startTime) { + return '结束时间必须大于开始时间'; + } + } + } }); + // 监听鸽子费选择 + form.on('radio', function(data) { + if (data.elem.name === 'deposit_fee') { + var depositValue = data.value; + var $depositRadios = $('input[name="deposit_fee"]'); + + if (depositValue === '0') { + // 如果选择0元,禁用其他选项 + $depositRadios.not('[value="0"]').prop('disabled', true); + } else { + // 如果选择其他金额,启用所有选项 + $depositRadios.prop('disabled', false); + } + form.render('radio'); + } + }); + //重载form form.render(null, 'LAY-app-SQReservations-createForm'); }) diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/details.html index e17fa47..298cd19 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/details.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/details.html @@ -1,193 +1,196 @@ -