From 3857ecad81e5c423da891f51e13064ff331251f5 Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 7 Dec 2025 01:56:51 +0800 Subject: [PATCH] 234321 --- .../Controllers/SQ/SQRoomPricingController.cs | 825 ++++++++++++++++++ server/CoreCms.Net.Web.Admin/Doc.xml | 90 ++ .../views/sq/sqroompricing/create.html | 142 +++ .../views/sq/sqroompricing/details.html | 114 +++ .../wwwroot/views/sq/sqroompricing/edit.html | 143 +++ .../wwwroot/views/sq/sqroompricing/index.html | 398 +++++++++ 6 files changed, 1712 insertions(+) create mode 100644 server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs create mode 100644 server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/create.html create mode 100644 server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/details.html create mode 100644 server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/edit.html create mode 100644 server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html diff --git a/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs b/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs new file mode 100644 index 0000000..d12c824 --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs @@ -0,0 +1,825 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/12/7 0:55:50 + * Description: 暂无 + ***********************************************************************/ + + +using CoreCms.Net.Configuration; +using CoreCms.Net.Filter; +using CoreCms.Net.IServices; +using CoreCms.Net.Loging; +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.Utility.Extensions; +using CoreCms.Net.Utility.Helper; +using CoreCms.Net.Web.Admin.Infrastructure; + +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; + +using NPOI.HSSF.UserModel; + +using SqlSugar; + +using System; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace CoreCms.Net.Web.Admin.Controllers +{ + /// + /// + /// + [Description("")] + [Route("api/[controller]/[action]")] + [ApiController] + [RequiredErrorForAdmin] + [Authorize] + public class SQRoomPricingController : ControllerBase + { + private readonly IWebHostEnvironment _webHostEnvironment; + private readonly ISQRoomPricingServices _SQRoomPricingServices; + + /// + /// 构造函数 + /// + public SQRoomPricingController(IWebHostEnvironment webHostEnvironment + , ISQRoomPricingServices SQRoomPricingServices + ) + { + _webHostEnvironment = webHostEnvironment; + _SQRoomPricingServices = SQRoomPricingServices; + } + + #region 获取列表============================================================ + // POST: Api/SQRoomPricing/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, + "room_id" => p => p.room_id, + "time_slot_type" => p => p.time_slot_type, + "standard_price" => p => p.standard_price, + "member_price" => p => p.member_price, + "price_desc_standard" => p => p.price_desc_standard, + "price_desc_member" => p => p.price_desc_member, + "effective_date_start" => p => p.effective_date_start, + "effective_date_end" => p => p.effective_date_end, + "is_active" => p => p.is_active, + "created_at" => p => p.created_at, + "updated_at" => p => p.updated_at, + _ => p => p.id + }; + + //设置排序方式 + var orderDirection = Request.Form["orderDirection"].FirstOrDefault(); + var orderBy = orderDirection switch + { + "asc" => OrderByType.Asc, + "desc" => OrderByType.Desc, + _ => OrderByType.Desc + }; + //查询筛选 + + // int + var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); + if (id > 0) + { + where = where.And(p => p.id == id); + } + // int + var room_id = Request.Form["room_id"].FirstOrDefault().ObjectToInt(0); + if (room_id > 0) + { + where = where.And(p => p.room_id == room_id); + } + // int + var time_slot_type = Request.Form["time_slot_type"].FirstOrDefault().ObjectToInt(0); + if (time_slot_type > 0) + { + where = where.And(p => p.time_slot_type == time_slot_type); + } + // decimal + var standard_price = Request.Form["standard_price"].FirstOrDefault().ObjectToDecimal(0); + if (standard_price > 0) + { + where = where.And(p => p.standard_price == standard_price); + } + // decimal + var member_price = Request.Form["member_price"].FirstOrDefault().ObjectToDecimal(0); + if (member_price > 0) + { + where = where.And(p => p.member_price == member_price); + } + // nvarchar + var price_desc_standard = Request.Form["price_desc_standard"].FirstOrDefault(); + if (!string.IsNullOrEmpty(price_desc_standard)) + { + where = where.And(p => p.price_desc_standard.Contains(price_desc_standard)); + } + // nvarchar + var price_desc_member = Request.Form["price_desc_member"].FirstOrDefault(); + if (!string.IsNullOrEmpty(price_desc_member)) + { + where = where.And(p => p.price_desc_member.Contains(price_desc_member)); + } + + // bit + var is_active = Request.Form["is_active"].FirstOrDefault(); + if (!string.IsNullOrEmpty(is_active) && is_active.ToLowerInvariant() == "true") + { + where = where.And(p => p.is_active == true); + } + else if (!string.IsNullOrEmpty(is_active) && is_active.ToLowerInvariant() == "false") + { + where = where.And(p => p.is_active == false); + } + // datetime + var created_at = Request.Form["created_at"].FirstOrDefault(); + if (!string.IsNullOrEmpty(created_at)) + { + if (created_at.Contains("到")) + { + var dts = created_at.Split("到"); + var dtStart = dts[0].Trim().ObjectToDate(); + where = where.And(p => p.created_at > dtStart); + var dtEnd = dts[1].Trim().ObjectToDate(); + where = where.And(p => p.created_at < dtEnd); + } + else + { + var dt = created_at.ObjectToDate(); + where = where.And(p => p.created_at > dt); + } + } + // datetime + var updated_at = Request.Form["updated_at"].FirstOrDefault(); + if (!string.IsNullOrEmpty(updated_at)) + { + if (updated_at.Contains("到")) + { + var dts = updated_at.Split("到"); + var dtStart = dts[0].Trim().ObjectToDate(); + where = where.And(p => p.updated_at > dtStart); + var dtEnd = dts[1].Trim().ObjectToDate(); + where = where.And(p => p.updated_at < dtEnd); + } + else + { + var dt = updated_at.ObjectToDate(); + where = where.And(p => p.updated_at > dt); + } + } + //获取数据 + var list = await _SQRoomPricingServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true); + //返回数据 + jm.data = list; + jm.code = 0; + jm.count = list.TotalCount; + jm.msg = "数据调用成功!"; + return jm; + } + #endregion + + #region 首页数据============================================================ + // POST: Api/SQRoomPricing/GetIndex + /// + /// 首页数据 + /// + /// + [HttpPost] + [Description("首页数据")] + public AdminUiCallBack GetIndex() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0 }; + return jm; + } + #endregion + + #region 创建数据============================================================ + // POST: Api/SQRoomPricing/GetCreate + /// + /// 创建数据 + /// + /// + [HttpPost] + [Description("创建数据")] + public AdminUiCallBack GetCreate() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0, data = new SQRoomPricing() }; + return jm; + } + #endregion + + #region 创建提交============================================================ + // POST: Api/SQRoomPricing/DoCreate + /// + /// 创建提交 + /// + /// + /// + [HttpPost] + [Description("创建提交")] + public async Task DoCreate([FromBody] SQRoomPricing entity) + { + entity.created_at = DateTime.Now; + entity.updated_at = DateTime.Now; + entity.member_price = 0; + entity.standard_price = 0; + var jm = await _SQRoomPricingServices.InsertAsync(entity); + return new AdminUiCallBack() { code = 0, msg = "删除成功" }; ; + } + #endregion + + #region 编辑数据============================================================ + // POST: Api/SQRoomPricing/GetEdit + /// + /// 编辑数据 + /// + /// + /// + [HttpPost] + [Description("编辑数据")] + public async Task GetEdit([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQRoomPricingServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 编辑提交============================================================ + // POST: Api/SQRoomPricing/Edit + /// + /// 编辑提交 + /// + /// + /// + [HttpPost] + [Description("编辑提交")] + public async Task DoEdit([FromBody] SQRoomPricing entity) + { + entity.updated_at = DateTime.Now; + entity.member_price = 0; + entity.standard_price = 0; + var jm = await _SQRoomPricingServices.UpdateAsync(entity); + return new AdminUiCallBack() { code = 0, msg = "删除成功" }; ; + } + #endregion + + #region 删除数据============================================================ + // POST: Api/SQRoomPricing/DoDelete/10 + /// + /// 单选删除 + /// + /// + /// + [HttpPost] + [Description("单选删除")] + public async Task DoDelete([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQRoomPricingServices.ExistsAsync(p => p.id == entity.id, true); + if (!model) + { + jm.msg = GlobalConstVars.DataisNo; + return jm; + } + await _SQRoomPricingServices.DeleteByIdAsync(entity.id); + + return jm; + } + #endregion + + #region 批量删除============================================================ + // POST: Api/SQRoomPricing/DoBatchDelete/10,11,20 + /// + /// 批量删除 + /// + /// + /// + [HttpPost] + [Description("批量删除")] + public async Task DoBatchDelete([FromBody] FMArrayIntIds entity) + { + await _SQRoomPricingServices.DeleteByIdsAsync(entity.id); + return new AdminUiCallBack() { code = 0, msg = "删除成功" }; + } + + #endregion + + #region 预览数据============================================================ + // POST: Api/SQRoomPricing/GetDetails/10 + /// + /// 预览数据 + /// + /// + /// + [HttpPost] + [Description("预览数据")] + public async Task GetDetails([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _SQRoomPricingServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 选择导出============================================================ + // POST: Api/SQRoomPricing/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 _SQRoomPricingServices.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(""); + cell0.CellStyle = headerStyle; + mySheet.SetColumnWidth(0, 10 * 256); + + var cell1 = headerRow.CreateCell(1); + cell1.SetCellValue(""); + cell1.CellStyle = headerStyle; + mySheet.SetColumnWidth(1, 10 * 256); + + var cell2 = headerRow.CreateCell(2); + cell2.SetCellValue(""); + cell2.CellStyle = headerStyle; + mySheet.SetColumnWidth(2, 10 * 256); + + var cell3 = headerRow.CreateCell(3); + cell3.SetCellValue(""); + 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(""); + cell6.CellStyle = headerStyle; + mySheet.SetColumnWidth(6, 10 * 256); + + var cell7 = headerRow.CreateCell(7); + cell7.SetCellValue(""); + cell7.CellStyle = headerStyle; + mySheet.SetColumnWidth(7, 10 * 256); + + var cell8 = headerRow.CreateCell(8); + cell8.SetCellValue(""); + cell8.CellStyle = headerStyle; + mySheet.SetColumnWidth(8, 10 * 256); + + var cell9 = headerRow.CreateCell(9); + cell9.SetCellValue(""); + cell9.CellStyle = headerStyle; + mySheet.SetColumnWidth(9, 10 * 256); + + var cell10 = headerRow.CreateCell(10); + cell10.SetCellValue(""); + cell10.CellStyle = headerStyle; + mySheet.SetColumnWidth(10, 10 * 256); + + var cell11 = headerRow.CreateCell(11); + cell11.SetCellValue(""); + cell11.CellStyle = headerStyle; + mySheet.SetColumnWidth(11, 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].room_id.ToString()); + rowTemp1.CellStyle = commonCellStyle; + + var rowTemp2 = rowTemp.CreateCell(2); + rowTemp2.SetCellValue(listModel[i].time_slot_type.ToString()); + rowTemp2.CellStyle = commonCellStyle; + + var rowTemp3 = rowTemp.CreateCell(3); + rowTemp3.SetCellValue(listModel[i].standard_price.ToString()); + rowTemp3.CellStyle = commonCellStyle; + + var rowTemp4 = rowTemp.CreateCell(4); + rowTemp4.SetCellValue(listModel[i].member_price.ToString()); + rowTemp4.CellStyle = commonCellStyle; + + var rowTemp5 = rowTemp.CreateCell(5); + rowTemp5.SetCellValue(listModel[i].price_desc_standard.ToString()); + rowTemp5.CellStyle = commonCellStyle; + + var rowTemp6 = rowTemp.CreateCell(6); + rowTemp6.SetCellValue(listModel[i].price_desc_member.ToString()); + rowTemp6.CellStyle = commonCellStyle; + + var rowTemp7 = rowTemp.CreateCell(7); + rowTemp7.SetCellValue(listModel[i].effective_date_start.ToString()); + rowTemp7.CellStyle = commonCellStyle; + + var rowTemp8 = rowTemp.CreateCell(8); + rowTemp8.SetCellValue(listModel[i].effective_date_end.ToString()); + rowTemp8.CellStyle = commonCellStyle; + + var rowTemp9 = rowTemp.CreateCell(9); + rowTemp9.SetCellValue(listModel[i].is_active.ToString()); + rowTemp9.CellStyle = commonCellStyle; + + var rowTemp10 = rowTemp.CreateCell(10); + rowTemp10.SetCellValue(listModel[i].created_at.ToString()); + rowTemp10.CellStyle = commonCellStyle; + + var rowTemp11 = rowTemp.CreateCell(11); + rowTemp11.SetCellValue(listModel[i].updated_at.ToString()); + rowTemp11.CellStyle = commonCellStyle; + + } + // 导出excel + string webRootPath = _webHostEnvironment.WebRootPath; + string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; + string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQRoomPricing导出(选择结果).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/SQRoomPricing/QueryExportExcel/10 + /// + /// 查询导出 + /// + /// + [HttpPost] + [Description("查询导出")] + public async Task QueryExportExcel() + { + var jm = new AdminUiCallBack(); + + var where = PredicateBuilder.True(); + //查询筛选 + + // int + var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); + if (id > 0) + { + where = where.And(p => p.id == id); + } + // int + var room_id = Request.Form["room_id"].FirstOrDefault().ObjectToInt(0); + if (room_id > 0) + { + where = where.And(p => p.room_id == room_id); + } + // int + var time_slot_type = Request.Form["time_slot_type"].FirstOrDefault().ObjectToInt(0); + if (time_slot_type > 0) + { + where = where.And(p => p.time_slot_type == time_slot_type); + } + // decimal + var standard_price = Request.Form["standard_price"].FirstOrDefault().ObjectToDecimal(0); + if (standard_price > 0) + { + where = where.And(p => p.standard_price == standard_price); + } + // decimal + var member_price = Request.Form["member_price"].FirstOrDefault().ObjectToDecimal(0); + if (member_price > 0) + { + where = where.And(p => p.member_price == member_price); + } + // nvarchar + var price_desc_standard = Request.Form["price_desc_standard"].FirstOrDefault(); + if (!string.IsNullOrEmpty(price_desc_standard)) + { + where = where.And(p => p.price_desc_standard.Contains(price_desc_standard)); + } + // nvarchar + var price_desc_member = Request.Form["price_desc_member"].FirstOrDefault(); + if (!string.IsNullOrEmpty(price_desc_member)) + { + where = where.And(p => p.price_desc_member.Contains(price_desc_member)); + } + + // bit + var is_active = Request.Form["is_active"].FirstOrDefault(); + if (!string.IsNullOrEmpty(is_active) && is_active.ToLowerInvariant() == "true") + { + where = where.And(p => p.is_active == true); + } + else if (!string.IsNullOrEmpty(is_active) && is_active.ToLowerInvariant() == "false") + { + where = where.And(p => p.is_active == false); + } + // datetime + var created_at = Request.Form["created_at"].FirstOrDefault(); + if (!string.IsNullOrEmpty(created_at)) + { + var dt = created_at.ObjectToDate(); + where = where.And(p => p.created_at > dt); + } + // datetime + var updated_at = Request.Form["updated_at"].FirstOrDefault(); + if (!string.IsNullOrEmpty(updated_at)) + { + var dt = updated_at.ObjectToDate(); + where = where.And(p => p.updated_at > dt); + } + //获取数据 + //创建Excel文件的对象 + var book = new HSSFWorkbook(); + //添加一个sheet + var mySheet = book.CreateSheet("Sheet1"); + //获取list数据 + var listModel = await _SQRoomPricingServices.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(""); + cell0.CellStyle = headerStyle; + mySheet.SetColumnWidth(0, 10 * 256); + + var cell1 = headerRow.CreateCell(1); + cell1.SetCellValue(""); + cell1.CellStyle = headerStyle; + mySheet.SetColumnWidth(1, 10 * 256); + + var cell2 = headerRow.CreateCell(2); + cell2.SetCellValue(""); + cell2.CellStyle = headerStyle; + mySheet.SetColumnWidth(2, 10 * 256); + + var cell3 = headerRow.CreateCell(3); + cell3.SetCellValue(""); + 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(""); + cell6.CellStyle = headerStyle; + mySheet.SetColumnWidth(6, 10 * 256); + + var cell7 = headerRow.CreateCell(7); + cell7.SetCellValue(""); + cell7.CellStyle = headerStyle; + mySheet.SetColumnWidth(7, 10 * 256); + + var cell8 = headerRow.CreateCell(8); + cell8.SetCellValue(""); + cell8.CellStyle = headerStyle; + mySheet.SetColumnWidth(8, 10 * 256); + + var cell9 = headerRow.CreateCell(9); + cell9.SetCellValue(""); + cell9.CellStyle = headerStyle; + mySheet.SetColumnWidth(9, 10 * 256); + + var cell10 = headerRow.CreateCell(10); + cell10.SetCellValue(""); + cell10.CellStyle = headerStyle; + mySheet.SetColumnWidth(10, 10 * 256); + + var cell11 = headerRow.CreateCell(11); + cell11.SetCellValue(""); + cell11.CellStyle = headerStyle; + mySheet.SetColumnWidth(11, 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].room_id.ToString()); + rowTemp1.CellStyle = commonCellStyle; + + + + var rowTemp2 = rowTemp.CreateCell(2); + rowTemp2.SetCellValue(listModel[i].time_slot_type.ToString()); + rowTemp2.CellStyle = commonCellStyle; + + + + var rowTemp3 = rowTemp.CreateCell(3); + rowTemp3.SetCellValue(listModel[i].standard_price.ToString()); + rowTemp3.CellStyle = commonCellStyle; + + + + var rowTemp4 = rowTemp.CreateCell(4); + rowTemp4.SetCellValue(listModel[i].member_price.ToString()); + rowTemp4.CellStyle = commonCellStyle; + + + + var rowTemp5 = rowTemp.CreateCell(5); + rowTemp5.SetCellValue(listModel[i].price_desc_standard.ToString()); + rowTemp5.CellStyle = commonCellStyle; + + + + var rowTemp6 = rowTemp.CreateCell(6); + rowTemp6.SetCellValue(listModel[i].price_desc_member.ToString()); + rowTemp6.CellStyle = commonCellStyle; + + + + var rowTemp7 = rowTemp.CreateCell(7); + rowTemp7.SetCellValue(listModel[i].effective_date_start.ToString()); + rowTemp7.CellStyle = commonCellStyle; + + + + var rowTemp8 = rowTemp.CreateCell(8); + rowTemp8.SetCellValue(listModel[i].effective_date_end.ToString()); + rowTemp8.CellStyle = commonCellStyle; + + + + var rowTemp9 = rowTemp.CreateCell(9); + rowTemp9.SetCellValue(listModel[i].is_active.ToString()); + rowTemp9.CellStyle = commonCellStyle; + + + + var rowTemp10 = rowTemp.CreateCell(10); + rowTemp10.SetCellValue(listModel[i].created_at.ToString()); + rowTemp10.CellStyle = commonCellStyle; + + + + var rowTemp11 = rowTemp.CreateCell(11); + rowTemp11.SetCellValue(listModel[i].updated_at.ToString()); + rowTemp11.CellStyle = commonCellStyle; + + + } + // 写入到excel + string webRootPath = _webHostEnvironment.WebRootPath; + string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; + string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQRoomPricing导出(查询结果).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/SQRoomPricing/DoSetis_active/10 + /// + /// 设置 + /// + /// + /// + [HttpPost] + [Description("设置")] + public async Task DoSetis_active([FromBody] FMUpdateBoolDataByIntId entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await _SQRoomPricingServices.QueryByIdAsync(entity.id, false); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + oldModel.is_active = (bool)entity.data; + + var bl = await _SQRoomPricingServices.UpdateAsync(p => new SQRoomPricing() { is_active = oldModel.is_active }, p => p.id == oldModel.id); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + #endregion + + + } +} diff --git a/server/CoreCms.Net.Web.Admin/Doc.xml b/server/CoreCms.Net.Web.Admin/Doc.xml index 276cb75..dcf3a70 100644 --- a/server/CoreCms.Net.Web.Admin/Doc.xml +++ b/server/CoreCms.Net.Web.Admin/Doc.xml @@ -4008,6 +4008,96 @@ + + + + + + + + 构造函数 + + + + + 获取列表 + + + + + + 首页数据 + + + + + + 创建数据 + + + + + + 创建提交 + + + + + + + 编辑数据 + + + + + + + 编辑提交 + + + + + + + 单选删除 + + + + + + + 批量删除 + + + + + + + 预览数据 + + + + + + + 选择导出 + + + + + + + 查询导出 + + + + + + 设置 + + + + 房间表 diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/create.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/create.html new file mode 100644 index 0000000..2d1a4ca --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/create.html @@ -0,0 +1,142 @@ + + diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/details.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/details.html new file mode 100644 index 0000000..a8fa5af --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/details.html @@ -0,0 +1,114 @@ + + \ No newline at end of file diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/edit.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/edit.html new file mode 100644 index 0000000..1098acd --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/edit.html @@ -0,0 +1,143 @@ + + \ No newline at end of file diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html new file mode 100644 index 0000000..0a1a59c --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html @@ -0,0 +1,398 @@ + + +
+
+ +
+
+ + + +
+
+
+ + + + + + + + + + + +