初始化项目

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