初始化项目

This commit is contained in:
2025-11-20 09:50:21 +08:00
commit 94b24e1a5d
4209 changed files with 1570805 additions and 0 deletions

View File

@@ -0,0 +1,163 @@

@{
ViewBag.Title = "酒店列表";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<div class="card" >
<div class="card-header">
<h3 class="card-title">@ViewBag.Title</h3>
</div>
<div class="card-body" id="cardbody" style="padding:0;font-size:16px">
</div>
</div>
<script>
let request = async function (url, params, method = "Post"){
return new Promise((resolve, reject) => {
$.ajax({
type: method,
url: url,
cache: false, //禁用缓存
data: params, //传入组装的参数
dataType: "json",
success: function (result) {
resolve(result);
},
error: function (res) {
reject(res)
}
});
})
}// 删除
let hotel = []
//查看酒店人员
function ShowInfo(hotel, that) {
let hotellist = [];
for (let i of hotelinfolist) {
if (i.length > 0 && i[0].hotelId == hotel) {
hotellist = i;
break;
}
}
let row = "<div class='row'>";
for (let i of hotellist) {
row += "<a class='col-4 text-gray' href='/Home/UAuthority/" + i.Uid + "' style='font-size: 14px' >" + i.Uid + "(" + i.sum + ") </a > ";
}
Swal.fire({
title: '<span>' + $(that).find('label').html() + '酒店拥有权限人共计' + hotellist.length + '人</span>',
showCloseButton: true,
html: row,
focusConfirm: true,
confirmButtonText:
`确认`
})
row += "</div > ";
$("#HotelInfo").html(row);
$("#HotelInfo").show();
}
//酒店人员数量
function hotelinfo(hotel) {
for (let i of hotelinfolist) {
if (i.length > 0 && i[0].hotelId == hotel)
{
return i.length;
}
}
return 0;
}
//酒店人员信息
let hotelinfolist = [];
function init() {
request('/Hotel/HotelInfo', {
hotel
}).then(
res => {
hotelinfolist = res;
setTimeout(function () {
Nodefa()
let text = $('#rightcard').clone();
let check = $(text).find('.form-check-input');
for (let i of check) {
let ad = $(i).attr('onchange').indexOf(`0,this)`) > 0;
if (!ad) {
let groupNum = ($(i).attr('onchange'))
groupNum = groupNum.replace(`ChecK(0,`, '').replace(`, this)`, '').replace(/'/, '').replace(/'/, '');
$(i).closest('.form-check').append(`( <i class="fa fa-university" aria-hidden="true"></i> : ` + Num(groupNum) + " )")
} else {
//获取酒店ID
let groupNum = $(i).attr('data-id')
$(i).closest('.form-check').attr('onclick', 'ShowInfo('+groupNum+', this)')
$(i).closest('.form-check').append(ad ? `<span>( <i class="fa fa-user"></i> : ` + hotelinfo(groupNum) + ` )</span>` : '');
}
$(i).closest(".card").find(".form-check-input");
$(i).remove();
}
$('#cardbody').append(text.html().replace(/AddColor(this)/, '').replace(/padding:10.5px 17.5px;/, 'padding:0 10px ;'));
$($('.btn-tool').get(0)).click();
}, 100
)
}
);
}
//初始化酒店信息
function Nodefa() {
for (let i = 0; i < BaseDataGroups.length; i++) {
BaseDataGroups[i].children = RESGROUP(BaseDataGroups[i].Id);
//添加自身
BaseDataGroups[i].children = BaseDataGroups[i].children.concat(BaseDataGroups[i]);
let hotellist = [];
BaseData.forEach(
x => {
if (x.length > 0) {
BaseDataGroups[i].children.forEach(z => {
if (z.Id == x[0].GroupId) {
hotellist = hotellist.concat(x);
}
})
}
})
BaseDataGroups[i].hotellist = hotellist;
}
};
//找出子酒店
function RESGROUP(X) {
let children = [];
for (let j = 0; j < BaseDataGroups.length; j++) {
if (BaseDataGroups[j].ParentId == X) {
children.push(BaseDataGroups[j]);
children = children.concat(RESGROUP(BaseDataGroups[j].Id))
}
}
return children;
}
//酒店数量
function Num(X) {
X = Number(X)
for (let j = 0; j < BaseDataGroups.length; j++) {
if (BaseDataGroups[j].Id == X) {
return BaseDataGroups[j].hotellist.length;
}
}
return 0;
}
init();
</script>
<style>
.card-header,.nav-link {
padding: 5px !important;
/*height:40px;*/
}
.card, .form-check {
padding:0;
margin-bottom: 0;
}
.form-check{
padding-left:10px;
}
.card-title > .form-check {
color: #17a2b8;
}
</style>

201
UI/Views/Hotel/Index.cshtml Normal file
View File

@@ -0,0 +1,201 @@

@{
ViewBag.Title = "酒店组管理";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<div class="card">
<div class="card-header navbar" style="padding:5px 5px;">
<ul class="navbar-nav ">
<li class="nav-item">
<h5 class="card-title" style="line-height:1;"><span class="text-red text-bold"> @ViewBag.HoteldGroupName</span> 信息一览<span id="qxsl"></span></h5>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item" style="color:#999c9e;">
<button data-toggle="modal" data-target="#modal-danger" id="modaldangerbtn" style="display:none;"></button>
@*<button type="button" onclick="Delzz()" class="btn btn-danger btn-xs @(ViewBag.SelHoteldGroup<=3?"disabled":"")">删除</button>*@
</li>
</ul>
</div>
<div class="card-body" id="cardbody">
<div class="card card-gray" style="margin-bottom: 0px;">
<div class="card-header" style="padding:1px 10px;">
<a style="line-height:1;"> 相关信息</a>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fas fa-minus"></i>
</button>
</div>
</div>
<div class="card-body" style=" padding:0.2rem 0rem">
<slot class="sloatdnyc" style="display:none;">
<div class="card" style="margin-bottom: 10px;">
<div class="card-header" style="padding:1px 10px;" data-card-widget="collapse">
<a href="{{Id}}" style="line-height: 1; display: block; color: black;" class=" text-bold">{{Name}}</a>
<span class="text-gray" style=" margin:0;line-height:1;">
描述:<span class="text-info " style=" line-height: 1;">{{Desc}}</span>
&nbsp;&nbsp;&nbsp;&nbsp;
酒店数量:<span class="text-red" style="line-height: 1;">{{HotelsSum}}</span>
</span>
</div>
<div class="card-body" style=" padding-top: 0px; padding-bottom: 0px;">
{{card-body}}
</div>
</div>
</slot>
</div>
</div>
</div>
<input value="@ViewBag.Data" type="hidden" id="Data">
<input value="@ViewBag.DataGroups" type="hidden" id="DataGroups">
</div>
</div>
<script>
let DataGroups;//( @ViewBag.DataGroups).replaceAll("&quot;",",");
let Data;
let ajxj = 0;
let qxsl = 0;
let request = (url, params = {}, method = "Post") => {
return new Promise((resolve, reject) => {
$.ajax({
type: method,
url: url,
cache: false, //禁用缓存
data: params, //传入组装的参数
dataType: "json",
success: function (result) {
resolve(result);
},
error: function (res) {
reject(res)
}
});
})
}
$(function () {
DataGroups = JSON.parse($("#DataGroups").val());
Data = JSON.parse($("#Data").val());
Init();
});
//分组 未使用
function Grouparr(arr) {
let res = [],AppId = [];
arr.forEach(x => {
if (AppId.filter(y => { return y == x.AppId }).length <= 0)
{
AppId.push(x.AppId);
}
});
AppId.forEach(y => {
res.push( arr.filter(x => { return x.AppId == y }));
});
return res;
}
function GoAddGroup() {
$("#GroupNameTitle").html("@ViewBag.HoteldGroupName")
$("#CheckGroupName").attr("data-typeinfo", "0");
$("#CheckGroupName").attr("data-ParentId", "@ViewBag.SelHoteldGroup");
$("#modal-GroupNamebtn").click();
}
function Delzz() {
if (@ViewBag.SelHoteldGroup <= 3)
error("默认酒店组无法删除~");
else
$("#modaldangerbtn").click();
}
//检查 CheckGroupName 子分组、酒店是否名字重复是否 符合 添加分组、酒店
function CheckGroupName(that,url) {
$("#ResAddHotel").attr("disabled", "disabled");
let type = $("#CheckGroupName").attr("data-typeinfo");
let ParentId = $("#CheckGroupName").attr("data-ParentId");
let desc = $("#GroupDesc").val();
request(url, { Name: $(that).val(), ParentId: ParentId, Type: type, Desc:desc }).
then(res => {
if (res.Status == 100) {
error("名字不可用")
}
else {
if (res == 200 && res.Data && res.Data != null) {
$("#Groupclosebtn").click();
if (type == 0) {
DataGroups.push({ Name: $(that).val(), ParentId: ParentId, Id: res.Data, Desc: desc });
} else {
//Data.push({ Name: $(that).val(), ParentId: ParentId, Type: type, Desc: desc });
}
success("添加成功")
} else {
if (res.Status == 200)
$("#ResAddHotel").removeAttr("disabled")
else
success("网络繁忙~")
}
}
}, err => {
success("网络繁忙~")
$("#ResAddHotel").removeAttr("disabled")
})
}
//模板
let sloatdnyc = "";
let card_body = `<div style="line-height:1;word-wrap:break-word;">
<table class="table" style="margin:0;border:none;">
<thead>
<tr style="border:none;">
<th style="padding:0px;border:none;">ID</th>
<th style="padding:0px;border:none;">名称</th>
<th style="padding:0px;border:none;">状态</th>
<th style="padding:0px;border:none;">描述</th>
<th style="padding:0px;border:none;">时间</th>
</tr>
</thead>
<tbody >
{{tr}}
</tbody>
</table>
</div>
`
let trtext = `<tr class="{{IsApprove}}"><td style="width:10%;padding:0px;border:none;"><span class="text-info">{{Id}}</span></td>
<td style="width:32%;padding:0px;border:none;"><span class="text-info">{{Name}}</span></td>
<td style="width:25%;padding:0px;border:none;"><span class="{{status}}">{{Status}}</span></td>
<td style="width:8%;padding:0px;border:none;"><span class="text-gray">{{Desc}}</span></td>
<td style="width:35%;padding:0px;border:none;"><span class="text-gray">{{CreateTime}}</span></td></tr>`
function Init() {
if (sloatdnyc == "")
sloatdnyc = $(".sloatdnyc").html();
//移除原有
$(".sloatdnyc").html("");
DataGroups.forEach(x => {
let Hotels = null;
Data.forEach(y => { if (y[0].GroupId == x.Id) { Hotels = y } })
qxsl += Hotels == null ? 0 : Hotels.length
let sloatdnycclone = sloatdnyc.replace("{{Id}}", x.Id)
.replace("{{Name}}", x.Name == '@ViewBag.HoteldGroupName' ? "直属酒店" : x.Name)
.replace("{{HotelsSum}}", Hotels == null ? 0 : Hotels.length)
.replace("{{Desc}}", x.Desc == null ? "无":x.Desc);
let card_bodyclone = card_body;
let trlist = "";
if (Hotels != null) {
Hotels.forEach(y => {
trlist += trtext.replace("{{Name}}", y.Name)
.replace("{{Id}}", y.Id)
.replace("{{Desc}}", y.Desc == null ? "无" : y.Desc)
.replace("{{CreateTime}}", y.CreateTime.substring(0, 10))
.replace("{{IsApprove}}", y.IsApprove == 0 ? 'bg-warning' : '')
.replace("{{status}}", y.IsApprove == 1 ? (y.Status == 0 ? 'text-success' : y.Status == 1 ? 'text-warning' : 'text-info') :'text-gray')
.replace("{{Status}}", y.Status == 0 ? '正式运营' : y.Status == 1 ? '批量安装' :'样板间');
})
}
card_bodyclone = card_bodyclone.replace("{{tr}}", trlist);
sloatdnycclone = sloatdnycclone.replace("{{card-body}}", card_bodyclone);
$(".sloatdnyc").append(sloatdnycclone).show()
})
$("#qxsl").html(qxsl)
}
</script>