初始化项目

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,17 @@

@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>GetView</title>
</head>
<body>
<div>
</div>
</body>
</html>

555
UI/Views/App/Index.cshtml Normal file
View File

@@ -0,0 +1,555 @@

@{
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.App.AppName</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" id="btnDelzz" onclick="Delzz(this)" data-IsValid='@ViewBag.App.IsValid' class="btn btn-@(ViewBag.App.IsValid==0? "danger":"success") btn-sm">@(ViewBag.App.IsValid==0? "禁用":"恢复")</button>
</li>
</ul>
</div>
<div class="card-body" id="cardbody" style="padding:0">
<div class="card card-gray" style="margin-bottom: 0px;">
<div class="card-header" style="padding:1px 5px;">
<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="{{AppId}}" style="line-height: 1; display: block; color: black;" class=" text-bold">{{AppName}}</a>
<div class="text-gray" style=" margin:0;line-height:1;">
<div class="row">
<div class="col-5">
App类型:&nbsp;<span class="text-info " style=" line-height: 1;">{{AppType}}</span>
</div>
<div class="col-5">
版本:&nbsp;<span class="text-info " style=" line-height: 1;">{{Version}}</span>
</div>
</div>
<div class="row">
<div class="col-5">
权限数量:&nbsp;<span class="text-info" style="line-height: 1;">{{AuthorSum}}</span>
</div>
<div class="col-7">
发布日期:&nbsp;<span class="text-info" style="line-height: 1;">{{ReleaseDate}}</span>
</div>
</div>
<div class="row flex-column">
<div class="col-12">
描述:&nbsp;<span class="text-info " style=" line-height: 1;">{{Desc}}</span>
</div>
<div class="col-12">
网址:&nbsp;<a class="text-info " href="{{WebSite}}" style=" line-height: 1;">{{WebSite}}</a>
</div>
</div>
</div>
<button class="btn btn-success btn-sm" style=" margin:2px; " onclick="AddAuthority()">添加权限</button>
</div>
</div>
<div class="card-body " style=" padding:0 2px;">
{{card-body}}
</div>
</slot>
</div>
</div>
</div>
</div>
<script>
let oa, KP, aau,types;
let ajxj = 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 init () {
request("/Api/GetApps", { appid:@ViewBag.SelectApp }).then(result => {
aau = result.Data.Appinfos[0]
types = result.Data.Types
$("#qxsl").html("(" + aau.data.length + ")");
ajxj++;
Add();
})
let card_body =`<div id="{{tbsuccess}}" style="line-height:1;word-wrap:break-word;">
<table class="table dataTable" style="margin:0;">
<thead>
<tr style="border:none;">
<th style="padding:2px;border:none;">ID</th>
<th style="padding:2px;border:none;">名称</th>
<th style="padding:2px;border:none;">说明</th>
<th style="padding:2px;border:none;">创建时间</th>
<th style="padding:2px;border:none;">操作</th>
</tr>
</thead>
<tbody >
{{tr}}
</tbody>
</table>
</div>
`
let tdtext =`
<tr style="background:{{bg--gray}};">
<td style="padding:2px;" data-type ='{{AuthoStatusTypeId}}'>
{{AuthorityID}}
</td>
<td style="padding:2px;" >
{{AuthorityName}}</td>
<td style="padding:2px;" >
{{AuthDesc}}
</td>
<td style="padding:2px;" >
{{CreateTime}}
</td>
<td style="padding:2px;">
<button class="btn btn-info btn-sm" data-toggle="modal" data-target="#exampleModalCenter" onclick="edit(this)">修改</button>
<button data-toggle="modal" data-target="#modal-qx" class="btn btn-{{btncss}} btn-sm" data-isactive = {{isactive}} onclick="del({{del}},this)">{{btntext}}</button></td>
</tr>
`
function Add() {
let dnyc = $(".sloatdnyc");
if (!KP || KP == "")
KP = dnyc.html();
dnyc.html("");
let x = aau
//.forEach(x => {
//统计权限
uautp = [];
let successtr = "";
let dangertr = "";
let text = KP.replace("{{AppName}}", x.AppName)
.replace("{{AppId}}", x.AppId)
.replace("{{Desc}}", x.Desc)
.replace("{{AppType}}", x.AppType==0?"Web网站":"桌面程序")
.replace(`{{WebSite}}`, x.WebSite)
.replace(`{{WebSite}}`, x.WebSite)
.replace("{{Version}}", x.Version)
.replace("{{ReleaseDate}}",Gotimestamp(x.ReleaseDate))
.replace("{{AuthorSum}}", x.data.length);
x.data.forEach(
y => {
let TD_bodytext = tdtext.replace("{{AuthorityID}}", y.Id)
.replace("{{AuthorityName}}", y.AuthorityName)
.replace("{{CreateTime}}", Gotimestamp(y.CreateTime))
.replace("{{isactive}}", y.IsValid)
.replace("{{btncss}}", y.IsValid == '0' ? "danger" : "success")
.replace("{{btntext}}", y.IsValid == '0' ? "禁用" : "恢复")
.replace("{{bg-gray}}", y.IsValid == '0' ? "" : "#ececec")
.replace("{{AuthDesc}}", y.Desc).replace("{{del}}", y.Id).replace("{{AuthoStatusTypeId}}", y.AuthoStatusTypeId);
if (y.IsValid == '0')
successtr += TD_bodytext;
else
dangertr += TD_bodytext;
})
//
text = text.replace("{{card-body}}",
"<h6 class='text-info' style='margin:7px 0 ;'>正常权限<h6>"+
card_body.replace("{{tr}}", successtr).replace("{{tbsuccess}}", "tbsuccess")
+ "<h6 class='text-gray' style='margin:7px 0 ;'>已经禁用权限<h6>"
+ card_body.replace("{{tr}}", dangertr).replace("{{tbsuccess}}","tbdanger"));
TD_body = dangertr;
dnyc.append(text);
dnyc.show();
}
};
//分组 未使用
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 AddAuthority() {
event.stopPropagation();
//唤起添加编辑弹出
$('#modal-Addautho-title').html('添加权限');
$('#ResAddauthobtn').html('确认添加');
$('#ResAddauthobtn').removeAttr('data-type');
$('#Authoname').removeAttr("data-oldname");
$('#Authoname').val('');
$('#authoDesc').val('');
$('#authoDesc').removeAttr("data-olddesc");
$('#ResAddauthobtn').removeAttr('data-id');
$("#ResAddauthobtn").attr("disabled", "disabled");
$("#Addauthobtn").click();
$("#Addauthobtn").click();
autypes = [];
//每次取消选择
$($('.icheck-primary').find('input[type = checkbox]')).prop("checked", false);
}
// 唤起提示弹出
function Delzz(that) {
let IsValid = $(that).attr('data-IsValid');
if (IsValid == 0) {
$('#ptext').html("将清除应用下相关权限!");
$('#tsbtn').html("禁用");
}
else {
$('#tsbtn').html("恢复");
$('#ptext').html("将恢复应用下相关权限!");
}
$('#tsbtn').attr('data-IsValid', IsValid == 0 ? '1' : '0');
$("#modaldangerbtn").click();
}
function ResDel(that) {
let IsValid = $(that).attr('data-IsValid');
let btnthat = $('#btnDelzz');
$("#closebtn").click();
request("/Api/DelApp", { AppId:'@ViewBag.SelectApp',IsValid:IsValid }).then(
res => {
if (res.Status == 200) {
btnthat.removeClass("btn-success").removeClass("btn-danger");
$(btnthat).attr('data-IsValid', IsValid);
if (IsValid == 0) {
$(btnthat).addClass("btn-danger");
$(btnthat).html("禁用");
} else {
$(btnthat).addClass("btn-success");
$(btnthat).html("恢复");
}
success("成功");
}
else
error("失败");
}
)
}
//添加权限 -- 验证名字通过时提交
//验证通过标识
let xgnam = -1;
//防抖 多次提交
let timers;
function Checkautho(that) {
$("#ResAddauthobtn").attr("disabled", "disabled");
let name = $(that).val();
let oldname = $('#Authoname').attr("data-oldname");
if (name == "")
return;
if (name == oldname) {
$("#ResAddauthobtn").removeAttr("disabled")
return;
}
if (timers)
clearInterval(timers);
timers = setTimeout(() => {
$.post("/Api/Checkautho", { AppId:@ViewBag.SelectApp, AuthoNmae: name }, res => {
if (res.Status == 200) {
xgnam = 1;
$("#ResAddauthobtn").removeAttr("disabled")
//$('#Authoname').attr("data-oldname", name)
}
else
error("名字重复")
})
},1000
)
}
//编辑项的 类型
let autypes;
//确定添加 修改
function ResAddautho(that) {
if (xgnam == -1 && $("#Authoname").val() != $("#Authoname").attr("data-oldname")) {
info("验证权限名中,请稍等")
return;
}
$(that).attr("disabled", "disabled");
let datatype = $('#ResAddauthobtn').attr('data-type');
let dataid = $('#ResAddauthobtn').attr('data-id');
let selitem = $('.icheck-primary').find('input[type = checkbox]:checked');
if (selitem.length < 2) {
$("#ResAddauthobtn").removeAttr("disabled")
error('选项至少勾选两项');
return;
}
let newtypes = [];
for (var i = 0; i < selitem.length; i++) {
newtypes.push($(selitem[i]).val());
}
if (autypes.join() == newtypes.join() && $('#authoDesc').attr("data-olddesc") == $("#authoDesc").val() && $("#Authoname").val() == $("#Authoname").attr("data-oldname")) {
$("#Addorgclosebtn").click();
info('无修改!')
return;
}
let AuthoStatusTypeId = newtypes.join()
if (datatype == '1') {
editok($("#Authoname").val(), $("#authoDesc").val(), dataid, AuthoStatusTypeId);
} else {
$.post("/Api/Addautho", {
AppId:@ViewBag.SelectApp, AuthoNmae: $("#Authoname").val(), Desc: $("#authoDesc").val(), AuthoStatusTypeId
}, res => {
if (res.Status == 200 && res.Data) {
$("#Addorgclosebtn").click();
$("#authoDesc").val("")
$("#Authoname").val("")
success("添加成功");
init();
}
else {
error("添加失败");
$("#ResAddauthobtn").removeAttr("disabled")
}
})
}
}
//禁用权限
//存放选择禁用恢复的tr
let qxtr;
function del(id, that) {
qxtr = that;
//根据当前状态 判断
let isactive = $(that).attr("data-isactive") == '0' ? 1 : 0;
$("#qxname").html(($($(that).closest("tr").find("td").get(1)).html().replace(/\s*/g, "")));
$('#qxbtn').prop('data-isactive', isactive);
if (isactive == 1) {
$('#qxbtn').html("确认禁用");
$("#qxtext").html("相关用户的权限将被禁用!");
}
else {
$("#qxtext").html("相关用户的权限将被恢复!");
$('#qxbtn').html("确认恢复");
}
}
//确认删除
function ResDelqx(that) {
$("#qxclosebtn").click();
let id = $($(qxtr).closest("tr").find("td").get(0)).html().replace(/\s*/g, "");
let isactive = $(that).prop('data-isactive');
request("/Api/DelAppAutho", { AuthoId: id, status: isactive }).then(res => {
if (res.Status == 200 && res.Message == true) {
$(qxtr).attr("data-isactive", isactive)
$(qxtr).removeClass("btn-danger").removeClass("btn-success");
if (isactive == 0) {
$(qxtr).addClass("btn-danger");
$(qxtr).html("禁用");
$("#tbsuccess table").append($($(qxtr).closest("tr")));
} else {
$(qxtr).addClass("btn-success");
$(qxtr).html("恢复");
$("#tbdanger table").append($($(qxtr).closest("tr")));
}
}
else
error("删除失败~");
}).catch(() => {
error("删除失败~");
})
}
//修改
function edit(that) {
let name = $(that).closest("tr").find("td").get(1);
let id = $(that).closest("tr").find("td").get(0);
autypes = $($(that).closest("tr").find("td").get(0)).attr('data-type') != 'null' ? $($(that).closest("tr").find("td").get(0)).attr('data-type').split(','):[];
let desc = $(that).closest("tr").find("td").get(2);
let txdesc = $(desc).html().replace(/\s*/g, "");
let txid = $(id).html().replace(/\s*/g, "");
let txname = $(name).html().replace(/\s*/g, "");
$('#Authoname').attr("data-oldname", txname);
$('#Authoname').val(txname);
$('#authoDesc').val(txdesc);
$('#authoDesc').attr("data-olddesc", txdesc);
$('#modal-Addautho-title').html('编辑权限');
$('#ResAddauthobtn').html('确认修改');
$('#ResAddauthobtn').attr('data-type', '1');
$('#ResAddauthobtn').attr('data-id', txid);
$("#ResAddauthobtn").removeAttr("disabled")
$("#Addauthobtn").click();
$($('.icheck-primary').find('input[type = checkbox]')).prop("checked", false);
for (var i = 0; i < autypes.length; i++) {
$($('.icheck-primary').find('input[type = checkbox][value="' + autypes[i]+'"]')).prop("checked", true);
}
}
//完成修改
function editok(newname, newdesc, Id, AuthoStatusTypeId) {
request("/Api/EditAppAutho", { AuthorityName: newname, Desc: newdesc, Id: Id, AuthoStatusTypeId:AuthoStatusTypeId }).then(res => {
if (res.Status == 200 && res.Message == true) {
$("#Addorgclosebtn").click();
success("修改成功~");
init();
}
else {
error("修改失败~");
}
}).catch(() => {
error("修改失败~");
}
)
};
//添加类型
function AddType(that) {
if ($('#content').find('#addtype').length > 0)
$('#addtype').toggle();
if ($(that).val().replace(/' '/, '') == "新增") {
if ($('#content').find('#addtype').length <= 0) {
//追加元素
let text = `
<div id="addtype" style='width:60%;margin:10px 10.5px;' class="input-group input-group-sm" >
<div class="input-group input-group-sm" style='margin:5px 0px;'>
<span class="input-group-append">
<button type="button" class="btn btn-info btn-flat">名称</button>
</span>
<input type="text" class="form-control">
</div>
<div class="input-group input-group-sm" style='margin:2.5px 0px;' >
<span class="input-group-append">
<button type="button" class="btn btn-info btn-flat">描述</button>
</span>
<input type="text" class="form-control">
</div>
<div class='col-12'>
<button type="button" class="btn btn-success btn-sm" style='margin-top:2.5px;float:right;margin-right:0;' onclick="AddTypeOk()">添加</button>
<div>
</div>`
$('#content').append(text);
}
$(that).removeClass('btn-success').addClass('btn-danger');
$(that).val("取消")
} else {
$(that).removeClass('btn-danger').addClass('btn-success');
$(that).val("新增")
}
}
//确定添加类型
function AddTypeOk() {
let name = $($('#addtype').find('input').get(0)).val().replace(/''/, '');
let desc = $($('#addtype').find('input').get(1)).val().replace(/''/, '');
if (name == "")
error("名字无效!");
request('/Api/AddType', { name, desc }).then(x => {
if (x.Status == 200) {
success("添加成功!");
$($('#addtype').find('input').get(0)).val('');
$($('#addtype').find('input').get(1)).val('');
let dom = $($('.icheck-primary').find('input[type = checkbox]').get(0)).closest('.col-4');
let newdom = dom.clone(true);
$($(newdom).find('label')).html(x.Data.Name);
$($(newdom).find('input[type = checkbox]')).val(x.Data.Id);
$('.icheck-primary').append(newdom)
//$($('.icheck-primary').find('input[type = checkbox]')).prop("checked", false);
AddType($('#addtypebtn'));
} else {
if (x.Status == 100)
error("名字无效!");
else
error("网络繁忙~");
}
})
}
init();
</script>
@* 禁用app警告 *@
<div class="modal fade " id="modal-danger">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">@ViewBag.AppName</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="closebtn">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p id="ptext"></p>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-sm btn-info" data-dismiss="modal">关闭</button>
<button type="button" id="tsbtn" class="btn btn-sm btn-danger" onclick="ResDel(this)">禁用</button>
</div>
</div>
</div>
</div>
<button data-toggle="modal" data-target="#modal-Addautho" id="Addauthobtn" style="display:none;"></button>
@*//添加编辑弹出*@
<div class="modal fade" id="modal-Addautho">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content ">
<div class="modal-header">
<h5 class="modal-title" id="modal-Addautho-title">添加权限</h5>
<button type="button" class="close " data-dismiss="modal" aria-label="Close" id="Addorgclosebtn">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="content">
<input type="text" oninput="Checkautho(this)" placeholder="请输入名字" class="form-control" style="border:none;" id="Authoname" />
<input type="text" placeholder="描述" class="form-control" style="border:none;" id="authoDesc" />
<div class="icheck-primary row" style="margin:5.25px 3px">
@foreach (var item in ViewBag.AuthoType)
{
<div class="col-4">
<input value="@item.Id" type="checkbox">
<label>
@item.Name &nbsp;&nbsp;
</label>
</div>
}
</div>
<div class="col-3">
<input value="新增" id="addtypebtn" onclick="AddType(this)" type="button" class=" btn btn-success btn-sm ">
</div>
</div>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-success btn-sm" id="ResAddauthobtn" disabled onclick="ResAddautho(this)">确定添加</button>
</div>
</div>
</div>
</div>
@* 禁用权限弹出 *@
<div class="modal fade " id="modal-qx">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qxname"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="qxclosebtn">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p id="qxtext"></p>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-sm btn-info" data-dismiss="modal">关闭</button>
<button type="button" id="qxbtn" class="btn btn-sm btn-danger" onclick="ResDelqx(this)">禁用</button>
</div>
</div>
</div>
</div>

44
UI/Views/App/List.cshtml Normal file
View File

@@ -0,0 +1,44 @@

@{
ViewBag.Title = "应用列表";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<div class="card">
<div class="card-header">
<h3 class="card-title">应用列表</h3>
</div>
<div class="card-body" id="cardbody">
@foreach (var item in ViewBag.Apps)
{
<a href="/App/Index/@item.Id" class="info-box " style="color:#6c757d; padding: 0px; margin-bottom: 0.5rem; overflow-wrap: break-word; ">
<div class="info-box-content">
<span class="text-bold" style="line-height: 1;">
@item.AppName
</span>
<span style="line-height: 1;">
创建: <span style="color: rgb(169, 169, 169); line-height: 1;">@item.CreatedBy</span>
</span>
<span style="line-height: 1;">
状态:<span class=" @(item.IsValid==0?"text-info":"text-danger")" style="line-height: 1;">@(item.IsValid==0?"正常":"禁用")</span>
</span>
<span style="line-height: 1;">
日期: <span style="color: rgb(169, 169, 169); line-height: 1;">@item.CreateTime</span>
</span>
<span style="line-height: 1;">
备注:
<span style="color: rgb(169, 169, 169); line-height: 1;">@item.Desc</span>
</span>
</div>
</a>
}
<div>
<a onclick="AddApp()" class="nav-link">
<p>添加应用</p>
</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,286 @@
@{ Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<link rel="stylesheet" href="~/Lib/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<div class="card card-success">
<div class="card-header">
<h3 class="card-title">添加用户</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-5">
<from>
<div class="form-group">
<label for="uid">账号</label>
<input onblur="check(this)" type="text" class="form-control" id="Uid" placeholder="输入 ...">
</div>
<div class="form-group">
<label for="Pwd">密码</label>
<input type="text" onfocus="this.type='password'" class="form-control" id="Pwd" placeholder="密码">
</div>
<div class="form-group row" style="margin-left:0px;margin-right:0;">
<label>性别:</label>
<div class="form-check">
<input class="form-check-input" type="radio" value="0" name="Sex" checked="">
<label class="form-check-label">男</label>
</div>
<span style="opacity:0;"></span>
<div class="form-check">
<input class="form-check-input" type="radio" value="1" name="Sex">
<label class="form-check-label">女</label>
</div>
</div>
<div class="form-group">
<label for="Age">年龄</label>
<input type="number" class="form-control" value="18" id="Age" placeholder="年龄">
</div>
<div class="form-group">
<label for="IsValid">公司</label>
<select class="form-control" id="Company">
<option value="0">
宝来威
</option>
<option value="1">
住好
</option>
<option value="2">
卓豪
</option>
</select>
</div>
<div class="form-group">
<label for="OrgId">所属用户组</label>
<select class="form-control" id="OrgId">
@foreach (var item in ViewBag.Orgs)
{
<option value="@item.Id" @(item.IsDefault == 1 ? "select=''" : "")>
@item.OrganizationName
</option>
}
</select>
</div>
<div class="form-group">
<label for="IsValid">状态</label>
<select class="form-control" id="IsValid">
<option value="0">
正常
</option>
<option value="1">
冻结
</option>
<option value="2">
管理
</option>
@if (ViewBag.Umodel.IsValid >= 3)
{
<option value="3">
超管
</option>
}
</select>
</div>
<div class="form-group">
<label>到期时间:</label>
<div class="input-group date" id="EndTimeDIV" data-target-input="nearest">
<input type="text" id="EndTime" readonly value="@DateTime.Now.AddMonths(2).ToString("g")" class="form-control datetimepicker-input" data-target="#EndTimeDIV">
<div class="input-group-append" data-target="#EndTimeDIV" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
<div class="form-group">
<label for="exampleInputFile">上传图片</label>
<div class="input-group">
<div class="custom-file">
<input type="file" onchange="uploadimg()" class=" custom-file-input" accept="image/*" id="exampleInputFile">
<label class="custom-file-label" for="exampleInputFile"></label>
</div>
<div class="input-group-append">
<button class="input-group-text bg-success" id="btnup" onclick="uploadimg(1)">上传</button>
</div>
</div>
<div style="overflow:hidden;max-height:85px;">
<img class="image" style="display:none; width: 85px; height: 85px; overflow: hidden;" id="images">
</div>
</div>
<div class="form-group">
<label for="Desc">备注</label>
<input type="text" class="form-control" id="Desc" placeholder="请输入 ...">
</div>
</from>
<button type="button" onclick="Confirmsubmission()" class="btn btn-primary">确认添加</button>
</div>
<div class="col-md-7">
</div>
</div>
</div>
</div>
<script src="~/Scripts/jsencrypt.js"></script>
<script src="~/Scripts/compressor.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="~/Lib/plugins/moment/moment.min.js"></script>
<script src="~/Lib/plugins/moment/locale/zh-cn.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="~/Lib/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<script>
$('#EndTimeDIV').datetimepicker({ icons: { time: 'far fa-clock' } });
let userinfo = {
Age: "", Desc: "暂无描述", OrgId: "", Sex: "", Pwd: "", Uid: "", HeadImg: "defaultboy.png", IsValid: 0, Company: '0',
EndTime: '@DateTime.Now.AddMonths(2)',
};
var 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 check(that) {
let uid = $(that).val();
if (uid==""||userinfo.Uid == uid)
return;
request("/Api/CheckUid", { Uid: uid }).then(
res => {
$(that).removeClass("is-valid").removeClass("is-invalid");
if (res.Status == 200) {
userinfo.Uid = uid
$(that).addClass("is-valid");
}
else {
userinfo.Uid = ""
$(that).addClass("is-invalid");
}
}
)
}
function uploadimg(type) {
let files = $("#exampleInputFile").prop("files");
if (files.length <= 0)
return;
$("#exampleInputFile").closest(".input-group").find("label").html(files[0].name);
upload(type);
}
function upload(type) {
let file = $('#exampleInputFile')[0].files[0];
let name = $("#exampleInputFile").attr('data-old');
if (!file) {
error('无文件!')
return;
}
if (name == file.name)
{
error('文件已上传!')
return;
}
let quality = 0.2;
//if ((file.size / 1024) > (1024 * 2)) {
// quality = 0.6
//}
//if ((file.size / 1024) > (1024 * 4)) {
// quality = 0.4
//}
//if ((file.size / 1024) > (1024 * 4)) {
// quality = 0.2
//}
new Compressor(file, {
quality: quality,
success(imgBase) {
let img = new FileReader();
img.readAsDataURL(imgBase)
if (type != 1) {
img.onload = function () {
let imgdata = this.result
$("#images").attr('src', imgdata).show()
}
}
if (type!= 1)
return;
var formData = new FormData() //创建一个forData
formData.append('img', imgBase) //把file添加进去 name命名为img
$.ajax({
url: "/ImgServer/Update",
data: formData,
type: "POST",
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
$("#exampleInputFile").attr('data-old', file.name);
//成功\
if (data.code != 0) {
error("上传失败!");
return;
}
success("上传成功!")
userinfo.HeadImg = data.data.src
setTimeout(() => {
$("#images").attr('src', "/ImgServer/FileImage?url=" + data.data.src).show()
}, 100);
},
error: function () {
error("上传失败!");
}
})
}});
}
//提交
let num = 0;
function Confirmsubmission() {
num = 0;
userinfo.Sex = $("input[name='Sex']:checked").val();
if (userinfo.HeadImg == "defaultboy.png" && $("#exampleInputFile").prop("files").length > 0) {
num++;
$("#btnup").removeClass("bg-success");
$("#btnup").addClass("bg-danger");
setTimeout(function () {
$("#btnup").addClass("bg-success");
$("#btnup").removeClass("bg-danger");
}, 2000);
}
for (let key in userinfo) {
if (key != "Sex" && key != "HeadImg" && key != "Desc") {
if ($("#" + key).val() == "") {
num++;
$("#" + key).addClass("is-invalid");
setTimeout(function () {
$("#" + key).removeClass("is-valid").removeClass("is-invalid");
},1500);
} else {
userinfo[key] = $("#" + key).val();
}
}
}
if (num <= 0) {
if (userinfo.Sex == 1 && userinfo.HeadImg == 'defaultboy.png') {
userinfo.HeadImg == 'defaultgril.png'
}
var encryptor = new JSEncrypt() // 创建加密对象实例
var pubKey = '@ViewBag.publicYS'
encryptor.setPublicKey(pubKey)//设置公钥
userinfo.Pwd = encryptor.encrypt(userinfo.Pwd)
request("/Api/AddUserinfo", userinfo).then(
res => {
if(res.Status == 200) {
location.href="/Home/UAuthority/" + userinfo.Uid;
}
else {
error(res.Message)
}
}
)
}
}
</script>

View File

@@ -0,0 +1,355 @@
@{
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<link rel="stylesheet" href="~/Lib/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<div class="card card-success">
<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;">修改用户信息</h5>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item" style="color:#999c9e;">
<button type="button" onclick="Delzz(@ViewBag.Uinfo.Id)" class="btn btn-danger btn-xs">删除</button>
</li>
</ul>
</div>
<div class="card-body">
<div class="row">
@*<div class="col-md-3"></div>*@
<div class="col-md-5">
<from>
<div class="form-group">
<label for="uid">账号</label>
<input readonly onblur="check(this)" type="text" value="@ViewBag.Uinfo.Uid" class="form-control" id="Uid" placeholder="输入 ...">
</div>
@if (ViewBag.Uinfo.IsImport == 0)
{
<div class="form-group">
<label for="Pwd">密码</label>
<input type="text" onfocus="this.type='password'" class="form-control" id="Pwd" placeholder="密码">
</div>
}
<div class="form-group row" style="margin-left:0px;margin-right:0;">
<label>性别:</label>
<div class="form-check">
<input class="form-check-input" @(ViewBag.Uinfo.Sex == 0 ? "checked" : "") type="radio" value="0" name="Sex" checked="">
<label class="form-check-label">男</label>
</div>
<span style="opacity:0;"></span>
<div class="form-check">
<input class="form-check-input" @(ViewBag.Uinfo.Sex == 1 ? "checked = 'checked'" : "") type="radio" value="1" name="Sex">
<label class="form-check-label">女</label>
</div>
<span style="opacity:0;"></span>
<div class="form-check">
<input class="form-check-input" @(ViewBag.Uinfo.Sex > 1 ? "checked = 'checked'" : "") type="radio" value="2" name="Sex">
<label class="form-check-label">未知</label>
</div>
</div>
<div class="form-group">
<label for="Age">年龄</label>
<input type="number" class="form-control" value="18" id="Age" placeholder="年龄">
</div>
<div class="form-group">
<label for="IsValid">公司</label>
<select @(ViewBag.Uinfo.IsImport == 0 ? "" : " readonly ") class="form-control" id="Company">
<option @(ViewBag.Uinfo.Company == 0 ? "checked = 'checked'" : "") value="0">
宝来威
</option>
<option @(ViewBag.Uinfo.Company == 1 ? "checked = 'checked'" : "") value="1">
住好
</option>
<option @(ViewBag.Uinfo.Company == 2 ? "checked = 'checked'" : "") value="2">
卓豪
</option>
</select>
</div>
<div class="form-group">
<label for="OrgId">所属用户组</label>
<select class="form-control" id="OrgId">
@foreach (var item in ViewBag.Orgs)
{
<option value="@item.Id" @(item.Id == @ViewBag.Uinfo.OrgId ? "selected" : "")>
@item.OrganizationName
</option>
}
</select>
</div>
<div class="form-group">
<label for="IsValid">状态</label>
<select class="form-control" id="IsValid">
<option value="0" @(ViewBag.Uinfo.IsValid == 0 ? "selected" : "")>
正常
</option>
<option value="1" @(ViewBag.Uinfo.IsValid == 1 ? "selected" : "")>
冻结
</option>
<option value="2" @(ViewBag.Uinfo.IsValid == 2 ? "selected" : "")>
管理
</option>
@if (ViewBag.Umodel.IsValid >= 3 || ViewBag.Umodel.Id == 1)
{
<option value="3" @(ViewBag.Uinfo.IsValid == 3 ? "selected" : "")>
超管
</option>
}
</select>
</div>
<div class="form-group">
<label>到期时间:</label>
<div class="input-group date" id="EndTimeDIV" data-target-input="nearest">
<input type="text" id="EndTime" readonly value="@ViewBag.Uinfo.EndTime" class="form-control datetimepicker-input" data-target="#EndTimeDIV">
<div class="input-group-append" data-target="#EndTimeDIV" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
<div class="form-group">
<label for="exampleInputFile">上传头像</label>
<div class="input-group">
<div class="custom-file">
<input type="file" onchange="uploadimg()" class=" custom-file-input" accept="image/*" id="exampleInputFile">
<label class="custom-file-label" for="exampleInputFile"></label>
</div>
<div class="input-group-append">
<span class="input-group-text bg-success" id="btnup" onclick="uploadimg(1)">上传</span>
</div>
</div>
<div style=" height: 85px; overflow: hidden;">
<img class="image" style="width: 85px;padding:2px;display:none;" id="images" src="/Lib/dist/img/more.jpg" data-src="/ImgServer/FileImage?url=@ViewBag.Uinfo.HeadImg">
</div>
</div>
<div class="form-group">
<label for="Desc">备注</label>
<input type="text" class="form-control" id="Desc" value="@ViewBag.Uinfo.Desc" placeholder="请输入 ...">
</div>
</from>
<button type="button" onclick="Confirmsubmission()" class="btn btn-primary">确认修改</button>
</div>
<div class="col-md-7">
</div>
</div>
</div>
</div>
<script src="~/Scripts/jsencrypt.js"></script>
<script src="~/Scripts/compressor.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="~/Lib/plugins/moment/moment.min.js"></script>
<script src="~/Lib/plugins/moment/locale/zh-cn.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="~/Lib/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<script>
//日期和时间 picker
$('#EndTimeDIV').datetimepicker({ icons: { time: 'far fa-clock' } });
let userinfo = {
Age: "@ViewBag.Uinfo.Age",
EndTime:"@ViewBag.Uinfo.EndTime",
Id: "@ViewBag.Uinfo.Id",
Desc: "@ViewBag.Uinfo.Desc",
OrgId: "@ViewBag.Uinfo.OrgId",
Sex: "@ViewBag.Uinfo.Sex",
Pwd: "",
Uid: "@ViewBag.Uinfo.Uid",
HeadImg: "@ViewBag.Uinfo.HeadImg",
IsValid: '@ViewBag.Uinfo.IsValid',
Company: '@ViewBag.Uinfo.Company',
type: '90'
};
var 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 check(that) {
let uid = $(that).val();
if (uid=="" || userinfo.Uid == uid)
return;
request("/Api/CheckUid", { Uid: uid }).then(
res => {
$(that).removeClass("is-valid").removeClass("is-invalid");
if (res.Status == 200) {
userinfo.Uid = uid
$(that).addClass("is-valid");
}
else {
userinfo.Uid = ""
$(that).addClass("is-invalid");
}
}
)
}
function uploadimg(type) {
let files = $("#exampleInputFile").prop("files");
if (files.length <= 0)
return;
$("#exampleInputFile").closest(".input-group").find("label").html(files[0].name);
let img = new FileReader();
img.readAsDataURL(files[0])
img.onload = function () {
let imgdata = this.result
$("#images").attr('src', imgdata).show()
}
upload(type);
}
function upload(type) {
let file = $('#exampleInputFile')[0].files[0];
let name = $("#exampleInputFile").attr('data-old');
if (!file) {
error('无文件!')
return;
}
if (name == file.name) {
error('文件已上传!')
return;
}
let quality = 0.2;
//if ((file.size / 1024) > (1024 * 1)) {
// quality = 0.4
//}
//压缩
new Compressor(file, {
quality: quality,
success(imgBase) {
let img = new FileReader();
img.readAsDataURL(imgBase)
if (type != 1) {
img.onload = function () {
let imgdata = this.result
$("#images").attr('src', imgdata).show()
}
}
if (type != 1)
return;
//let blob = dataURLtoFile(imgBase, 'image/jpeg');
var formData = new FormData() //创建一个forData
formData.append('img', imgBase) //把file添加进去 name命名为img
$.ajax({
url: "/ImgServer/Update",
data: formData,
type: "POST",
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
$("#exampleInputFile").attr('data-old', file.name);
//成功\
if (data.code != 0) {
error("上传失败!");
return;
}
success("上传成功!")
userinfo.HeadImg = data.data.src
setTimeout(() => {
$("#images").attr('src', "/ImgServer/FileImage?url=" + data.data.src).show()
},100);
},
error: function () {
error("上传失败!");
}
})
}
});
}
let num = 0;
function Confirmsubmission() {
num = 0;
userinfo.Sex = $("input[name='Sex']:checked").val();
if ($("#exampleInputFile").prop("files").length > 0 && userinfo.HeadImg =="@ViewBag.Uinfo.HeadImg") {
num++;
$("#btnup").removeClass("bg-success");
$("#btnup").addClass("bg-danger");
setTimeout(function () {
$("#btnup").addClass("bg-success");
$("#btnup").removeClass("bg-danger");
}, 2000);
} else {
//$("#exampleInputFile").addClass("is-invalid");
//setTimeout(function () {
// $("#exampleInputFile").removeClass("is-valid").removeClass("is-invalid");
//}, 2000);
}
for (let key in userinfo) {
if (key != "Sex" && key != "HeadImg" && key != 'type' && key != 'Id') {
if ($("#" + key).val() == "" || $("#" + key).val() == userinfo[key]) {
} else {
userinfo[key] = $("#" + key).val()
}
}
}
if (num <= 0) {
if (userinfo.Sex == 0 && userinfo.HeadImg == 'defaultgril.png') {
userinfo.HeadImg == 'defaultboy.png'
} else if (userinfo.Sex == 1 && userinfo.HeadImg == 'defaultboy.png') {
userinfo.HeadImg == 'defaultgril.png'
}
var encryptor = new JSEncrypt() // 创建加密对象实例
var pubKey = '@ViewBag.publicYS'
encryptor.setPublicKey(pubKey)//设置公钥
if (userinfo.Pwd && userinfo.Pwd != "")
userinfo.Pwd = encryptor.encrypt(userinfo.Pwd)
request("/Api/AddUserinfo", userinfo).then(
res => {
if (res.Status == 200) {
success("修改成功!")
location.href = "/Home/Index";
}
else {
error(res.Message)
}
},
err => {
console.log(err)
}
)
}
}
function Delzz(id) {
Swal.fire({
title: '<span>删除提示</span>',
showCloseButton: true,
html: "确定删除<text class='text-info'>@ViewBag.Uinfo.Uid<text>?",
showCloseButton: true,
showCancelButton: true,
confirmButtonText:
`确认`
}).then((result) => {
if (result.value) {
request("/Api/Deluser", { id: id }).then(
x => {
if (x.Status == 200) {
success('删除成功!');
location.href = '/Home/Index'
}
else {
error('删除失败!')
}
},
err => {
error('删除失败!')
}
);
}
})
}
</script>

351
UI/Views/Home/Index.cshtml Normal file
View File

@@ -0,0 +1,351 @@
@{
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
ViewBag.Title = "<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>";
}
<style>
.table td, .table th {
padding: 0rem !important;
vertical-align: top;
border-top: 0px !important;
}
</style>
<div class="card">
<div class="card-header">
<h3 class="card-title"><3E>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD></h3>
</div>
<div class="card-body" id="cardbody">
<div class="table-responsive sjyc" style="display:none;">
<button class="btn btn-success" style=" margin:2px; " onclick='location.href="/Home/AddUser"'><3E><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD></button>
<button class="btn btn-info" style=" margin:2px; " onclick='SearchInfo(this,-1)'>ȫ<><C8AB></button>
<button class="btn btn-info" style=" margin:2px; " onclick='SearchInfo(this,0)'><3E>Խ<EFBFBD><D4BD>û<EFBFBD></button>
<button class="btn btn-info" style=" margin:2px; " onclick='SearchInfo(this,1)'><3E><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD></button>
<select id="Draw" onchange="Draw(this)">
<option value="-1">ȫ<><C8AB></option>
<option value="0"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></option>
<option value="1">ס<><D7A1></option>
<option value="2">׿<><D7BF></option>
</select>
<table id="dataTable" class="table "></table>
</div>
<slot class="sloatdnyc" style="display:none;">
<div class="yhxx">
<div class="info-box" onclick="ShowInfo(this,'{{Id}}');">
<span class="info-box-icon" style="height:85px;overflow:hidden;"><img class="img-fluid" width="85" src="/Lib/dist/img/more.jpg" data-src="/ImgServer/FileImage?url={{HeadImg}}&&ftp=11" /></span>
<div class="info-box-content" style="padding:0;padding-left:10px;">
<span style="color: rgb(169, 169, 169); line-height: 1;">
<span class="text-bold " style="font-size:16px;color:#000000;">{{Uid}}</span>
</span>
@*<span>
<20>Ա<EFBFBD>:
<span style="color:#a9a9a9;">{{sex}}</span>
</span>>*@
<span>
<20>û<EFBFBD><C3BB><EFBFBD>: <span style="color:#a9a9a9;">{{OrganizationName}}</span>
</span>
<span>
״̬:
<span class="text-{{textcolor}} StatusInfo">{{isValid}}</span>
</span>
<span>
<20><>Ч<EFBFBD><D0A7>: <span style="color:#a9a9a9;">{{EndTime}}</span>
</span>
<span>
<20><>ע:
<span style="color:#a9a9a9;">{{Desc}}</span>
</span>
</div>
<div class="info-box-content" style="padding:0;">
<span>
Ȩ<><C8A8>:
<span style="color:#a9a9a9;">
{{Authoncount}}
<span style="color:#000;">&nbsp;&nbsp;ID:<span style="color:#a9a9a9;"> {{ID}}</span></span>
</span>
</span>
<span>
<20>Ƶ<EFBFBD>:
<span style="color:#a9a9a9;">{{Hoteles}}</span>
</span>
<span>
<20><>˾:
<span style="color:#a9a9a9;">{{Gs}}</span>
</span>
<span>
{{edit}}
<button style="margin:1px;display:{{none}}" onclick="del(`{{Uid,IsValid}}`,this)" class="btn btn-danger btn-xs btnmp">{{IsValidText}}</button>
<button style="margin:1px;" onclick="selinfo('{{BtnUid}}')" class="btn btn-info btn-xs btnmp"><3E>鿴</button>
</span>
</div>
</div>
</div>
</slot>
</div>
</div>
<!-- DataTables & Plugins -->
<script src="~/Lib/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="~/Lib/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript">
var url = "/Api/GetUserinfo" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
var table = null; //<2F><><EFBFBD><EFBFBD>
let list = null;
let s = Swal.mixin({
toast: true,
position: 'center',
showConfirmButton: false,
});
var request = async (url, params, method = "Post") => {
return new Promise((resolve, reject) => {
$.ajax({
type: method,
url: url,
cache: false, //<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
data: params, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
dataType: "json",
success: function (result) {
resolve(result);
},
error: function (res) {
reject(res)
},
complete: function () {
}
});
})
}// ɾ<><C9BE>
function delinfo(me) {
var row = table.rows($(me).parents('tr')).data()[0]; // ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><>ȡ״̬ 1 <20><>ִ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD>
let isvalid = $(me).attr("data-isvalid");
var {Uid} = row;
del(Uid, isvalid,me);
}
//<2F><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>
async function del(Uid, IsValid, me) {
let s = $(me).html();
//<2F>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
IsValid = $(me).attr("data-isvalid") ? $(me).attr("data-isvalid") : IsValid
if (IsValid == '1') {
$(me).attr("data-isvalid", '0');
$(me).html("<22><><EFBFBD><EFBFBD>");
}
else {
$(me).attr("data-isvalid", '1');
$(me).html("<22><><EFBFBD><EFBFBD>");
}
//<2F><><EFBFBD>ݵIJ<DDB5><C4B2><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<D2BB>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
var param = { Uid, IsValid };
await request("/Api/EditIsValid", param).then(
res => {
if (res.Status == 200) { //<2F>жϷ<D0B6><CFB7>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
success("<22>޸ijɹ<C4B3>!");
//<2F>޸<EFBFBD>װ̫<D7B0><CCAB><EFBFBD><EFBFBD>
let StatusInfo = $($(me).closest(".info-box").find(".StatusInfo").get(0))
$(StatusInfo).removeClass('text-info').removeClass('text-danger')
if (IsValid == '1') {
$(StatusInfo).addClass('text-info');
$($(me).closest(".info-box").find(".StatusInfo").get(0)).html('<27><><EFBFBD><EFBFBD>');
}
else {
$(StatusInfo).addClass('text-danger');
$($(me).closest(".info-box").find(".StatusInfo").get(0)).html('<27><><EFBFBD><EFBFBD>');
}
} else {
let isvalid = $(me).attr("data-isvalid");
if (isvalid != '1') {
$(me).attr("data-isvalid", '0');
$(me).html(s);
}
else {
$(me).attr("data-isvalid", '1');
$(me).html(s);
}
error(res.Message);
}
},
reject => {
let isvalid = $(me).attr("data-isvalid");
if (isvalid != '1') {
$(me).attr("data-isvalid", '0');
$(me).html(s);
}
else {
$(me).attr("data-isvalid", '1');
$(me).html(s);
}
if (reject.responseText == "/Login/Index")
location.href = reject.responseText
else
error("<22><><EFBFBD>緱æ~");
}
);
}
function selinfo(uid){
location.href = "/Home/UAuthority/" + uid
}
$(function () {
function changeScreen() {
s.fire({
icon: 'info',
title: '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...'
})
$("#cardbody").css("padding", "1.25rem");
$(".sjyc").css("display", "inline");
$(".dnyc").css("display", "none");
table = $("#dataTable").DataTable({
"paging": true,
"serverSide": true,
ajax: function (data, callback, settings) {
data.gs = Selgs
data.IsImport = ZJ;
request(url, data).then(result => {
list = result.data
callback(result);
}).finally(() => {
$(".swal2-center").css("display", "none");//<2F><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
})
},
"columns": [
{
'sTitle': '',
'render': function (data, type, row) {
let dnyc = $(".sloatdnyc");
$(".sloatdnyc .info-box").css("padding", "0").css("margin-bottom", "0.5rem").css("word-wrap", "break-word");
$(".sloatdnyc .info-box .info-box-content span").css("line-height", "1")
if (KP == "")
KP = dnyc.html();
dnyc.html("");
let x = row
let edit = `<a href="/Home/EditUser/` + x.Id + `" style="margin:1px;" class="btnmp btn btn-primary btn-xs"><3E>޸<EFBFBD></a>`
let text = "<td style='padding: 0;'>"+ KP.replace("{{Uid}}", x.Uid)
.replace("{{none}}", x.IsValid >= 2 ? ((@ViewBag.Umodel.Id == '1' || @ViewBag.Umodel.IsValid > x.IsValid || @ViewBag.Umodel.Id == x.Id) ? '' : 'none'):'')
.replace("{{IsValidText}}", x.IsValid == 1 ? "<22><><EFBFBD><EFBFBD>" : "<22><><EFBFBD><EFBFBD>")
.replace("{{edit}}", (@ViewBag.Umodel.Id == '1' || @ViewBag.Umodel.IsValid > x.IsValid || @ViewBag.Umodel.Id == x.Id) ? edit : '')
.replace('`{{Uid,IsValid}}`', "'" + x.Uid + "'" + "," +( x.IsValid == 1 ? 0: 1))
.replace("{{sex}}", x.sex)
.replace("{{Id}}", x.Id)
.replace("{{textcolor}}", x.IsValid == 1 ? "danger" : (x.IsValid == 2 ? "success" :"info"))
.replace("{{isValid}}", x.isValid)
.replace("{{OrganizationName}}", x.OrganizationName == null ? "<22><><EFBFBD><EFBFBD>" : x.OrganizationName)
.replace("{{Authoncount}}", x.Authoncount)
.replace("{{Hoteles}}", x.Hoteles.length)
.replace("{{Gs}}", x.Gs.name)
.replace("{{HeadImg}}", x.HeadImg)
.replace("{{ID}}", x.Id)
.replace("{{EndTime}}", Gotimestamp(x.EndTime))
.replace("{{Desc}}", x.Desc).replace("{{BtnUid}}", x.Uid) + "</td>";
return text;
}
}
],
"language": {
"sProcessing": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
"sLengthMenu": "<22><>ʾ _MENU_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"sZeroRecords": "û<><C3BB>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"sInfo": "<22><>ʾ<EFBFBD><CABE> _START_ <20><> _END_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> _TOTAL_ <20><>",
"sInfoEmpty": "<22><>ʾ<EFBFBD><CABE> 0 <20><> 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20><>",
"sInfoFiltered": "(<28><> _MAX_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
"sInfoPostFix": "",
"sSearch": "<22><><EFBFBD><EFBFBD>:",
"sUrl": "",
"sEmptyTable": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>",
"sLoadingRecords": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "<22><>ҳ",
"sPrevious": "<22><>ҳ",
"sNext": "<22><>ҳ",
"sLast": "ĩҳ"
},
"oAria": {
"sSortAscending": ": <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>",
"sSortDescending": ": <20>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>"
}
},
'aLengthMenu': [15, 25, 35, 50], //<2F><><EFBFBD><EFBFBD>ÿҳ<C3BF><D2B3>ʾ<EFBFBD><CABE>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
"autoWidth": false,
searching: true,
// ÿһ<C3BF>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĺ<C3B5><C4BA><EFBFBD>
"createdRow": function (row, data, dataIndex) {
let td = $(row).children()[4]
$(td).html(Gotimestamp(data.CreateTime))
},
})
//<2F>ػ<EFBFBD>
table.on('draw', function () {
Nodefa();
});
}
//window.onresize = function () { changeScreen(); }
changeScreen();
});
let KP = "";
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
function ShowInfo(that, id) {
let s = $(that).closest("td").find(".row");
let data;
list.filter(ele => {
if (ele.Id == id )
data = ele;
})
if (data.Hoteles.length <= 0) {
info("<22>޾Ƶ<DEBE><C6B5><EFBFBD>Ϣ!");
return;
}
if (s.length<=0) {
$($(that).closest(".yhxx")).append(Elm(data.HotelInfo));
return;
}
$($(s).get(0)).toggle()
}
//<2F><><EFBFBD><EFBFBD>row col-3
function Elm(HotelInfo) {
let row = `<div class="row">{{col}}</div>`
let col = `<div class="{{col}}">{{text}}</div>`
if (HotelInfo.length >= 4)
col = col.replace("{{col}}", 'col-3');
else
col = col.replace("{{col}}", 'col-' + parseInt(12/HotelInfo.length));
let sumcol = '';
BaseData.forEach(
y => {
//<2F>Ƶ<EFBFBD><C6B5><EFBFBD>Ϣ
y.forEach(item => {
HotelInfo.forEach(uitem => {
if (uitem.id == item.Id) {
sumcol += col.replace("{{text}}", item.Name + "(" + uitem.sum+")");
}
})
})
}
);
row = row.replace("{{col}}", sumcol);
return row;
}
//SearchInfo
function SearchInfo(that, type) {
ZJ = type;
table.draw();
}
//<2F><>ֹð<D6B9><C3B0>
function Nodefa () {
$(".btnmp").click(function (event) {
event.stopPropagation();
});
};
//<2F><>˾
let Selgs = -1;
//<2F>Խ<EFBFBD>
let ZJ = -1;
function Draw(that) {
Selgs = $(that).val();
table.draw();
}
</script>

View File

@@ -0,0 +1,106 @@

@{
ViewBag.Title = "首页";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<div class="card">
<div class="card-header" style="padding:10px;">
<h3 class="card-title">首页</h3>
</div>
<div class="card-body" style="padding:0;">
<div class="row">
<div class="col-3 flex-column justify-content-center">
<a href="/home/index" class="link-black text-center" style="padding:5px">
<div>
<i class="text-info link-black fa fa-users text-center" style="font-size:30px"></i>
</div>
<div class="text-gray link-black">
<span style="font-size:16px" class="font-weight-bold">用户</span>
<br />(@ViewBag.Usersum)
</div>
</a>
</div>
<div class="col-3">
<a class="link-black text-center" href="/Hotel/Hotellist" style="padding:5px">
<div>
<i class="text-success link-black fa fa-university text-center" style="font-size:30px"></i>
</div>
<div class="text-gray link-black">
<span style="font-size:16px" class="font-weight-bold">酒店</span>
<br />(
@for (int i = 0, j = 0; i < ViewBag.HoteldGroupsinfo.Count; i++)
{
j += ViewBag.HoteldGroupsinfo[i].Message ;
if (i == ViewBag.HoteldGroupsinfo.Count - 1)
{
@j
}
}
)
</div>
</a>
</div>
<div class="col-3">
<a class="link-black text-center" href="/App/List" style="padding:5px">
<div>
<i class="text-warning link-black fa fa-mobile text-center" style="font-size:30px"></i>
</div>
<div class="text-gray link-black">
<span style="font-size:16px" class="font-weight-bold">应用</span>
<br />(@ViewBag.Apps.Count)
</div>
</a>
</div>
<div class="col-3">
<a href="/log/Index" class="link-black text-center" style="padding:5px">
<div>
<i class="text-danger link-black fa fa-envelope text-center" style="font-size:30px"></i>
</div>
<div style="font-size:16px" class="text-gray link-black">
<span class="font-weight-bold">日志</span>
<br />(@ViewBag.logsum)
</div>
</a>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header" style="padding:10px;">
<h3 class="card-title">近期日志(50)</h3>
</div>
<div class="card-body" style="padding:0;">
@for (var i = 0; i < ViewBag.LogData.Count; i++)
{
<div class="info-box" style="padding:5px;margin: 5px 0 ; min-height: auto !important;line-height:1; ">
<div class="info-box-content" onclick="ShowLog(this,`@ViewBag.LogData[i].Uid `,`@ViewBag.LogData[i].Content`,`@ViewBag.LogData[i].Client`,`@ViewBag.LogData[i].location`,`@ViewBag.LogData[i].Ip`)" style="padding: 0; margin: 0; line-height: 1;overflow:hidden; ">
<p style=" margin:2px;margin:0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; /*控制在1行*/ -webkit-line-clamp:1; -webkit-box-orient: vertical; ">
@ViewBag.LogData[i].Content
</p>
<p style="margin: 2px; margin: 0; ">
<span class="text-gray">
@ViewBag.LogData[i].Id
@ViewBag.LogData[i].CreateTime
@ViewBag.LogData[i].Uid
@(@ViewBag.LogData[i].Type ==0?"新增": ViewBag.LogData[i].Type == 1?"更新":"删除")
@ViewBag.LogData[i].location
</span>
</p>
</div>
</div>
}
</div>
<script>
function ShowLog(that, uid, content, client, location, ip) {
let s = $(that).find(".rowinfo");
let data = `<div class="rowinfo" style=" padding:5px; margin: 0; line-height: 1; "><div>操作者:` + uid + `</div><div>内容:` + content + `</div><div>客户端:` + client + `</div> <div>地点:` + location + `</div><div>IP` + ip + `</div></div>`;
if (s.length <= 0) {
$(that).append(data);
return;
}
$($(s).get(0)).toggle()
};
</script>

View File

@@ -0,0 +1,473 @@

@{
ViewBag.Title = "用户权限管理";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<style>
.gdtr {
table-layout: fixed;
}
</style>
<div class="card">
<div class="card-header" 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.info.Uid<span> @ViewBag.info.OrganizationName</span></span> 权限一览<span id="qxsl"></span></h5>
</li>
@if (ViewBag.info.IsImport == 0)
{
<li class="nav-item">
<button id="seljd" style="margin-top:5px;" data-widget="control-sidebar" data-slide="true" class="btn btn-info btn-xs">酒店授权</button>
</li>
}
</ul>
</div>
<div class="card-body" style="padding:0px" 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:0px">
<div class="row " style = "margin:0;" >
<slot class="APPinfo"></slot>
</div>
</div>
</div>
<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:0px">
<slot class="sloatdnyc" style="display:none;">
<div class="card" style="margin-bottom: 10px;">
<div class="card-header" style="margin-top:10PX; padding:0px 10px;" data-card-widget="collapse">
<a href="{{AppId}}" style="line-height: 1; display: block; color: black;" class=" text-bold">{{AppName}}</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;">{{AuthorSum}}</span>
</span>
<span class="text-gray qxtj" style=" display:block; margin:0;line-height:1;padding:0;">
{{qxtj}}
</span>
</div>
{{card-body}}
</div>
</slot>
</div>
</div>
</div>
</div>
<script>
//let oa, KP, aau, types;
let uoa, ua, KP, aau, types, userAppInfo;
let ajxj = 0;
let HotelGroupID = '@(ViewBag.HotelGroupID??0)';
let HotelID = '@(ViewBag.HotelID??0)';
let HotelList = @(ViewBag.HotelList??0);
let yhjd = [];
let request = (url, params = {}, method = "Post") => {
var urlsdsad = url
debugger
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 () {
request("/Api/GetUOA", { uid: "@ViewBag.info.Uid" }).then(result => {
var { UOA, UA} = result.Data
uoa = UOA;
ua = UA;
userAppInfo = result.Data.AppInfo;
debugger
$("#qxsl").html("(" +ua.length+")");
ajxj++;
checkData = HotelList
debugger
selfincinput(checkData)
Add(ua, checkData);
})
var Appsdata = window.localStorage.getItem("Apps") || null;
if (Appsdata != null) {
Appsdata = JSON.parse(Appsdata);
try {
if (Appsdata.versions == "@ViewBag.Appversions") {
aau = Appsdata.data
types = Appsdata.Types
ajxj++;
checkData = HotelList
selfincinput(checkData)
Add(ua, checkData);
} else {
Appsdata = null;
}
} catch (e) {
Appsdata = null;
}
}
if (Appsdata == null) {
request("/Api/GetApps", { }).then(result => {
aau = result.Data.Appinfos
types = result.Data.Types
Appsdata = new Object();
Appsdata.versions = "@ViewBag.Appversions";
Appsdata.data = aau;
Appsdata.Types = types;
window.localStorage.setItem("Apps", JSON.stringify(Appsdata));
ajxj++;
checkData = HotelList
debugger
selfincinput(HotelList)
Add(ua, checkData);
})
}
});
let card_body =`
<div style="line-height:1;word-wrap:break-word;max-height:{{max-height}}px; padding:0 ; margin:0;" class="card-body table-responsive">
<table class="table table-head-fixed text-nowrap text-center" style="margin:0;border:none;">
<thead>
{{trthead}}
<thead>
<tbody>
{{tr}}
</tbody>
</table>
</div>
`
let defauletd = "<td class='text-{{hotelname}}' style=' padding:2px;' title='{{Desc}}'>{{Name}}</td>";
let seltd = "";
let tdtext = `
<td style="padding:2px;border:none;">
<span >
<select {{disabled}} checkdatax = "{{data-checkDatax}}" authoid="{{data-authoid}}" onchange="ChangeA(this);" hook = "{{hook}}" class="custom-select {{class}}" style="width:auto;padding:0px;border:none;margin:0;line-height:1;background:none;height:auto;">
{{option}}
</select>
</span>
</td>`
/// app复选框html、
let APPHTMLELIST = "";
function Add(aaus, checkData) {
if (!aaus) {
aaus = ua;
}
if (ajxj != 2)
return;
let opttext = ``;
if (@ViewBag.info.IsValid >= @ViewBag.Umodel.IsValid && @ViewBag.Umodel.Id != @ViewBag.info.Id) {
if (@ViewBag.Umodel.Id != '1') {
tdtext = tdtext.replace('{{disabled}}', 'disabled');
}
}
//console.log(checkData)
//types.forEach(x => {
// opttext = opttext + (`<option style="color:gray;padding:0px;height:auto;" {{` + x.Id + `}} value="` + x.Id + `">` + x.Name + `</option>`);
// })
// seltd = tdtext.replace("{{option}}", opttext);
let dnyc = $(".sloatdnyc");
if (!KP || KP == "")
KP = dnyc.html();
dnyc.html("");
aau.forEach(x => {
if (x.AppId == '3') {
return;
}
let gzapp = userAppInfo.indexOf(x.AppId) >= 0;
if ($('.APPinfo').html().length <= 0) {
//// 生成 app列表 复选框
APPHTMLELIST += `
<div class="col-6 col-lg-3">
<input type="checkbox" onchange="ChangeApp(this);" value="`+ x.AppId+`" `+ (gzapp == true ? `checked="checked"` : ``) +`>
<label>`+ x.AppName+`</label>
</div>
</div>
`;
}
if (!gzapp) {
return;
}
//总的tr
//统计权限
let uautp = [];
let aauautho = [];//记录第一行所有的权限id
let TD_bodytext = "";
let text = KP.replace("{{AppName}}", x.AppName)
.replace("{{AppId}}", x.AppId)
.replace("{{Desc}}", x.Desc)
.replace("{{AuthorSum}}", x.data.length ? 0 : x.data.length);
let trthead = "";
let trsum = "";
x.data.forEach(
y => {
aauautho.push(y);
trthead += "<th title='{{Desc}}' style=' box-sizing:border-box;padding:5PX;' > {{Name}} </th>".replace("{{Desc}}", y.Desc).replace("{{Name}}", y.AuthorityName)
})
trthead = "<th style='padding:0;'></th>" + trthead
//循坏选中的酒店信息
//记录列数
let wd = 0;
//checkData.forEach(
// checkDatax => {
BaseData.forEach(
y => {
y.forEach(z => {
debugger
console.log(z.Id)
let checkDatax = checkData.indexOf(z.Id);
if (checkDatax < 0)
return;
else
checkDatax = checkData[checkDatax];
if (z.Id == checkDatax) {
wd = (100 / (x.data.length + 1));
//trthead = trthead.replaceAll("{{width}}", wd);
//找到酒店名字
trsum += "<tr>" + defauletd.replace("{{Name}}", '<span class="PR">'+z.Name+'</span>').replace("{{Desc}}", z.Desc);
let issuccess = "gray";
aauautho.forEach(aauauthox => {
//判断权限状态
let uy = ua.filter(oax => {
return oax.AuthorityId == aauauthox.Id && checkDatax == oax.HotelId
}).length > 0 ? ua.filter(oax => {
return oax.AuthorityId == aauauthox.Id && checkDatax == oax.HotelId
})[0] : null;
// 添加统计
if (uy) {
let count = 1;
let newarr = uautp.filter(uautpx => { return uautpx.id == uy.AuthotypeId });
if (newarr.length > 0) {
count = newarr[0].count + 1;
uautp = uautp.filter(uautpxz => { return uautpxz.id != uy.AuthotypeId });
}
uautp.push({ id: uy.AuthotypeId, name: uy.AstName, count: count });
}
//下拉框 权限的下拉框
let seltypes = aauauthox.AuthoStatusTypeId.split(',');
opttext = '';
types.forEach(typesx => {
if (seltypes.indexOf(''+typesx.Id) >= 0)
opttext = opttext + (`<option style="color:gray;padding:0px;height:auto;" {{` + typesx.Id + `}} value="` + typesx.Id + `">` + typesx.Name + `</option>`);
})
seltd = tdtext.replace("{{option}}", opttext);
// 更改下拉框
let hook = "1";
let selAuthotypeId = "{{}}";
if (uy) {
selAuthotypeId = hook = uy.AuthotypeId
//有一个是选中就变色
if (uy.AuthotypeId!= '1') {
issuccess = "success";
}
}
trsum += seltd /*.replace("{{width}}",wd)*/.replace("{{class}}", (hook == 1 ? 'text-gray' : hook == 4 ? 'text-success' : 'text-info')).replace("{{data-checkDatax}}", checkDatax).replace("{{data-authoid}}", aauauthox.Id).replace("{{hook}}", hook).replace(`{{` + selAuthotypeId + `}}`, "selected").replace("{{hook}}", "0");
}
)
trsum = trsum.replace("{{hotelname}}", issuccess);
trsum += "</tr>";
}
})
}
)
//})
//权限数量统计显示
let qxtj = "";
let yycount = 0;
let wu = 0;
types.forEach(typesx => {
let sumcount = 0;
uautp.filter(uautpx => {
if (typesx.Id == uautpx.id) {
if (typesx.Id == 1) {
wu = uautpx.count
return;
}
sumcount = uautpx.count;
}
});
if (typesx.Id == 1) { return; }
yycount += sumcount
qxtj += typesx.Name + ":<span class=' text-info types" + typesx.Id + "'>" + sumcount + "</span>&nbsp;&nbsp;&nbsp;"
})
qxtj += "禁止:<span class='types1 text-gray'>" + (x.data.length * checkData.length - yycount + wu) + "</span>&nbsp;&nbsp;&nbsp;"
text = text.replace("{{card-body}}", card_body.replace("{{tr}}", trsum).replace("{{trthead}}", trthead)).replace("{{qxtj}}", qxtj);
if (checkData.length <= 0) {
text = text.replace("{{max-height}}", '50')
} else {
text = text.replace("{{max-height}}", '300')
}
dnyc.append(text);
})
if ($('.APPinfo').html().length <= 0) {
$('.APPinfo').html(APPHTMLELIST);
}
dnyc.show();
tableinit();
}
//分组 未使用
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 finc(arrys, selnum) {
let res = [];
arrys.forEach(x => {
if (x.ParentId == selnum) {
res.push(x.Id)
res = Array.from(res.concat(finc(arrys, x.Id)));
}
})
return res;
}
//更改权限 权限id
function ChangeA(that) {
//改变颜色
let hook = $(that).val();
hook = (hook == 1 || hook == 0 ? 'text-gray' : hook == 4 ? 'text-success' : 'text-info')
$(that).removeClass("text-gray").removeClass("text-success").removeClass("text-info").addClass(hook);
//权限id
let tditem = $(that).attr("authoid");
//酒店id
let datacheckDatax = $(that).attr("checkdatax");
let data = {
status: $(that).val(),
id: tditem,
type: 0,
hotels: datacheckDatax,
uid: "@ViewBag.info.Uid"
}
request("/Api/EditAuthoType", { ...data }).then(result => {
if (result.Status == 200) {
let selectlist = $(that).closest("tr").find("select")
//有一个选择就绿色 酒店
let issuccess = 0;
for (var x = 0; x < selectlist.length; x++) {
if ($(selectlist[x]).val() != 1) {
issuccess = 1;
$($(that).closest("tr").find("td").get(0)).removeClass("text-gray").addClass("text-success");
}
if (issuccess == 0) {
$($(that).closest("tr").find("td").get(0)).removeClass("text-success").addClass("text-gray");
}
}
//更改统计数量
let card = $(that).closest(".card").find(".qxtj");
let old = Number($(that).attr("hook"))
//原来的数量减去1
let jk = Number($(card).find(".types" + old).html())
jk--
$(card).find(".types" + old).html(
jk
);
//现在的数量加1
jk = Number($(card).find(".types" + $(that).val()).html());
jk++;
$(card).find(".types" + $(that).val()).html(
jk
);
//总权限数量
let num = $("#qxsl").html().replace("(", "").replace(")", "")
if (old == 1) {
num++;
} else {
if ($(that).val() == "1") {
num--;
}
}
$(that).attr("hook", $(that).val())
$("#qxsl").html("(" + num.toString() + ")")
$("#delnum").html(num.toString())
}
else {
error("保存失败!");
$(that).val($(that).attr("hook"))
}
},
err => {
error("保存失败!");
$(that).val($(that).attr("hook"))
//改变颜色
let hook = $(that).val();
hook = (hook == 1 ? 'text-gray' : hook == 4 ? 'text-success' : 'text-info')
$(that).removeClass("text-gray").removeClass("text-success").removeClass("text-info").addClass(hook);
})
}
</script>
<script>
function tableinit() {
$(".table").scroll(
function () {
}
);
}
/// 更关注的App
function ChangeApp(that) {
debugger
if (that.checked) {
userAppInfo.push(Number($(that).val()));
} else {
userAppInfo.forEach(function (item, index, arr) {
if (item === Number($(that).val())) {
userAppInfo.splice(index, 1);
}
});
}
Add(ua, checkData);
}
</script>
<style>
td:first-child, th:first-child {
position: sticky;
left: 0; /* 首行在左 */
z-index: 99 !important;
min-width: 150px;
background: #ffffff;
}
.PR {
width: 100px;
white-space: normal;
}
</style>

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>

111
UI/Views/Log/Index.cshtml Normal file
View File

@@ -0,0 +1,111 @@

@{
ViewBag.Title = "日志管理";
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
}
<div class="card">
<div class="card-header">
<h3 class="card-title">日志信息</h3>
</div>
<div class="card-body" id="cardbody" style="padding:5px;">
@* <div class="table-responsive">*@
<table class="table table-borderless" style="overflow:hidden;display:block;" id="dataTable">
<thead><tr><td></td></tr></thead>
<tbody style="overflow:hidden;display:block;width:100%;">
</tbody>
</table>
@* </div> *@
</div>
</div>
<script>
function ShowLog(that, content, client, location, ip) {
let s = $(that).find(".rowinfo");
let data = `<div class="rowinfo" style=" padding:5px; margin: 0; line-height: 1; "><div>内容:` + content + `</div><div>客户端:` + client + `</div> <div>地点:` + location + `</div><div>IP` + ip + `</div> </div>`;
if (s.length<=0) {
$(that).find('td').append(data);
return;
}
$($(s).get(0)).toggle()
};
</script>
<!-- DataTables & Plugins -->
<script src="~/Lib/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="~/Lib/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script>
$(function () {
$('#dataTable').DataTable({
"paging":true,
"serverSide": true,
"ajax": {
url: '/Api/GetLog',
type: 'POST'
},
//时间
//'searchDelay': 1000,
"autoWidth": false,
'aLengthMenu': [50,15,25, 35,], //设置每页显示记录的下拉菜单
"language": {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
,"columns": [
{
'sTitle': '',
'render': function (data, type, row) {
return `
<td class="info-box-content" style="padding: 0; margin: 0; line-height: 1; overflow: hidden;display:block;width:100%;">
<p style="margin:2px;margin:0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; /*控制在1行*/ -webkit-line-clamp:1; -webkit-box-orient: vertical; ">
`+row.Content+`
</p>
<p style="margin: 2px; margin: 0; ">
<span class="text-gray">
`+ row.Id + `
`+ Gotimestamp(row.CreateTime, true) +`
`+ row.Uid +`
`+ (row.Type == 0 ? "新增" : row.Type == 1 ? "更新" : "删除") + `
`+ (row.location == null ? "" : row.location) +`
</span>
</p>
</td>`
}
}
],
"fnCreatedRow": function (nRow, aData, iDataIndex) {
$(nRow).addClass('info-box');
$(nRow).attr('style', "overflow: hidden; display: block; width:100%;padding: 5px; margin: 5px 0; min-height: auto !important; line-height: 1; ");
$(nRow).click(
function () {
ShowLog(nRow, aData.Content, aData.Client, aData.location, aData.Ip);
}
)
}
});
})
</script>
<style>
</style>

118
UI/Views/Login/Index.cshtml Normal file
View File

@@ -0,0 +1,118 @@
@{
Layout = "~/Views/Shared/_LayoutLoginfo.cshtml";
ViewBag.Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޹<EFBFBD><DEB9><EFBFBD>ϵͳ";
}
<div class="row" id="content" style="box-sizing: border-box;">
<div class="col-md-4">
</div>
<div class="wrapper col-md-4" style="padding:0">
<img src="~/Lib/dist/img/logo.png" style=" margin: 10px; margin-left:20%; max-width:60%; text-align: center; " />
<div class="card card-secondary ">
<div class="card-header bg-info">
<h3 class="card-title">@ViewBag.Title</h3>
</div>
<form>
<div class="card-body">
<div class="form-group">
<label for="Uid"><3E>û<EFBFBD><C3BB><EFBFBD></label>
<input type="text" class="form-control" id="Uid" autocomplete="off" placeholder="<22><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>">
</div>
<div class="form-group">
<label for="Pwd"><3E><><EFBFBD><EFBFBD></label>
<input type="password" autocomplete="new-password" class="form-control" id="Pwd" placeholder="<22><><EFBFBD><EFBFBD>">
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck2">
<label class="form-check-label" for="exampleCheck2"><3E><>ס<EFBFBD><D7A1></label>
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-4">
<button type="button" onclick="GoLogin()" id="GoLoginbtn" class="btn btn-success "><3E><>¼</button>
</div>
<div class="col-4 "></div>
<div class="col-4 text-right">
<button type="button" onclick="loginBtn_click(false)" class="btn btn-warning"><3E><><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD></button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="col-md-4"></div>
<div style="z-index: 1000; background: #f5f5f5; width: 100vw; padding:10px 0; text-align: center; bottom:0px; ">
<a target="_blank" style="height: 24px; line-height: 24px; color: #666; " href="https://beian.miit.gov.cn/"><3E><>ICP<43><50>2020111566<36><36>-2</a>
</div>
</div>
<script src="~/Scripts/jsencrypt.js"></script>
<script>
$(document).ready(function () {
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
document.onkeydown = function (e) {
if (!e) e = window.event;
if ((e.keyCode || e.which) == 13) {
GoLogin();
}
}
var strName = localStorage.getItem('keyName');
var strPass = localStorage.getItem('keyPass');
if (strName) {
$('#Uid').val(strName);
} if (strPass) {
$('#Pwd').val(strPass);
}
});
//<2F><><EFBFBD><EFBFBD>
$("body").css("margin-top", (($(window).height() / 4) - ($("#content").height() / 2)) < 0 ? 0 : (($(window).height() / 4) - ($("#content").height() / 2)) + "px");
function GoLogin() {
$("#GoLoginbtn").attr("disabled", "disabled");
let Uid = $("#Uid").val();
let Pwd = $("#Pwd").val();
var encryptor = new JSEncrypt() // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>ʵ<EFBFBD><CAB5>
var pubKey = '@ViewBag.publicYS'
encryptor.setPublicKey(pubKey)//<2F><><EFBFBD>ù<EFBFBD>Կ
var rsaPassWord = encryptor.encrypt(Pwd)
$.ajax({
url: "/Login/AuthorityLogin",
type: 'post',
dataType: 'json',
timeout: 10000,
data: { Uid, Pwd: rsaPassWord },
success: function (res) {
if (res.Status != 200) {
$("#GoLoginbtn").removeAttr("disabled");
error(res.Message);
}
else {
success('<27><>¼<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>')
loginBtn_click()
location.href = "/"
}
},
error: function (jqxhr, textStatus, errorThrow) { $("#GoLoginbtn").removeAttr("disabled");error("<22><><EFBFBD>緱æ~"); },
statusCode: {
404: function () { console.log('not found'); },
500: function () { console.log('error by server'); },
}
})
return false;
}
//<2F><>¼<EFBFBD><C2BC>Ϣ
function loginBtn_click(s) {
var strName = $('#Uid').val();
var strPass = $('#Pwd').val();
if ($('#exampleCheck2').is(':checked') && s != false) {
localStorage.setItem('keyName', strName);
localStorage.setItem('keyPass', strPass);
} else {
localStorage.removeItem('keyName');
localStorage.removeItem('keyPass');
success('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>')
}
}
</script>

374
UI/Views/Org/Index.cshtml Normal file
View File

@@ -0,0 +1,374 @@
@{
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
ViewBag.Title = "<22>û<EFBFBD><C3BB><EFBFBD>Ȩ<EFBFBD>޹<EFBFBD><DEB9><EFBFBD>";
}
<style>
td:first-child, th:first-child {
position: sticky;
left: 0; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
z-index: 99 !important;
min-width: 150px;
background: #ffffff;
}
.PR {
width: 100px;
white-space: normal;
}
</style>
<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.OrgName</span> Ȩ<><C8A8>һ<EFBFBD><D2BB><span id="qxsl"></span></h5>
</li>
<li class="nav-item">
<button id="seljd" style="margin-top:5px;" data-widget="control-sidebar" data-slide="true" class="btn btn-info btn-xs"><3E>Ƶ<EFBFBD><C6B5><EFBFBD>Ȩ</button>
</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.SelectOrg==1?"disabled":"")">ɾ<><C9BE></button>
</li>
</ul>
</div>
<div class="card-body" id="cardbody" style=" padding:0">
<div class="card card-gray" style="margin-bottom: 0px;">
<div class="card-header" style="padding:1px 10px;">
<a style="line-height:1;">Ȩ<><C8A8><EFBFBD><EFBFBD>Ϣ</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">
<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="{{AppId}}" style="line-height: 1; display: block; color: black;" class=" text-bold">{{AppName}}</a>
<span class="text-gray" style=" margin:0;line-height:1;">
<20><><EFBFBD><EFBFBD>:<span class="text-info " style=" line-height: 1;">{{Desc}}</span>
&nbsp;&nbsp;&nbsp;&nbsp;
Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<span class="text-red" style="line-height: 1;">{{AuthorSum}}</span>
</span>
<span class="text-gray qxtj" style="display:block; margin:0;line-height:1;padding:0;">
{{qxtj}}
</span>
</div>
{{card-body}}
</div>
</slot>
</div>
</div>
</div>
</div>
<script>
let HotelList = @(ViewBag.HotelList??0);
let oa, KP, aau,types;
let ajxj = 0;
let request = (url, params = {}, method = "Post") => {
return new Promise((resolve, reject) => {
$.ajax({
type: method,
url: url,
cache: false, //<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
data: params, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
dataType: "json",
success: function (result) {
resolve(result);
},
error: function (res) {
reject(res)
}
});
})
}
$(function () {
request("/Api/GetOrgAutho", { OrgId: "@ViewBag.SelectOrg" }).then(result => {
oa = result.Data
//$("#orgingo").html("-" + uoa[0].OrganizationName);
$("#qxsl").html("(" +oa.length+")");
ajxj++;
checkData = HotelList
selfincinput(HotelList)
Add(aau, checkData);
})
request("/Api/GetApps", { }).then(result => {
aau = result.Data.Appinfos
types = result.Data.Types
ajxj++;
checkData = HotelList
selfincinput(HotelList)
Add(aau, checkData);
})
});
let card_body = `
<div style="line-height:1;word-wrap:break-word;max-height:{{max-height}}px; padding:0 ; margin:0;" class="card-body table-responsive">
<table class="table table-head-fixed text-nowrap text-center" style="margin:0;border:none;">
<thead>
{{trthead}}
<thead>
<tbody>
{{tr}}
</tbody>
</table>
</div>
`
let defauletd = "<td class='text-{{hotelname}}' style=' padding:2px;' title='{{Desc}}'>{{Name}}</td>";
let seltd = "";
let tdtext = `
<td style="padding:2px;border:none;">
<span >
<select {{disabled}} checkdatax = "{{data-checkDatax}}" authoid="{{data-authoid}}" onchange="ChangeA(this);" hook = "{{hook}}" class="custom-select {{class}}" style="width:auto;padding:0px;border:none;margin:0;line-height:1;background:none;height:auto;">
{{option}}
</select>
</span>
</td>`
function Add(aaus, checkData) {
if (!aaus) {
aaus = oa;
}
if (ajxj < 2)
return;
let opttext = ``;
//types.forEach(x => {
// opttext = opttext + (`<option style="color:gray;padding:0px;height:auto;" {{` + x.Id + `}} value="` + x.Id + `">` + x.Name + `</option>`);
// })
// seltd = tdtext.replace("{{option}}", opttext);
let dnyc = $(".sloatdnyc");
if (!KP || KP == "")
KP = dnyc.html();
dnyc.html("");
aau.forEach(x => {
if (x.AppId == '3') {
return;
}
//<2F>ܵ<EFBFBD>tr
//ͳ<><CDB3>Ȩ<EFBFBD><C8A8>
let uautp = [];
let aauautho = [];//<2F><>¼<EFBFBD><C2BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>Ȩ<EFBFBD><C8A8>id
let TD_bodytext = "";
let text = KP.replace("{{AppName}}", x.AppName)
.replace("{{AppId}}", x.AppId)
.replace("{{Desc}}", x.Desc)
.replace("{{AuthorSum}}", x.data.length ? 0 : x.data.length);
let trthead = "";
let trsum = "";
x.data.forEach(
y => {
aauautho.push(y);
trthead += "<th title='{{Desc}}' style=' box-sizing:border-box;padding:5PX;' > {{Name}} </th>".replace("{{Desc}}", y.Desc).replace("{{Name}}", y.AuthorityName)
})
trthead = "<th style='padding:0;'></th>" + trthead
//ѭ<><D1AD>ѡ<EFBFBD>еľƵ<C4BE><C6B5><EFBFBD>Ϣ
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
let wd = 0;
checkData.forEach(
checkDatax => {
BaseData.forEach(
y => {
y.forEach(z => {
debugger
if (z.Id == checkDatax) {
wd = (100 / (x.data.length + 1));
//trthead = trthead.replaceAll("{{width}}", wd);
//<2F>ҵ<EFBFBD><D2B5>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>
trsum += "<tr>" + defauletd.replace("{{Name}}", '<span class="PR">'+z.Name+'</span>').replace("{{Desc}}", z.Desc);
let issuccess = "gray";
aauautho.forEach(aauauthox => {
//<2F>ж<EFBFBD>Ȩ<EFBFBD><C8A8>״̬
let uy = aaus.filter(oax => {
return oax.AuthorityId == aauauthox.Id && checkDatax == oax.HotelId
}).length > 0 ? aaus.filter(oax => {
return oax.AuthorityId == aauauthox.Id && checkDatax == oax.HotelId
})[0] : null;
// <20><><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
if (uy) {
let count = 1;
let newarr = uautp.filter(uautpx => { return uautpx.id == uy.AuthotypeId });
if (newarr.length > 0) {
count = newarr[0].count + 1;
uautp = uautp.filter(uautpxz => { return uautpxz.id != uy.AuthotypeId });
}
uautp.push({ id: uy.AuthotypeId, name: uy.AstName, count: count });
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ȩ<>޵<EFBFBD><DEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
let seltypes = aauauthox.AuthoStatusTypeId.split(',');
opttext = '';
types.forEach(typesx => {
if (seltypes.indexOf(''+typesx.Id) >= 0)
opttext = opttext + (`<option style="color:gray;padding:0px;height:auto;" {{` + typesx.Id + `}} value="` + typesx.Id + `">` + typesx.Name + `</option>`);
})
seltd = tdtext.replace("{{option}}", opttext);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
let hook = "1";
let selAuthotypeId = "{{}}";
if (uy) {
selAuthotypeId = hook = uy.AuthotypeId
//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ѡ<EFBFBD>оͱ<D0BE>ɫ
if (uy.AuthotypeId!= '1') {
issuccess = "success";
}
}
trsum += seltd /*.replace("{{width}}",wd)*/.replace("{{class}}", (hook == 1 ? 'text-gray' : hook == 4 ? 'text-success' : 'text-info')).replace("{{data-checkDatax}}", checkDatax).replace("{{data-authoid}}", aauauthox.Id).replace("{{hook}}", hook).replace(`{{` + selAuthotypeId + `}}`, "selected").replace("{{hook}}", "0");
}
)
trsum = trsum.replace("{{hotelname}}", issuccess);
trsum += "</tr>";
}
})
}
)
})
//Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>ʾ
let qxtj = "";
let yycount = 0;
let wu = 0;
types.forEach(typesx => {
let sumcount = 0;
uautp.filter(uautpx => {
if (typesx.Id == uautpx.id) {
if (typesx.Id == 1) {
wu = uautpx.count
return;
}
sumcount = uautpx.count;
}
});
if (typesx.Id == 1) { return; }
yycount += sumcount
qxtj += typesx.Name + ":<span class=' text-info types" + typesx.Id + "'>" + sumcount + "</span>&nbsp;&nbsp;&nbsp;"
})
qxtj += "<22><>ֹ:<span class='types1 text-gray'>" + (x.data.length * checkData.length - yycount + wu) + "</span>&nbsp;&nbsp;&nbsp;"
text = text.replace("{{card-body}}", card_body.replace("{{tr}}", trsum).replace("{{trthead}}", trthead)).replace("{{qxtj}}", qxtj);
if (checkData.length <= 0) {
text = text.replace("{{max-height}}", '50')
} else {
text = text.replace("{{max-height}}", '300')
}
dnyc.append(text);
})
dnyc.show();
}
//<2F><><EFBFBD><EFBFBD> δʹ<CEB4><CAB9>
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;
}
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8> Ȩ<><C8A8>id
function ChangeA(that) {
//Ȩ<><C8A8>id
let tditem = $(that).attr("authoid");
//<2F>Ƶ<EFBFBD>id
let datacheckDatax = $(that).attr("checkdatax");
let data = {
status: $(that).val(),
id: tditem,
type: 1,
hotels: datacheckDatax,
uid: "@ViewBag.SelectOrg"
}
request("/Api/EditAuthoType", { ...data }).then(result => {
if (result.Status == 200) {
let selectlist = $(that).closest("tr").find("select")
//<2F><>һ<EFBFBD><D2BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ <20>Ƶ<EFBFBD>
let issuccess = 0;
for (var x = 0; x < selectlist.length;x++) {
if ($(selectlist[x]).val() != 1) {
issuccess = 1;
$($(that).closest("tr").find("td").get(0)).removeClass("text-gray").addClass("text-success");
}
if (issuccess == 0) {
$($(that).closest("tr").find("td").get(0)).removeClass("text-success").addClass("text-gray");
}
}
//<2F><><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
let card = $(that).closest(".card").find(".qxtj");
let old = Number($(that).attr("hook"))
let jk = Number($(card).find(".types" + old).html())
jk--
$(card).find(".types" + old).html(
jk
);
jk = Number($(card).find(".types" + $(that).val()).html());
jk++;
$(card).find(".types" + $(that).val()).html(
jk
);
//<2F><>¼<EFBFBD><C2BC>ǰѡ<C7B0><D1A1>
$(that).attr("hook", $(that).val())
num = $("#qxsl").html().replace("(", "").replace(")", "")
if (old == 1) {
num++;
} else {
if ($(that).val() == "1") {
num--;
}
}
//<2F><><EFBFBD><EFBFBD>ɫ
let colortext = ($(that).val() == 1 || $(that).val() == 0 ? 'text-gray' : $(that).val() == 4 ? 'text-success' : 'text-info')
$(that).removeClass("text-gray").removeClass("text-info").removeClass("text-success").addClass(colortext);
$("#qxsl").html("(" + num.toString() + ")")
$("#delnum").html(num.toString())
}
else {
error("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!");
$(that).val($(that).attr("hook"))
}
},
err => {
error("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!");
$(that).val($(that).attr("hook"))
})
}
function Delzz() {
if (@ViewBag.SelectOrg == 1)
error("Ĭ<><C4AC><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>޷<EFBFBD>ɾ<EFBFBD><C9BE>~");
else
$("#modaldangerbtn").click();
}
function ResDel() {
$("#closebtn").click();
request("/Api/DelOrg", { OrgId:@ViewBag.SelectOrg}).then(
res => {
if (res.Status == 200) {
success("ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>");
location.href = "/";
}
else
error("ɾ<><C9BE>ʧ<EFBFBD><CAA7>");
}
)
}
</script>
<div class="modal fade " id="modal-danger">
<div class="modal-dialog">
<div class="modal-content bg-danger">
<div class="modal-header" style="padding-top: 0; padding-bottom: 0;">
<h5 class="modal-title">@ViewBag.OrgName</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="closebtn">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
<p><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><span id="delnum"></span><3E><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>Ƶ<EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棡</p>
</div>
<div class="modal-footer justify-content-between" style="padding-top: 0; padding-bottom: 0;">
<button type="button" class="btn btn-outline-light btn-xs" data-dismiss="modal"><3E>ر<EFBFBD></button>
<button type="button" class="btn btn-outline-light btn-xs" onclick="ResDel()">ȷ<><C8B7>ɾ<EFBFBD><C9BE></button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width" />
<title>错误</title>
</head>
<body>
<hgroup>
<h1>错误。</h1>
<h2>处理你的请求时出错。</h2>
</hgroup>
</body>
</html>

View File

@@ -0,0 +1 @@
@RenderBody()

View File

@@ -0,0 +1,832 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<!-- ???? Google ????: Source Sans Pro -->
<!--<link rel="stylesheet" href="/Lib/dist/css/google.css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">-->
<!-- Font Awesome -->
<link rel="stylesheet" href="/Lib/plugins/fontawesome-free/css/all.min.css">
<!-- ??????? -->
<!--<link rel="stylesheet" href="/Lib/dist/css/adminlte.min.css">-->
<!-- jQuery -->
<!--<script src="/Lib/plugins/jquery/jquery.min.js"></script>-->
<!-- Bootstrap 4 -->
<!--<script src="/Lib/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>-->
<!-- SweetAlert2 -->
<!--<script src="/Lib/plugins/sweetalert2/sweetalert2.min.js"></script>-->
<!-- Toastr -->
<!--<link rel="stylesheet" href="/Lib/plugins/toastr/toastr.min.css">-->
<!-- SweetAlert2 -->
<!--<link rel="stylesheet" href="/Lib/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">-->
<!-- Toastr -->
<!--<link rel="stylesheet" href="/Lib/plugins/toastr/toastr.min.css">-->
<!-- bs-custom-file-input -->
<!--<script src="/Lib/plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>-->
<!-- AdminLTE App -->
<!--<script src="/Lib/dist/js/adminlte.min.js"></script>
<script src="/Lib/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/Lib/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>-->
@Styles.Render("~/Lib/plugins/pluginscss")
@Styles.Render("~/Lib/dist/css/distcss")
@Scripts.Render("~/bundles/clientfeaturesscripts")
@RenderSection("scripts", required: false)
<style>
* {
font-size: 14px;
}
</style>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<!-- Site wrapper -->
<div class="wrapper">
<!-- 导航栏 -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- 左侧导航栏链接 -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" style="padding: 0 5px;display:initial;" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
<a class="nav-link" style="padding: 0 5px; display: initial; " href="/" role="button">首页</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<!-- Navbar Search -->
<li class="nav-item" style="color:#999c9e;">
<a href="javascript:window.history.back();">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-reply-fill" viewBox="0 0 16 16">
<path d="M5.921 11.9 1.353 8.62a.719.719 0 0 1 0-1.238L5.921 4.1A.716.716 0 0 1 7 4.719V6c1.5 0 6 0 7 8-2.5-4.5-7-4-7-4v1.281c0 .56-.606.898-1.079.62z"></path>
</svg>
</a>
</li>
<li class="nav-item" style="color:#999c9e;">
<a class="nav-link" href="#" role="button">欢迎您,<strong>@ViewBag.Umodel.Uid</strong></a>
</li>
<li class="nav-item">
<span class="nav-link">
@*<button onclick="Clear(this)" class="btn btn-info btn-xs" id="global_refreshall_button">
@if (Services.Manager.GlobalTest.isInProcessing)
{
<span>同步中...</span>
}
else
{
<span>同步数据</span>
}
</button>*@
<button onclick="ClearAllCache(this)" class="btn btn-info btn-xs">清楚缓存</button>
<button onclick="ClearAll(this)" class="btn btn-info btn-xs">同步数据</button>
</span>
<span>现在时间:
@*最近更新时间:*@
</span>
<br />
<span id="global_refreshall_button_time">
@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
@*@Services.Manager.SyncAllFromOutterDB.GlobalSyncLockTest.lastStartTime*@
</span>
</li>
<li class="nav-item">
<a class="nav-link" href="/Login/Logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 0-1 0v2A1.5 1.5 0 0 0 6.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-8A1.5 1.5 0 0 0 5 3.5v2a.5.5 0 0 0 1 0v-2z"></path>
<path fill-rule="evenodd" d="M11.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H1.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"></path>
</svg>
</a>
</li>
</ul>
</nav>
<!-- /.navbar -->
<!-- 主侧边栏容器 -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- 品牌 Logo -->
<a href="#" class="link-black text-center">
<img src="~/Lib/dist/img/logo.png" alt="AdminLTE Logo" style="max-width:80%;margin:0 10%" class="img-circle elevation-3">
<p class="brand-text font-weight-light text-white" style="margin:10px 0 0 0 ;">宝来威权限管理系统</p>
</a>
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image">
<img data-src="/ImgServer/FileImage?url=@ViewBag.Umodel.HeadImg&&ftp=11" src="/Lib/dist/img/more.jpg" class="img-circle elevation-2" alt="用户头像">
</div>
<div class="info">
<a href="#" class="d-block">@ViewBag.Umodel.Uid</a>
</div>
</div>
<!-- SidebarSearch Form -->
<div class="form-inline">
<div class="input-group" data-widget="sidebar-search">
<input class="form-control form-control-sidebar" type="search" placeholder="搜索" aria-label="Search">
<div class="input-group-append">
<button class="btn btn-sidebar">
<i class="fas fa-search fa-fw"></i>
</button>
</div>
</div>
</div>
<!-- 侧边栏菜单 -->
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<!-- 使用 .nav-icon 类添加图标,
或使用 font-awesome 或其他任何图标字体库 -->
<li class='nav-item '>
<a href="/home/index" class="nav-link @(ViewBag.Select == 0 ? "active":"")">
<i class="nav-icon fas fa-user"></i>
<p>
用户管理
<span class="badge badge-info right">@ViewBag.Usersum</span>
</p>
</a>
</li>
<li class="nav-item @(ViewBag.Select == 1 ? "menu-open ":"")">
<a class="nav-link">
<i class="nav-icon fas fa-users"></i>
<p>
用户组管理
<span class="badge badge-info right">@ViewBag.Orgs.Count</span>
</p>
</a>
<ul class="nav nav-treeview">
@foreach (var item in ViewBag.Orgs)
{
<li class="nav-item">
<a href="/Org/Index/@item.Id" class="nav-link @(item.Id == ViewBag.SelectOrg ? "active" : "")">
<span style="padding-left:15px" class="left badge">@item.Id</span>
<p>@item.OrganizationName</p>
if(item.IsDefault == 1)
{
<span class="right badge badge-danger">默</span>
}
</a>
</li>
}
<li>
<a onclick="AddOrg()" class="nav-link">
<span style="padding-left:15px;opacity:0" class="left badge"></span>
<p style="padding-left:15px;">添加用户组</p>
</a>
</li>
</ul>
</li>
<li class="nav-item @(ViewBag.Select == 2 ? "menu-open ":"")">
<a class="nav-link">
<i class="nav-icon fas fa-copy"></i>
<p>
应用管理
<span class="badge badge-info right">@ViewBag.Apps.Count</span>
</p>
</a>
<ul class="nav nav-treeview">
@foreach (var item in ViewBag.Apps)
{
<li class="nav-item">
<a href="/App/Index/@item.Id" class="nav-link @(item.Id == ViewBag.SelectApp ? "active":"") @(item.IsValid==1?"text-gray":"")">
<span style="padding-left:15px" class="left badge">@item.Id</span>
<p class=""> @item.AppName</p>
</a>
</li>
}
<li>
<a onclick="AddApp()" class="nav-link">
<p style="padding-left:15px;">添加应用</p>
</a>
</li>
</ul>
</li>
<li class="nav-item @(ViewBag.Select == 3 ? "menu-open ":"")">
<a class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-building" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M14.763.075A.5.5 0 0 1 15 .5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V14h-1v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V10a.5.5 0 0 1 .342-.474L6 7.64V4.5a.5.5 0 0 1 .276-.447l8-4a.5.5 0 0 1 .487.022zM6 8.694 1 10.36V15h5V8.694zM7 15h2v-1.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15h2V1.309l-7 3.5V15z"></path>
<path d="M2 11h1v1H2v-1zm2 0h1v1H4v-1zm-2 2h1v1H2v-1zm2 0h1v1H4v-1zm4-4h1v1H8V9zm2 0h1v1h-1V9zm-2 2h1v1H8v-1zm2 0h1v1h-1v-1zm2-2h1v1h-1V9zm0 2h1v1h-1v-1zM8 7h1v1H8V7zm2 0h1v1h-1V7zm2 0h1v1h-1V7zM8 5h1v1H8V5zm2 0h1v1h-1V5zm2 0h1v1h-1V5zm0-2h1v1h-1V3z"></path>
</svg>
<p>
酒店组管理
@for (int i = 0, j = 0; i < ViewBag.HoteldGroupsinfo.Count; i++)
{
j += ViewBag.HoteldGroupsinfo[i].Message ;
if (i == ViewBag.HoteldGroupsinfo.Count - 1)
{
<span class="right badge badge-info">@j</span>
}
}
</p>
</a>
<ul class="nav nav-treeview">
@foreach (var item in ViewBag.HoteldGroups)
{
<li class="nav-item">
<a href="/Hotel/Index/@item.Id" class="nav-link @(item.Id == ViewBag.SelHoteldGroup ? "active":"")">
<span style="padding-left:15px" class="left badge">@item.Id</span>
<p>@item.Name</p>
@foreach (var items in ViewBag.HoteldGroupsinfo)
{
if (items.Status == item.Id)
{
<span class="right badge badge-info">@items.Message</span>
}
}
</a>
</li>
}
</ul>
</li>
<li class='nav-item '>
<a href="/log/Index" class="nav-link @(ViewBag.Select == 4 ? "active":"")">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-tools" viewBox="0 0 16 16">
<path d="M1 0 0 1l2.2 3.081a1 1 0 0 0 .815.419h.07a1 1 0 0 1 .708.293l2.675 2.675-2.617 2.654A3.003 3.003 0 0 0 0 13a3 3 0 1 0 5.878-.851l2.654-2.617.968.968-.305.914a1 1 0 0 0 .242 1.023l3.356 3.356a1 1 0 0 0 1.414 0l1.586-1.586a1 1 0 0 0 0-1.414l-3.356-3.356a1 1 0 0 0-1.023-.242L10.5 9.5l-.96-.96 2.68-2.643A3.005 3.005 0 0 0 16 3c0-.269-.035-.53-.102-.777l-2.14 2.141L12 4l-.364-1.757L13.777.102a3 3 0 0 0-3.675 3.68L7.462 6.46 4.793 3.793a1 1 0 0 1-.293-.707v-.071a1 1 0 0 0-.419-.814L1 0zm9.646 10.646a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708zM3 11l.471.242.529.026.287.445.445.287.026.529L5 13l-.242.471-.026.529-.445.287-.287.445-.529.026L3 15l-.471-.242L2 14.732l-.287-.445L1.268 14l-.026-.529L1 13l.242-.471.026-.529.445-.287.287-.445.529-.026L3 11z"></path>
</svg>
<p>
日志
<span class="right badge badge-info">@ViewBag.logsum</span>
</p>
</a>
</li>
</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. 包含页面内容 -->
<div class="content-wrapper">
<section class="content" style="padding:0;">
<div class="container-fluid">
<div class="row">
<div class="col-md-10">
@RenderBody()
</div>
<div class="col-md-2">
</div>
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>版本</b> 1.0
</div>
<strong>Copyright &copy; 2021 <a href="/">宝来威</a>.</strong> 保留所有权利。
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- 控制侧边栏内容在这里 -->
</aside>
<!-- /.control-sidebar -->
</div>
<button data-toggle="modal" data-target="#modal-Addoeg" id="addOrgsbtn" style="display:none;"></button>
<div class="modal fade" id="modal-Addoeg">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content ">
<div class="modal-header" style="padding-top: 0; padding-bottom: 0;">
<h5 class="modal-title" id="modal-title">添加用户组</h5>
<button type="button" class="close " data-dismiss="modal" aria-label="Close" id="Addorgclosebtn">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
<div class="input-group input-group-sm " style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat text-red">名称</button>
</span>
<input type="text" onblur="CheckOrg(this)" placeholder="请输入名字" class="form-control" style="border:none;" id="orgname" />
</div>
<div class="input-group input-group-sm appshow " style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat ">类型</button>
</span>
<select class="form-control AppType">
<option value="0">web应用</option>
<option value="0">桌面程序</option>
</select>
</div>
<div class="input-group input-group-sm appshow" style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat ">版本</button>
</span>
<input type="text" placeholder="1.0" class="form-control Version " style="border:none;" />
</div>
<div class="input-group input-group-sm" style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat ">发行日期</button>
</span>
<input type="text" placeholder="@DateTime.Now.ToString("yyyy-MM-d")" class="form-control ReleaseDate" style="border:none;" />
</div>
<div class="input-group input-group-sm" style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat">描述</button>
</span>
<input type="text" placeholder="描述" class="form-control " style="border:none;" id="Desc" />
</div>
<div class="input-group input-group-sm appshow" style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat">网址</button>
</span>
<input type="text" placeholder="网址" class="form-control WebSite" style="border:none;" />
</div>
<div class="input-group input-group-sm appshow" style="margin:5px 0px;">
<span class="input-group-append">
<button type="button" class="btn btn-flat">图标</button>
</span>
<div class="custom-file">
<input type="file" onchange="uploadimgicon()" class=" custom-file-input" accept="image/*" id="exampleInputFile">
<label class="custom-file-label" for="exampleInputFile"></label>
</div>
<div class="input-group-append">
<span class="input-group-text bg-success" id="btnup" onclick="uploadimgicon(1)">上传</span>
</div>
</div>
<div style=" height: 85px; overflow: hidden;">
<img class="image" style="width: 85px;padding:2px;display:none;" id="imagesapp" src="" data-src="">
</div>
</div>
<div class="modal-footer justify-content-between" style="padding-top: 0; padding-bottom: 0;">
<button type="button" class="btn btn-danger btn-xs" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-success btn-xs" id="ResAddorgbtn" disabled onclick="ResAddorg()">确定添加</button>
</div>
</div>
</div>
</div>
<script>
let appicon = "";
//app图标检测
function uploadimgicon(type) {
let files = $("#exampleInputFile").prop("files");
if (files.length <= 0)
return;
$("#exampleInputFile").closest(".input-group").find("label").html(files[0].name);
let img = new FileReader();
img.readAsDataURL(files[0])
img.onload = function () {
let imgdata = this.result
$("#imagesapp").attr('src', imgdata).show()
}
uploadicon(type);
}
//app图标上传
function uploadicon(type) {
if (type != 1)
return;
let file = $('#exampleInputFile')[0].files[0];
let name = $("#exampleInputFile").attr('data-old');
if (!file) {
error('无文件!')
return;
}
if (name == file.name) {
error('文件已上传!')
return;
}
if ((file.size/1024) > (1024 * 1)) {
error("图片大小不得超过4M");
return;
}
//let blob = dataURLtoFile(imgBase, 'image/jpeg');
var formData = new FormData() //创建一个forData
formData.append('img', file) //把file添加进去 name命名为img
$.ajax({
url: "/ImgServer/UpdateIcon",
data: formData,
type: "POST",
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
//成功\
if (data == "") {
error("上传失败!");
return;
}
$("#exampleInputFile").attr('data-old', file.name);
success("上传成功!")
appicon = data;
setTimeout(() => {
$("#imagesapp").attr('src', "/ImgServer/FileImage?ftp=app&&url=" + data).show()
},100);
},
error: function () {
error("上传失败!");
}
})
}
$(
function () {
BaseDataInit()
}
);
function BaseDataInit() {
BaseData = JSON.parse($("#BaseData").val());
BaseDataGroups = JSON.parse($("#BaseDataGroups").val());
let resdata = resback(BaseDataGroups, BaseData)
$("#BaseDataGroups").remove()
$("#BaseData").remove()
$("#rightcard").html("");
$("#rightcard").html(resdata);
}
//酒店组数据
let BaseDataGroups = [];
//酒店数据
let BaseData = [];
//酒店选择
let checkData = [];
let timer;
function ChecK(data, Group, that) {
debugger
//父亲 节点的单选按钮
let biggroup = $(that).closest(".nav").closest(".card").children(".card-header").find(".form-check-input");
//获取兄弟级别组
let checklist = $(that).closest(".nav").children(".nav-item").children(".card").children(".card-header").find(".form-check-input");
let okchecked = 0;
//验证兄弟组
for (var i = 0; i < checklist.length; i++) {
if (!$(checklist[i]).prop("checked")) {
okchecked++;
};
}
if (okchecked == 0) {
//$(biggroup).children(".card-header").find(".form-check-input").prop("checked", true)
//获取兄弟级别 酒店
checklist = $(that).closest(".nav").children(".nav-item").children(".nav-link").find(".form-check-input")
for (var i = 0; i < checklist.length; i++) {
if (!$(checklist[i]).prop("checked")) {
okchecked++;
};
}
}
if (data != '0' && Group == '0') {
if ($(that).prop("checked")) {
debugger
if (checkData.indexOf(data) < 0)
checkData.push(data);
if (okchecked == 0) {
//如何兄弟酒店和酒店组都选中就全勾选父元素
$(biggroup).prop("checked", true)
$(biggroup).change();
}
}
else {
checkData.splice(jQuery.inArray(data, checkData), 1);
$(biggroup).prop("checked", false)
$(biggroup).change();
}
}
function fincinput() {
checkData = [];
let s = $("#rightcard").find(".nav-link").children(".form-check").children(".form-check-input");
for (var i = 0; i < s.length; i++) {
let id = $(s.get(i)).attr("data-id");
if ($(s.get(i)).prop("checked")) {
if (checkData.indexOf(id) < 0) {
checkData.push(id)
}
else {
checkData.splice(checkData.indexOf(id), 1)
}
}
}
}
if ($(that).prop("checked")) {
if ((data == '0' && Group != '0')) {
////本身还有他的子都会选中
$(that).closest(".card").find(".form-check-input").prop("checked", $(that).prop("checked"));
}
if (okchecked == 0) {
//如何兄弟酒店和酒店组都选中就全勾选父元素
$(biggroup).prop("checked", true)
$(biggroup).change();
}
}
else {
$(biggroup).prop("checked", $(that).prop("checked"));
$(biggroup).change();
//判断是模拟事件还是真实点击事件
if ($(that).attr("data-on")==1) {
//真实点击事件
$(that).closest(".card").find(".form-check-input").prop("checked", $(that).prop("checked"));
}
}
$(that).attr("data-on", "0")
clearTimeout(timer);
timer = null;
timer = setTimeout(
function () {
fincinput()
Add(aau ? null : aau, checkData);
},500
)
}
function Clickdataon(that) {
$(that).attr("data-on", "1");
}
function resback(BaseDataGroups, BaseData, id = 1) {
let res = $("#rightcard").html();
let resli = '';
let li = `<li class="nav-item" style="padding:10.5px 17.5px;">
<a href="#" class="nav-link">
<div class="form-check">
<input {{disabled}} data-id ="{{data-id}}" onchange = "ChecK('{{id}}',0,this)" class="form-check-input" type="checkbox">
<label class="form-check-label">{{Name}}</label>
</div>
</a>
</li>`;
BaseDataGroups.forEach(
x => {
if (x.Id != id) { return; }
res = res.replace("{{card-title}}", x.Name).replace("{{id}}", x.Id);
BaseData.forEach(
y => {
if (y[0].GroupId == x.Id) {
y.forEach(
z => {
if (z.IsApprove == 0)
resli += li.replace("{{Name}}", z.Name).replace("{{id}}", x.Id).replace('{{disabled}}', 'disabled').replace("{{data-id}}", z.Id);
else
resli += li.replace("{{Name}}", z.Name).replace("{{id}}", x.Id).replace("{{data-id}}", z.Id);
}
)
}
}
)
BaseDataGroups.forEach(
a => {
if (a.ParentId == x.Id) {
resli += li.replace(`<a href="#" class="nav-link">
<div class="form-check">
<input {{disabled}} data-id ="{{data-id}}" onchange = "ChecK('{{id}}',0,this)" class="form-check-input" type="checkbox">
<label class="form-check-label">{{Name}}</label>
</div>
</a>`, resback(BaseDataGroups, BaseData, a.Id));
}
}
)
}
)
return res.replace("{{Li}}", resli)
}
//指定酒店选中
function selfincinput(check) {
//checkData = [];
let s = $("#rightcard").find(".nav-link").children(".form-check").children(".form-check-input");
for (var i = 0; i < s.length; i++) {
let id = $(s.get(i)).attr("data-id");
if (check.indexOf(Number.parseInt(id)) >= 0) {
$(s.get(i)).prop("checked", true);
if (checkData.indexOf(Number.parseInt(id)) < 0) {
checkData.push(Number.parseInt(id))
}
//else {
// checkData.splice(checkData.indexOf(Number.parseInt(id)), 1)
//}
}
}
}
//清除redis缓存
function Clear(that) {
$(that).removeClass("btn-info");
$(that).addClass("btn-danger");
$(that).html('<span>同步中...</span>');
$.post("/Api/Clear", (X) => {
if (X.Status != 200)
error(X.Message)
else
success("同步成功!");
$(that).removeClass("btn-danger");
$(that).addClass("btn-info");
$(that).html('<span>同步数据</span>');
});
}
//同步并清除redis缓存
function ClearAll(that) {
$(that).removeClass("btn-info");
$(that).addClass("btn-danger");
$(that).html('<span>同步中...</span>');
$.post("/OuterSyncApi/SyncData", { Pwd:"fs%sd"}, (X) => {
if (X.Status == true)
error(X.Message)
else
success("同步成功!");
$(that).removeClass("btn-danger");
$(that).addClass("btn-info");
$(that).html('<span>同步数据</span>');
});
}
//清除redis缓存
function ClearAllCache(that) {
$(that).removeClass("btn-info");
$(that).addClass("btn-danger");
$(that).html('<span>清除...</span>');
$.post("/Api/ClearCache", (X) => {
if (X.Status != 200)
error(X.Message)
else
success("同步成功!");
$(that).removeClass("btn-danger");
$(that).addClass("btn-info");
$(that).html('<span>清楚缓存</span>');
});
}
//添加用户组
function AddOrg() {
$("#modal-title").html("添加用户组");
$(".appshow").hide();
$("#addOrgsbtn").click();
}
function AddApp() {
$("#modal-title").html("添加应用");
$(".appshow").show();
$("#addOrgsbtn").click();
}
let orgnameok = 0;
function ResAddorg() {
let types = 0
let str = $("#modal-title").html();
if (str != "添加用户组")
types = 1;
let ok = 0;
if (orgnameok == 100)
error("名字不可用");
else
if (orgnameok == 0)
info("正检测,...")
else
ok = 200;
if (ok != 200)
return;
$.post("/Api/AddOrgApp", {
appicon: appicon,
Name: $("#orgname").val(),
Desc: $("#Desc").val(),
Type: types,
Version: $('.Version').val(),
ReleaseDate: $('.ReleaseDate').val(),
AppType: $('.AppType').val(),
WebSite: $('.WebSite').val()
}, res => {
if (res.Status == 200 && res.Data > 0) {
$("#orgname").val("");
$("#Desc").val("")
if (types == 0)
location.href = "/Org/Index/" + res.Data;
else
location.href = "/App/Index/" + res.Data;
}
else {
error(res.Message);
}
})
$("#Addorgclosebtn").click();
}
function CheckOrg(that) {
if ($(that).val() == "")
return;
orgnameok = 0;
$("#ResAddorgbtn").attr("disabled", "disabled");
let types = 0
let str = $("#modal-title").html();
if (str != "添加用户组")
types = 1;
$.post("/Api/CheckOrgApp", { Name: $(that).val(), Type: types }, res => {
if (res.Status == 200) {
orgnameok = 200
$("#ResAddorgbtn").removeAttr("disabled")
}
else {
orgnameok = 100;
error("名字重复");
}
})
}
//消息
var Toast = Swal.mixin({
toast: true,
position: 'center',
showConfirmButton: false,
timer: 1500
});
function error(text) {
fire('error', text);
}
function question(text) {
fire('question', text);
}
function warning(text) {
fire('warning', text);
}
function success(text) {
fire('success', text);
}
function info(text) {
fire('info', text);
}
function fire(icons, text) {
Toast.fire({
icon: icons,
title: text
})
}
//时间戳方式
function Gotimestamp(time, sfm = false) {
time = time.toUpperCase()
if (time.indexOf("T") >= 0 && time.indexOf("/DATE(")<0) {
return time.split("T")[0];
}
time = Number(time.replace("/DATE(", "").replace(")/", ""));
var now = new Date(time),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate();
let h = now.getHours(); // 获取当前小时数(0-23)
let mm = now.getMinutes(); // 获取当前分钟数(0-59)
let s = now.getSeconds();// 获取当前秒数(0-59)
let res = "" + y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
if (sfm) {
return res + " " + (h < 10 ? "0" + h : h) + ":" + (mm < 10 ? "0" + mm : mm) + ":" + (s < 10 ? "0" + s : s)
}
return res
//+ " " + now.toTimeString().substr(0, 8);
}
let p;
function AddColor(that) {
//p = $(that).find("button");
//$(p).click(function (event) {
//event.stopPropagation(); // 阻止事件冒泡
//});
//$(p[0]).click();
that = $(that).closest(".card-header");
if ($(that).hasClass("text-blue"))
$(that).removeClass("text-blue");
else
$(that).addClass("text-blue");
}
//周期性刷新按钮状态
function refreshSyncButtonState() {
let domRef = $("#global_refreshall_button");
let domTimeRef = $("#global_refreshall_button_time");
$.post("/Api/GetRunSyncState", (X) => {
console.log(X);
if (X.isBusying == true) {
domRef.html('<span>同步中...</span>');
domRef.removeClass("btn-info");
domRef.addClass("btn-danger");
}
else {
domRef.html('<span>同步数据</span>');
domRef.removeClass("btn-danger");
domRef.addClass("btn-info");
}
domTimeRef.html(X.strLastTm);
});
};
//window.setInterval(refreshSyncButtonState, 10 * 1000);
</script>
@*用户组用户权限设置生效*@
<aside class="control-sidebar control-sidebar-light" style="overflow-y: scroll;" id="rightcard">
<!-- 控制侧边栏内容在这里 -->
<div class="card collapsed-card">
<div class="card-header">
<h3 class="card-title">
<div class="form-check">
<input class="form-check-input" data-on="0" onclick="Clickdataon(this)" onchange="ChecK(0, '{{id}}', this)" type="checkbox">
<label class="form-check-label">{{card-title}}</label>
</div>
</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" onclick="AddColor(this)" data-card-widget="collapse">
<i class=" fas fa-plus "></i>
</button>
</div>
</div>
<div class="card-body p-0">
<ul class="nav nav-pills flex-column">
{{Li}}
</ul>
</div>
<!-- /.card-body -->
</div>
</aside>
<input value="@ViewBag.BaseDataGroups" type="hidden" id="BaseDataGroups" />
<input value="@ViewBag.BaseData" type="hidden" id="BaseData" />
<script src="~/Scripts/loadImage.js"></script>
</body>
</html>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html style="height: 100%; width: 100%;overflow-y:scroll;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<!-- Toastr -->
<link rel="stylesheet" href="/Lib/plugins/toastr/toastr.min.css">
<!-- <20><><EFBFBD><EFBFBD> Google <20><><EFBFBD><EFBFBD>: Source Sans Pro -->
<link rel="stylesheet" href="/Lib/dist/css/google.css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="/Lib/plugins/fontawesome-free/css/all.min.css">
<!-- SweetAlert2 -->
<script src="/Lib/plugins/sweetalert2/sweetalert2.min.js"></script>
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ -->
<link rel="stylesheet" href="/Lib/dist/css/adminlte.min.css">
<!-- Toastr -->
<link rel="stylesheet" href="/Lib/plugins/toastr/toastr.min.css">
<!-- jQuery -->
<script src="/Lib/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/Lib/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- bs-custom-file-input -->
<script src="/Lib/plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<!-- AdminLTE App -->
<script src="/Lib/dist/js/adminlte.min.js"></script>
<!-- SweetAlert2 -->
<link rel="stylesheet" href="/Lib/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
<!-- Toastr -->
<link rel="stylesheet" href="/Lib/plugins/toastr/toastr.min.css">
</head>
<body style="height:100%;width:100%">
@RenderBody()
<script>
//消息
var Toast = Swal.mixin({
toast: true,
position: 'center',
showConfirmButton: false,
timer: 3000
});
function error(text) {
fire('error', text);
}
function question(text) {
fire('question', text);
}
function warning(text) {
fire('warning', text);
}
function success(text) {
fire('success', text);
}
function info(text) {
fire('info', text);
}
function fire(icons, text) {
Toast.fire({
icon: icons,
title: text
})
}
</script>
</body>
</html>

43
UI/Views/Web.config Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="UI" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
</configuration>

View File

@@ -0,0 +1,3 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}