初始化
This commit is contained in:
243
Face.Web/Areas/App/Views/PublicAreaSetting/AreaSetting.cshtml
Normal file
243
Face.Web/Areas/App/Views/PublicAreaSetting/AreaSetting.cshtml
Normal file
@@ -0,0 +1,243 @@
|
||||
|
||||
|
||||
@{
|
||||
ViewBag.Title = "AreaSetting";
|
||||
Layout = "~/Areas/App/Views/Shared/_Layout.cshtml";
|
||||
List<Face.Domain.Entities.Hotels> Hotellist = (List<Face.Domain.Entities.Hotels>)ViewData["Hotelsp"];
|
||||
}
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content" style="padding:0px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<!-- Default box -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span style="font-size:30px">公区设置</span>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse"></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-md-12">
|
||||
|
||||
|
||||
<select class="form-control" id="OrgId" style="width:300px; float:left">
|
||||
<option value="0">
|
||||
请选择酒店
|
||||
</option>
|
||||
@{
|
||||
List<int> sum = (List<int>)Session["list"];
|
||||
foreach (int item in sum)
|
||||
{
|
||||
foreach (var iten in Hotellist)
|
||||
{
|
||||
if (iten.Id == item)
|
||||
{
|
||||
<option class="ComboBox" value="@iten.Id" id="@iten.Code">
|
||||
@iten.Name
|
||||
</option>
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
@if (Session["username"]?.ToString()?.ToLower() == "momo")
|
||||
{
|
||||
<input type="text" class="form-control" id="OrgIdsjud" placeholder="请输入酒店" onblur="judiannamecx()">
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive mailbox-messages">
|
||||
<table class="table table-hover table-striped">
|
||||
<tbody id="OrgIdsShow">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content" style="padding:0px;">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4" id="faceDetailsBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script src="~/Plugin/allPages.js"></script>
|
||||
<script>
|
||||
function judiannamecx() {
|
||||
var jd = document.getElementById('OrgIdsjud').value
|
||||
document.getElementById('OrgId').innerHTML = "";
|
||||
|
||||
$.ajax({
|
||||
url: "/App/SetFace/updateAPKsbyjdname",
|
||||
type: "post",
|
||||
data: { "hotelId": jd },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
/* window.location.replace("updateAPKs")*/
|
||||
//$('#OrgIdsShow').append('<tr>' +
|
||||
// ' <td>' +
|
||||
// ' <div class="icheck-primary" >' +
|
||||
// '<input type="checkbox" onclick="checkAll()" /><i>全选</i>' +
|
||||
// ' </div>' +
|
||||
// ' </td>' +
|
||||
// ' <td class="mailbox-star" style="border-collapse:collapse">房间号码</td>' +
|
||||
// ' <td class="mailbox-name">厂牌</td>' +
|
||||
// ' <td class="mailbox-subject">人脸机Sn</td>' +
|
||||
// ' <td class="mailbox-attachment">下发进度</td>' +
|
||||
// ' <td class="mailbox-date">下载进度</td>' +
|
||||
// +'</tr>');
|
||||
|
||||
$('#OrgId').append('<option class="Roomshow" value="0" id="Room">请选择酒店</option>')
|
||||
res.forEach(x => {
|
||||
$('#OrgId').append('<option class="Roomshow" value="' + x.Id + '" id="' + x.RoomId + '">' +
|
||||
x.Name +
|
||||
'</option>'
|
||||
);
|
||||
});
|
||||
//$('#RoomIdshow').append('<option class="Roomshow" value="0" id="Room">请选择房间</option>')
|
||||
|
||||
//res.forEach(x => {
|
||||
// $('#RoomIdshow').append('<option class="Roomshow" value="' + x.RoomId + '" id="' + x.RoomId + '">' +
|
||||
// x.RoomId +
|
||||
// '</option>'
|
||||
// );
|
||||
//})
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#OrgId").change(function () {
|
||||
var myType = document.getElementById("OrgId");//获取select对象
|
||||
var index = myType.selectedIndex;//获取选项中的索引,selectIndex表示的是当前所选中的index
|
||||
var ApkName = myType.options[index].value;//获取固件名称
|
||||
console.log(ApkName)
|
||||
document.getElementById('OrgIdsShow').innerHTML = "";
|
||||
if (ApkName == 0) {
|
||||
alert("请选择酒店名称")
|
||||
return;
|
||||
}
|
||||
officialHotel(ApkName);
|
||||
})
|
||||
|
||||
function officialHotel(ApkName){
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/officialHotel",
|
||||
type: "post",
|
||||
data: { "hotelId": ApkName },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
$('#OrgIdsShow').append('<tr>' +
|
||||
//' <td>' +
|
||||
//' <div class="icheck-primary" >' +
|
||||
//'<input type="checkbox" onclick="checkAll()" /><i>全选</i>' +
|
||||
//' </div>' +
|
||||
//' </td>' +
|
||||
' <td class="mailbox-star" style="border-collapse:collapse">房间号码</td>' +
|
||||
' <td class="mailbox-name">厂牌</td>' +
|
||||
' <td class="mailbox-subject">人脸机Sn</td>' +
|
||||
' <td class="mailbox-attachment">操作</td>'
|
||||
+ '</tr>');
|
||||
res.forEach(x => {
|
||||
if (x.isPublicArea == 1) {
|
||||
$('#OrgIdsShow').append('<tr>' +
|
||||
/* ' <td><div class="icheck-primary" ><input type="checkbox" name="roles" value="' + x.RoomId + '" id="check1"></div></td >' +*/
|
||||
'<td class="mailbox-star" style="border-collapse:collapse">' + x.ROOM_NUMBER + '</td>' +
|
||||
'<td class="mailbox-name"></td>' +
|
||||
/* ' + (x.Factory == "undefined" ? "" : x.Factory) + '*/
|
||||
'<td class="mailbox-subject">' +
|
||||
'<b></b>' +
|
||||
/* (x.SerialNo == "undefined" ? "" : x.SerialNo)*/
|
||||
'</td>' +
|
||||
' <td class="mailbox-attachment">' +
|
||||
|
||||
'<button class="btn btn-danger" onclick="CanclPublicArea(' + x.ROOM_OLD_ID + ')">取消</button>' +
|
||||
|
||||
|
||||
'</td > ' +
|
||||
+ '</tr > ');
|
||||
}
|
||||
else {
|
||||
$('#OrgIdsShow').append('<tr>' +
|
||||
/* ' <td><div class="icheck-primary" ><input type="checkbox" name="roles" value="' + x.RoomId + '" id="check1"></div></td >' +*/
|
||||
'<td class="mailbox-star" style="border-collapse:collapse">' + x.ROOM_NUMBER + '</td>' +
|
||||
'<td class="mailbox-name"></td>' +
|
||||
/* ' + (x.Factory == "undefined" ? "" : x.Factory) + '*/
|
||||
'<td class="mailbox-subject">' +
|
||||
'<b></b>' +
|
||||
/* ' + (x.SerialNo == "undefined" ? "" : x.SerialNo) + '*/
|
||||
'</td>' +
|
||||
' <td class="mailbox-attachment">' +
|
||||
'<button class="btn btn-primary" onclick="getPublicArea(' + x.ROOM_OLD_ID + ')">设置</button>' +
|
||||
|
||||
|
||||
'</td > ' +
|
||||
+ '</tr > ');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function getPublicArea(RoomId) {
|
||||
console.log(RoomId)
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/getPublicArea",
|
||||
type: "post",
|
||||
data: { "RoomId": RoomId },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
document.getElementById('OrgIdsShow').innerHTML = "";
|
||||
var myType = document.getElementById("OrgId");//获取select对象
|
||||
var index = myType.selectedIndex;//获取选项中的索引,selectIndex表示的是当前所选中的index
|
||||
var ApkName = myType.options[index].value;//获取固件名称
|
||||
officialHotel(ApkName);
|
||||
alert("设置公区成功!!!!")
|
||||
} else {
|
||||
alert("设置公区失败!!!!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function CanclPublicArea(RoomId) {
|
||||
console.log(RoomId)
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/CanclPublicArea",
|
||||
type: "post",
|
||||
data: { "RoomId": RoomId },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
document.getElementById('OrgIdsShow').innerHTML = "";
|
||||
var myType = document.getElementById("OrgId");//获取select对象
|
||||
var index = myType.selectedIndex;//获取选项中的索引,selectIndex表示的是当前所选中的index
|
||||
var ApkName = myType.options[index].value;//获取固件名称
|
||||
officialHotel(ApkName);
|
||||
alert("取消公区成功!!!!")
|
||||
} else {
|
||||
alert("取消公区失败!!!!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,312 @@
|
||||
|
||||
|
||||
|
||||
@{
|
||||
ViewBag.Title = "AreaSetting";
|
||||
Layout = "~/Areas/App/Views/Shared/_Layout.cshtml";
|
||||
List<Face.Domain.Entities.Hotels> Hotellist = (List<Face.Domain.Entities.Hotels>)ViewData["Hotelsp"];
|
||||
}
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content" style="padding:0px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<!-- Default box -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span style="font-size:30px">关联公区</span>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse"></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-md-12">
|
||||
|
||||
|
||||
<select class="form-control" id="OrgId" style="width:300px; float:left">
|
||||
<option value="0">
|
||||
请选择酒店
|
||||
</option>
|
||||
@{
|
||||
List<int> sum = (List<int>)Session["list"];
|
||||
foreach (int item in sum)
|
||||
{
|
||||
foreach (var iten in Hotellist)
|
||||
{
|
||||
if (iten.Id == item)
|
||||
{
|
||||
<option class="ComboBox" value="@iten.Id" id="@iten.Code">
|
||||
@iten.Name
|
||||
</option>
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
@if (Session["username"]?.ToString()?.ToLower() == "momo")
|
||||
{
|
||||
<input type="text" class="form-control" id="OrgIdsjud" placeholder="请输入酒店" onblur="judiannamecx()">
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive mailbox-messages">
|
||||
<table class="table table-hover table-striped">
|
||||
<tbody id="OrgIdsShow">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content" style="padding:0px;">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4" id="faceDetailsBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="~/Plugin/allPages.js"></script>
|
||||
<script>
|
||||
function judiannamecx() {
|
||||
var jd = document.getElementById('OrgIdsjud').value
|
||||
document.getElementById('OrgId').innerHTML = "";
|
||||
|
||||
$.ajax({
|
||||
url: "/App/SetFace/updateAPKsbyjdname",
|
||||
type: "post",
|
||||
data: { "hotelId": jd },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
/* window.location.replace("updateAPKs")*/
|
||||
//$('#OrgIdsShow').append('<tr>' +
|
||||
// ' <td>' +
|
||||
// ' <div class="icheck-primary" >' +
|
||||
// '<input type="checkbox" onclick="checkAll()" /><i>全选</i>' +
|
||||
// ' </div>' +
|
||||
// ' </td>' +
|
||||
// ' <td class="mailbox-star" style="border-collapse:collapse">房间号码</td>' +
|
||||
// ' <td class="mailbox-name">厂牌</td>' +
|
||||
// ' <td class="mailbox-subject">人脸机Sn</td>' +
|
||||
// ' <td class="mailbox-attachment">下发进度</td>' +
|
||||
// ' <td class="mailbox-date">下载进度</td>' +
|
||||
// +'</tr>');
|
||||
$('#OrgId').append('<option class="Roomshow" value="0" id="Room">请选择酒店</option>')
|
||||
res.forEach(x => {
|
||||
$('#OrgId').append('<option class="Roomshow" value="' + x.Id + '" id="' + x.RoomId + '">' +
|
||||
x.Name +
|
||||
'</option>'
|
||||
);
|
||||
});
|
||||
//$('#RoomIdshow').append('<option class="Roomshow" value="0" id="Room">请选择房间</option>')
|
||||
|
||||
//res.forEach(x => {
|
||||
// $('#RoomIdshow').append('<option class="Roomshow" value="' + x.RoomId + '" id="' + x.RoomId + '">' +
|
||||
// x.RoomId +
|
||||
// '</option>'
|
||||
// );
|
||||
//})
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#OrgId").change(function () {
|
||||
var myType = document.getElementById("OrgId");//获取select对象
|
||||
var index = myType.selectedIndex;//获取选项中的索引,selectIndex表示的是当前所选中的index
|
||||
var ApkName = myType.options[index].value;//获取固件名称
|
||||
console.log(ApkName)
|
||||
document.getElementById('OrgIdsShow').innerHTML = "";
|
||||
if (ApkName == 0) {
|
||||
alert("请选择酒店名称")
|
||||
return;
|
||||
}
|
||||
officialHotel(ApkName);
|
||||
})
|
||||
|
||||
function officialHotel(ApkName){
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/getHotel",
|
||||
type: "post",
|
||||
data: { "hotelId": ApkName },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
debugger
|
||||
let quanbuhtml = "";
|
||||
res.isnoPublicArea.forEach(x => {
|
||||
quanbuhtml += '<tr>'
|
||||
quanbuhtml += '<td>'
|
||||
quanbuhtml += x.ROOM_NUMBER
|
||||
quanbuhtml += '</td>'
|
||||
res.isokPublicArea.forEach(j => {
|
||||
quanbuhtml += '<td>'
|
||||
quanbuhtml += '<input type = "checkbox" name = "roles' + x.ROOM_OLD_ID +'" value = "' + j.ROOM_OLD_ID + '" id = "check1" >'
|
||||
quanbuhtml += j.ROOM_NUMBER
|
||||
quanbuhtml += '</td>'
|
||||
})
|
||||
quanbuhtml += '<td>'
|
||||
if (x.AssociatedPublicArea == null || x.AssociatedPublicArea == "") {
|
||||
quanbuhtml += '<button class="btn btn-primary" onclick="getPublicArea(' + x.ROOM_OLD_ID + ')">设置</button>'
|
||||
}
|
||||
|
||||
if (x.AssociatedPublicArea != null && x.AssociatedPublicArea != "") {
|
||||
quanbuhtml += '<button class="btn btn-danger" onclick="quxPublicArea(' + x.ROOM_OLD_ID + ',`' + x.ROOM_NUMBER + '`)">取消</button>'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
quanbuhtml += '</td>'
|
||||
|
||||
|
||||
|
||||
|
||||
quanbuhtml += '</tr>'
|
||||
//$('#OrgIdsShow').append('<tr>' +
|
||||
// /* ' <td><div class="icheck-primary" ><input type="checkbox" name="roles" value="' + x.RoomId + '" id="check1"></div></td >' +*/
|
||||
// '<td class="mailbox-star" style="border-collapse:collapse">' + x.ROOM_NUMBER + '</td>' +
|
||||
// '<td class="mailbox-name">' + x.Factory + '</td>' +
|
||||
// '<td class="mailbox-subject">' +
|
||||
// '<b>' + x.SerialNo + '</b>' +
|
||||
// '</td>' +
|
||||
// ' <td class="mailbox-attachment">' +
|
||||
// '<button class="btn btn-primary" onclick="getPublicArea(' + ApkName + ')">设置</button>' +
|
||||
// '</td > ' +
|
||||
// + '</tr > ');
|
||||
|
||||
|
||||
//if (x.isPublicArea == 1) {
|
||||
// $('#OrgIdsShow').append('<tr>' +
|
||||
// /* ' <td><div class="icheck-primary" ><input type="checkbox" name="roles" value="' + x.RoomId + '" id="check1"></div></td >' +*/
|
||||
// '<td class="mailbox-star" style="border-collapse:collapse">' + x.ROOM_NUMBER + '</td>' +
|
||||
// '<td class="mailbox-name">' + x.Factory + '</td>' +
|
||||
// '<td class="mailbox-subject">' +
|
||||
// '<b>' + x.SerialNo + '</b>' +
|
||||
// '</td>' +
|
||||
// ' <td class="mailbox-attachment">' +
|
||||
|
||||
// '<button class="btn btn-danger" onclick="CanclPublicArea(' + ApkName + ')">修改</button>' +
|
||||
// '</td > ' +
|
||||
// + '</tr > ');
|
||||
//}
|
||||
//else {
|
||||
|
||||
//}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#OrgIdsShow').append(quanbuhtml);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//function CanclPublicArea(ApkName) {
|
||||
|
||||
//}
|
||||
var slist = '';
|
||||
function getPublicArea(ApkName) {
|
||||
|
||||
console.log(ApkName)
|
||||
var obj = document.getElementsByName('roles' + ApkName); //选择所有name="'test'"的对象,返回数组
|
||||
console.log(obj)
|
||||
console.log(obj.length)
|
||||
/* console.log(id)*/
|
||||
//取到对象数组后,我们来循环检测它是不是被选中
|
||||
var s = '';
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
if (obj[i].checked) {
|
||||
if (s.length > 0) {
|
||||
s += ",";
|
||||
|
||||
}
|
||||
if (slist.length > 0) {
|
||||
slist += ",";
|
||||
}
|
||||
s += obj[i].value; //如果选中,将value添加到变量s中
|
||||
/* slist += obj[i].value*/
|
||||
}
|
||||
}
|
||||
|
||||
var arrint = s.split(',')
|
||||
console.log(arrint)
|
||||
let newList = Array.from(new Set(arrint))
|
||||
console.log(newList)
|
||||
if (s =="") {
|
||||
alert("请选择关联房间")
|
||||
return;
|
||||
}
|
||||
//$("#staticBackdrop").css("display", "block");
|
||||
//$("#modal-body").html("查询中...");
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/setHotel",
|
||||
type: "post",
|
||||
data: { "RoomId": ApkName, "RoomidList": s },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
|
||||
alert("关联公区成功!!!!")
|
||||
} else {
|
||||
alert("关联公区失败!!!!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function quxPublicArea(ApkName, ROOM_NUMBER) {
|
||||
var qr = confirm("确定删除房间" + ROOM_NUMBER + "所有关联的公区吗?")
|
||||
debugger
|
||||
if (qr) {
|
||||
$.ajax({
|
||||
url: "/App/PublicAreaSetting/quxHotel",
|
||||
type: "post",
|
||||
data: { "RoomId": ApkName },
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
|
||||
alert("删除公区成功!!!!")
|
||||
} else {
|
||||
alert("删除公区失败!!!!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user