234321
This commit is contained in:
parent
066f3dbadc
commit
3857ecad81
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[Description("")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize]
|
||||
public class SQRoomPricingController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly ISQRoomPricingServices _SQRoomPricingServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public SQRoomPricingController(IWebHostEnvironment webHostEnvironment
|
||||
, ISQRoomPricingServices SQRoomPricingServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_SQRoomPricingServices = SQRoomPricingServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/SQRoomPricing/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> 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<SQRoomPricing>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<SQRoomPricing, object>> 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
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建数据============================================================
|
||||
// POST: Api/SQRoomPricing/GetCreate
|
||||
/// <summary>
|
||||
/// 创建数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public AdminUiCallBack GetCreate()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0, data = new SQRoomPricing() };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建提交============================================================
|
||||
// POST: Api/SQRoomPricing/DoCreate
|
||||
/// <summary>
|
||||
/// 创建提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 编辑数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑数据")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 编辑提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑提交")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 单选删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("批量删除")]
|
||||
public async Task<AdminUiCallBack> DoBatchDelete([FromBody] FMArrayIntIds entity)
|
||||
{
|
||||
await _SQRoomPricingServices.DeleteByIdsAsync(entity.id);
|
||||
return new AdminUiCallBack() { code = 0, msg = "删除成功" };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/SQRoomPricing/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 选择导出
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("选择导出")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
/// <summary>
|
||||
/// 查询导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("查询导出")]
|
||||
public async Task<AdminUiCallBack> QueryExportExcel()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var where = PredicateBuilder.True<SQRoomPricing>();
|
||||
//查询筛选
|
||||
|
||||
// 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
|
||||
/// <summary>
|
||||
/// 设置
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置")]
|
||||
public async Task<AdminUiCallBack> 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
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -4008,6 +4008,96 @@
|
|||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ISQRoomPricingServices)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.GetPageList">
|
||||
<summary>
|
||||
获取列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.GetIndex">
|
||||
<summary>
|
||||
首页数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.GetCreate">
|
||||
<summary>
|
||||
创建数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.DoCreate(CoreCms.Net.Model.Entities.SQRoomPricing)">
|
||||
<summary>
|
||||
创建提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.GetEdit(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
编辑数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.DoEdit(CoreCms.Net.Model.Entities.SQRoomPricing)">
|
||||
<summary>
|
||||
编辑提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.DoDelete(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
单选删除
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.DoBatchDelete(CoreCms.Net.Model.FromBody.FMArrayIntIds)">
|
||||
<summary>
|
||||
批量删除
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.GetDetails(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
预览数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.SelectExportExcel(CoreCms.Net.Model.FromBody.FMArrayIntIds)">
|
||||
<summary>
|
||||
选择导出
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.QueryExportExcel">
|
||||
<summary>
|
||||
查询导出
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController.DoSetis_active(CoreCms.Net.Model.FromBody.FMUpdateBoolDataByIntId)">
|
||||
<summary>
|
||||
设置
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.SQRoomsController">
|
||||
<summary>
|
||||
房间表
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-SQRoomPricing-createForm" id="LAY-app-SQRoomPricing-createForm">
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="room_id" class="layui-form-label layui-form-required">房间号</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="room_id" id="room_id" lay-verify="required" lay-reqText="请选择房间号">
|
||||
<option value="">请选择房间号</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="time_slot_type" class="layui-form-label layui-form-required">时间段</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="time_slot_type" id="time_slot_type" lay-verify="required" lay-reqText="请选择时间段">
|
||||
<option value="">请选择时间段</option>
|
||||
<option value="0">凌晨</option>
|
||||
<option value="1">上午</option>
|
||||
<option value="2">下午</option>
|
||||
<option value="3">晚上</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="price_desc_standard" class="layui-form-label layui-form-required">普通价格描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price_desc_standard" lay-verType="tips" lay-verify="required|verifyprice_desc_standard" class="layui-input" placeholder="请输入普通价格描述" lay-reqText="请输入普通价格描述" value="{{d.params.data.price_desc_standard || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="price_desc_member" class="layui-form-label layui-form-required">会员价格描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price_desc_member" lay-verType="tips" lay-verify="required|verifyprice_desc_member" class="layui-input" placeholder="请输入会员价格描述" lay-reqText="请输入会员价格描述" value="{{d.params.data.price_desc_member || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="effective_date_start" class="layui-form-label">开始时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="effective_date_start" id="effective_date_start" class="layui-input" placeholder="请输入开始时间" value="{{d.params.data.effective_date_start || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="effective_date_end" class="layui-form-label">结束时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="effective_date_end" id="effective_date_end" class="layui-input" placeholder="请输入结束时间" value="{{d.params.data.effective_date_end || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item" pane>
|
||||
<label for="is_active" class="layui-form-label layui-form-required">是否启用</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" lay-filter="switch" name="is_active" {{ d.params.data.is_active ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-SQRoomPricing-createForm-submit" id="LAY-app-SQRoomPricing-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
// 加载房间选项
|
||||
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
||||
if (e.code === 0 && e.data && e.data.roomOptions) {
|
||||
var roomSelect = $('#room_id');
|
||||
roomSelect.empty();
|
||||
roomSelect.append('<option value="">请选择房间号</option>');
|
||||
layui.each(e.data.roomOptions, function(index, item) {
|
||||
var selected = (item.id == d.params.data.room_id) ? 'selected' : '';
|
||||
roomSelect.append('<option value="' + item.id + '" ' + selected + '>' + item.name + '</option>');
|
||||
});
|
||||
form.render('select');
|
||||
}
|
||||
});
|
||||
|
||||
// 设置时间段下拉框的选中值
|
||||
var timeSlotType = d.params.data.time_slot_type;
|
||||
if (timeSlotType !== undefined && timeSlotType !== null && timeSlotType !== '') {
|
||||
$('#time_slot_type').val(String(timeSlotType));
|
||||
}
|
||||
|
||||
// 日期时间选择器
|
||||
laydate.render({
|
||||
elem: '#effective_date_start',
|
||||
type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#effective_date_end',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
form.verify({
|
||||
verifyprice_desc_standard: [/^.{0,100}$/, '普通价格描述最大只允许输入100位字符'],
|
||||
verifyprice_desc_member: [/^.{0,100}$/, '会员价格描述最大只允许输入100位字符'],
|
||||
});
|
||||
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-SQRoomPricing-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-SQRoomPricing-detailsForm" id="LAY-app-SQRoomPricing-detailsForm">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="room_id">房间号</label>
|
||||
</td>
|
||||
<td id="room_name_display">
|
||||
{{ d.params.data.room_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="time_slot_type">时间段</label>
|
||||
</td>
|
||||
<td>
|
||||
{{# if(d.params.data.time_slot_type === 0 || d.params.data.time_slot_type === '0') { }}
|
||||
凌晨
|
||||
{{# } else if(d.params.data.time_slot_type === 1 || d.params.data.time_slot_type === '1') { }}
|
||||
上午
|
||||
{{# } else if(d.params.data.time_slot_type === 2 || d.params.data.time_slot_type === '2') { }}
|
||||
下午
|
||||
{{# } else if(d.params.data.time_slot_type === 3 || d.params.data.time_slot_type === '3') { }}
|
||||
晚上
|
||||
{{# } else { }}
|
||||
{{ d.params.data.time_slot_type || '' }}
|
||||
{{# } }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="price_desc_standard">普通价格描述</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.price_desc_standard || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="price_desc_member">会员价格描述</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.price_desc_member || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="effective_date_start">开始时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.effective_date_start || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="effective_date_end">结束时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.effective_date_end || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="is_active">是否启用</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled name="is_active" value="{{d.params.data.is_active}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="is_active" {{ d.params.data.is_active ? 'checked' : '' }}>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
|
||||
// 加载房间名称
|
||||
var roomId = d.params.data.room_id;
|
||||
if (roomId) {
|
||||
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
||||
if (e.code === 0 && e.data && e.data.roomOptions) {
|
||||
var room = e.data.roomOptions.find(function(item) { return item.id == roomId; });
|
||||
if (room) {
|
||||
$('#room_name_display').text(room.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.render(null, 'LAY-app-SQRoomPricing-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-SQRoomPricing-editForm" id="LAY-app-SQRoomPricing-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="room_id" class="layui-form-label layui-form-required">房间号</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="room_id" id="room_id" lay-verify="required" lay-reqText="请选择房间号">
|
||||
<option value="">请选择房间号</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="time_slot_type" class="layui-form-label layui-form-required">时间段</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="time_slot_type" id="time_slot_type" lay-verify="required" lay-reqText="请选择时间段">
|
||||
<option value="">请选择时间段</option>
|
||||
<option value="0">凌晨</option>
|
||||
<option value="1">上午</option>
|
||||
<option value="2">下午</option>
|
||||
<option value="3">晚上</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="price_desc_standard" class="layui-form-label layui-form-required">普通价格描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price_desc_standard" lay-verType="tips" lay-verify="required|verifyprice_desc_standard" class="layui-input" placeholder="请输入普通价格描述" lay-reqText="请输入普通价格描述" value="{{d.params.data.price_desc_standard || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="price_desc_member" class="layui-form-label layui-form-required">会员价格描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price_desc_member" lay-verType="tips" lay-verify="required|verifyprice_desc_member" class="layui-input" placeholder="请输入会员价格描述" lay-reqText="请输入会员价格描述" value="{{d.params.data.price_desc_member || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="effective_date_start" class="layui-form-label">开始时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="effective_date_start" id="effective_date_start" class="layui-input" placeholder="请输入开始时间" value="{{d.params.data.effective_date_start || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label for="effective_date_end" class="layui-form-label">结束时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="effective_date_end" id="effective_date_end" class="layui-input" placeholder="请输入结束时间" value="{{d.params.data.effective_date_end || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item" pane>
|
||||
<label for="is_active" class="layui-form-label layui-form-required">是否启用</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" lay-filter="switch" name="is_active" {{ d.params.data.is_active ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-SQRoomPricing-editForm-submit" id="LAY-app-SQRoomPricing-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
// 加载房间选项
|
||||
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
||||
if (e.code === 0 && e.data && e.data.roomOptions) {
|
||||
var roomSelect = $('#room_id');
|
||||
roomSelect.empty();
|
||||
roomSelect.append('<option value="">请选择房间号</option>');
|
||||
layui.each(e.data.roomOptions, function(index, item) {
|
||||
var selected = (item.id == d.params.data.room_id) ? 'selected' : '';
|
||||
roomSelect.append('<option value="' + item.id + '" ' + selected + '>' + item.name + '</option>');
|
||||
});
|
||||
form.render('select');
|
||||
}
|
||||
});
|
||||
|
||||
// 设置时间段下拉框的选中值
|
||||
var timeSlotType = d.params.data.time_slot_type;
|
||||
if (timeSlotType !== undefined && timeSlotType !== null && timeSlotType !== '') {
|
||||
$('#time_slot_type').val(String(timeSlotType));
|
||||
}
|
||||
|
||||
// 日期时间选择器
|
||||
laydate.render({
|
||||
elem: '#effective_date_start',
|
||||
type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#effective_date_end',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
form.verify({
|
||||
verifyprice_desc_standard: [/^.{0,100}$/, '普通价格描述最大只允许输入100位字符'],
|
||||
verifyprice_desc_member: [/^.{0,100}$/, '会员价格描述最大只允许输入100位字符'],
|
||||
});
|
||||
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-SQRoomPricing-editForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,398 @@
|
|||
<title></title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/SQRoomPricing/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-SQRoomPricing-tableBox" lay-filter="LAY-app-SQRoomPricing-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQRoomPricing-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="room_id">房间号</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="room_id" id="search_room_id">
|
||||
<option value="">请选择房间号</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-SQRoomPricing-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQRoomPricing-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQRoomPricing-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#SQRoomPricingTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="SQRoomPricingTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug= layui.setter.debug;
|
||||
var roomOptions = []; // 定义在外部作用域,供表格templet使用
|
||||
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
|
||||
// 加载房间选项
|
||||
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
||||
if (e.code === 0 && e.data && e.data.roomOptions) {
|
||||
roomOptions = e.data.roomOptions;
|
||||
var roomSelect = $('#search_room_id');
|
||||
roomSelect.empty();
|
||||
roomSelect.append('<option value="">请选择房间号</option>');
|
||||
layui.each(roomOptions, function(index, item) {
|
||||
roomSelect.append('<option value="' + item.id + '">' + item.name + '</option>');
|
||||
});
|
||||
form.render('select');
|
||||
}
|
||||
});
|
||||
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-SQRoomPricing-search)',
|
||||
function(data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-SQRoomPricing-tableBox',{ where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-SQRoomPricing-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/SQRoomPricing/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-SQRoomPricing-toolbar',
|
||||
pagebar: '#LAY-app-SQRoomPricing-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: {none: '暂无相关数据'},
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: 'id', width: 60, sort: false},
|
||||
{ field: 'room_id', title: '房间号', sort: false, width: 150, templet: function(d) {
|
||||
var room = roomOptions.find(function(item) { return item.id == d.room_id; });
|
||||
return room ? room.name : (d.room_id || '');
|
||||
}},
|
||||
{ field: 'time_slot_type', title: '时间段', sort: false, width: 105, templet: function(d) {
|
||||
if (d.time_slot_type === 0 || d.time_slot_type === '0') return '凌晨';
|
||||
if (d.time_slot_type === 1 || d.time_slot_type === '1') return '上午';
|
||||
if (d.time_slot_type === 2 || d.time_slot_type === '2') return '下午';
|
||||
if (d.time_slot_type === 3 || d.time_slot_type === '3') return '晚上';
|
||||
return d.time_slot_type || '';
|
||||
}},
|
||||
|
||||
{ field: 'price_desc_standard', title: '普通价格描述', sort: false,width: 105 },
|
||||
{ field: 'price_desc_member', title: '会员价格描述', sort: false,width: 105 },
|
||||
{ field: 'effective_date_start', title: '开始时间', sort: false,width: 105 },
|
||||
{ field: 'effective_date_end', title: '结束时间', sort: false,width: 105 },
|
||||
{ field: 'is_active', title: '是否启用', width: 95, templet: '#switch_is_active', sort: false , unresize: true},
|
||||
{ field: 'created_at', title: '创建时间', width: 130, sort: false},
|
||||
{ field: 'updated_at', title: '修改时间', width: 130, sort: false},
|
||||
{ width: 162, align: 'center', title:'操作', fixed: 'right', toolbar: '#LAY-app-SQRoomPricing-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-SQRoomPricing-tableBox)', function(obj){
|
||||
table.reloadData('LAY-app-SQRoomPricing-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-SQRoomPricing-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-SQRoomPricing-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
case 'batchDelete':
|
||||
doBatchDelete(checkStatus);
|
||||
break;
|
||||
case 'selectExportExcel':
|
||||
doSelectExportExcel(checkStatus);
|
||||
break;
|
||||
case 'queryExportExcel':
|
||||
doQueryExportexcel();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-SQRoomPricing-tableBox)',
|
||||
function(obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate(){
|
||||
coreHelper.Post("Api/SQRoomPricing/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQRoomPricing-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('sq/sqroompricing/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-SQRoomPricing-createForm-submit)',
|
||||
function(data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.is_active = field.is_active == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/SQRoomPricing/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-SQRoomPricing-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-SQRoomPricing-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj){
|
||||
coreHelper.Post("Api/SQRoomPricing/GetEdit", {id:obj.data.id}, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQRoomPricing-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('sq/sqroompricing/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-SQRoomPricing-editForm-submit)',
|
||||
function(data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.is_active = field.is_active == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/SQRoomPricing/DoEdit", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-SQRoomPricing-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-SQRoomPricing-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/SQRoomPricing/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQRoomPricing-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('sq/sqroompricing/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj){
|
||||
coreHelper.Post("Api/SQRoomPricing/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SQRoomPricing-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行批量删除
|
||||
function doBatchDelete(checkStatus){
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择要删除的数据');
|
||||
}
|
||||
layer.confirm('确定删除吗?删除后将无法恢复。',
|
||||
function(index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function(index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
coreHelper.Post("Api/SQRoomPricing/DoBatchDelete", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SQRoomPricing-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行查询条件导出excel
|
||||
function doQueryExportexcel(){
|
||||
layer.confirm('确定根据当前的查询条件导出数据吗?',
|
||||
function(index) {
|
||||
var field = searchwhere;
|
||||
coreHelper.PostForm("Api/SQRoomPricing/QueryExportExcel", field, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行选择目录导出数据
|
||||
function doSelectExportExcel(checkStatus){
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要导出的数据');
|
||||
}
|
||||
layer.confirm('确定导出选择的内容吗?',
|
||||
function(index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function(index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
layer.close(index);
|
||||
coreHelper.Post("Api/SQRoomPricing/SelectExportExcel", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//监听 表格复选框操作
|
||||
|
||||
layui.form.on('switch(switch_is_active)', function (obj) {
|
||||
coreHelper.Post("Api/SQRoomPricing/DoSetis_active", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
//table.reloadData('LAY-app-SQRoomPricing-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!--设置是否启用-->
|
||||
<script type="text/html" id="switch_is_active">
|
||||
<input type="checkbox" name="switch_is_active" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_is_active" {{ d.is_active ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user