初始化
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@if (ViewData["tableDataimp"] != null)
|
||||
{
|
||||
System.Data.DataSet datas = (System.Data.DataSet)ViewData["tableDataimp"];
|
||||
<input type="hidden" class="dataNum" value="@(ViewBag.dataNum)" />
|
||||
<div>
|
||||
@*<nav style="text-align:center;">
|
||||
<ul class="pagination" id="page">
|
||||
<li class="first" onclick="TestLogsData(1)"><a>首页</a></li>
|
||||
<li class="left"><a>…</a></li>
|
||||
@for (int i = 0; i < ViewBag.allpage; i++)
|
||||
{
|
||||
<li class="pages" onclick="TestLogsData(@(i + 1))"><a>@(i + 1)</a></li>
|
||||
}
|
||||
<li class="right"><a>…</a></li>
|
||||
<li class="finally"><a onclick="TestLogsData(@ViewBag.allpage)">尾页</a></li>
|
||||
</ul>
|
||||
</nav>*@
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-hover " id="editable">
|
||||
<thead>
|
||||
<tr>
|
||||
@for (int i = 0; i < datas.Tables[0].Columns.Count; i++)
|
||||
{
|
||||
<th>
|
||||
|
||||
@if (datas.Tables[0].Columns[i].ToString() == "filename")
|
||||
{
|
||||
<b> 文件名(后缀)</b>
|
||||
}
|
||||
else if (datas.Tables[0].Columns[i].ToString() == "creationtime")
|
||||
{
|
||||
<b> 创建时间</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<b>
|
||||
@datas.Tables[0].Columns[i].ToString()
|
||||
</b>
|
||||
}
|
||||
</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (int row = 0; row < datas.Tables[0].Rows.Count; row++)
|
||||
{
|
||||
<tr>
|
||||
@for (int i = 0; i < datas.Tables[0].Columns.Count; i++)
|
||||
{
|
||||
<td>
|
||||
@if (datas.Tables[0].Rows[row][i].ToString() != "NULL")
|
||||
{
|
||||
@datas.Tables[0].Rows[row][i]
|
||||
}
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4>暂无数据</h4>
|
||||
}
|
||||
<script src="~/Plugin/allPages.js"></script>
|
||||
81
Face.Web/Areas/App/Views/Expand/ExpandIndex.cshtml
Normal file
81
Face.Web/Areas/App/Views/Expand/ExpandIndex.cshtml
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "ExpandIndex";
|
||||
Layout = "~/Areas/App/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content" style="padding:0px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<!-- Default box -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
||||
@*<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse"></button>
|
||||
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>*@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@*条件筛选*@<div><h4>新增酒店信息</h4></div>
|
||||
</div>
|
||||
@*内容筛选*@
|
||||
<div class="ibox-content" style="padding:0px;">
|
||||
<div id="project">
|
||||
<div class="card-body">
|
||||
<form class="form-horizontal" id="AddresidentFrom">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">酒店编码</font></font></label>
|
||||
<input type="email" class="form-control" id="idcode" placeholder="输入名字">
|
||||
<p></p>
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">酒店名称</font></font></label>
|
||||
<input type="email" class="form-control" id="name" placeholder="输入身份证">
|
||||
<p></p>
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">酒店ID</font></font></label>
|
||||
<input type="email" class="form-control" id="id_no" placeholder="输入电话">
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="col-md-offset-3 col-md-9">
|
||||
<button class="btn btn-md btn-primary" type="button" id="btnAddShow" onclick="TiJ()">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="btn" onclick="tip()"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function TiJ()
|
||||
{
|
||||
var name = $('#name').val();
|
||||
var id_no = $('#id_no').val();
|
||||
var idcode = $('#idcode').val();
|
||||
console.log(name);
|
||||
$.ajax({
|
||||
url: "/Expand/Expandinsert",
|
||||
data: { "name": name, "id_no": id_no, "idcode": idcode },
|
||||
type: "POST",
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
455
Face.Web/Areas/App/Views/Expand/UploadingAll.cshtml
Normal file
455
Face.Web/Areas/App/Views/Expand/UploadingAll.cshtml
Normal file
@@ -0,0 +1,455 @@
|
||||
@using PagedList.Mvc;
|
||||
@using Face.Web.Areas.App.Models;
|
||||
@using Face.Domain.Entities;
|
||||
@using Face.Domain.Application
|
||||
@{
|
||||
ViewBag.Title = "UploadingAll";
|
||||
Layout = "~/Areas/App/Views/Shared/_Layout.cshtml";
|
||||
List<Face.Domain.Entities.Hotels> Hotellist = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
}
|
||||
<style>
|
||||
.card-body label {
|
||||
display: inline-block;
|
||||
width: 20%;
|
||||
margin-right: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.card-body select,
|
||||
.card-body input {
|
||||
display: inline-block;
|
||||
height: 35px;
|
||||
width: 75%;
|
||||
margin-bottom: 10px;
|
||||
padding: 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.custom-file-label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.input-group-text {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.custom-file-input {
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.custom-file-input:hover,
|
||||
.custom-file-input:focus {
|
||||
border-color: #000;
|
||||
box-shadow: none;
|
||||
}
|
||||
.custom-file-input:focus ~ .custom-file-label {
|
||||
border-color: #000;
|
||||
box-shadow: none;
|
||||
}
|
||||
.custom-file-label::before {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
background-color: #007bff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.custom-file-label::after {
|
||||
content: "浏览";
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
background-color: #28a745;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.input-group-text {
|
||||
cursor: pointer;
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
border-color: #007bff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.input-group-text:hover,
|
||||
.input-group-text:focus {
|
||||
background-color: #0062cc;
|
||||
color: #fff;
|
||||
border-color: #005cbf;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.input-group-text:active {
|
||||
background-color: #005cbf;
|
||||
color: #fff;
|
||||
border-color: #005cbf;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<section class="content" style="padding:0px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<!-- Default box -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span style="font-size:30px">上传文件</span>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse"></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ">
|
||||
<label for="remark" style="display: inline-block; width: 20%; margin-right: 10px; text-align: right; ">上传类型:</label>
|
||||
<select class="form-control" id="OrgId" style="display: inline-block; height: 35px; width: 75%; ">
|
||||
<option value="3">
|
||||
人脸机背景图 (要求:格式:png, 尺寸:800x1280,大小 1MB以下)
|
||||
</option>
|
||||
<option value="2">
|
||||
酒店Logo(要求:格式:png, 尺寸:351x87,大小 1MB以下)
|
||||
</option>
|
||||
<option value="1">
|
||||
升级文件(文件太大,需要等待一段时间)
|
||||
</option>
|
||||
</select>
|
||||
<label for="remark" style="display: inline-block; width: 20%; margin-right: 10px; text-align: right;">酒店名称:</label>
|
||||
<select class="form-control" id="hoteid" style="display: inline-block; height: 35px; width: 75%; " onchange="GetstationList()">
|
||||
@{List<int> sum = (List<int>)Session["list"];
|
||||
foreach (int item in sum)
|
||||
{
|
||||
foreach (var iten in Hotellist)
|
||||
{
|
||||
if (iten.Id == item)
|
||||
{
|
||||
<option class="ComboBox" value="@iten.Id" )>
|
||||
@iten.Name
|
||||
</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<label for="remark" style="display: inline-block; width: 20%; margin-right: 10px; text-align: right;">房间名称:</label>
|
||||
<select class="form-control" id="roomid" style="display: inline-block; height: 35px; width: 75%; ">
|
||||
</select>
|
||||
<label for="remark" style="display: inline-block; width: 20%; margin-right: 10px; text-align: right;">备注:</label>
|
||||
<input class="form-control" type="text" placeholder="详细信息" name="username" style="display: inline-block; height: 35px; width: 75%;" id="remark">
|
||||
<label for="remark" style="display: inline-block; width: 20%; margin-right: 10px; text-align: right;">上传文件:</label>
|
||||
<div class="form-group" style="display: inline-block; height: 35px; width: 75%;">
|
||||
<div class="input-group">
|
||||
<div class="custom-file" style="display: inline-block; height: 35px;">
|
||||
<input type="file" onchange="uploadimg()" class=" custom-file-input" id="photo" style="width:80%">
|
||||
<label class="custom-file-label" id="exampleInputFile" style="width:80%"></label>
|
||||
</div>
|
||||
<div class=" input-group-append">
|
||||
<span class="input-group-text" onclick="uploads()" id="buttnShow">上传</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@*条件筛选*@
|
||||
@*内容筛选*@
|
||||
<div class="ibox-content" style="padding:0px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
<div class="col-sm-4" id="faceDetailsBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script>
|
||||
const selectOrgIdElement = document.getElementById("OrgId");
|
||||
const selecthoteidElement = document.getElementById("hoteid");
|
||||
const selectroomElement = document.getElementById("roomid");
|
||||
|
||||
|
||||
// 添加事件监听器
|
||||
selectOrgIdElement.addEventListener("change", function () {
|
||||
show();
|
||||
var name = $('#OrgId').val();
|
||||
//升级文件
|
||||
if (name == 1){
|
||||
const option1 = document.createElement("option");
|
||||
option1.value = "0";
|
||||
option1.text = "";
|
||||
selecthoteidElement.appendChild(option1);
|
||||
selectroomElement.appendChild(option1);
|
||||
selecthoteidElement.value = "0";
|
||||
selecthoteidElement.disabled = true;
|
||||
selectroomElement.value = "0";
|
||||
selectroomElement.disabled = true;
|
||||
}
|
||||
//酒店logo
|
||||
else if (name == 2)
|
||||
{
|
||||
|
||||
const option2 = document.createElement("option");
|
||||
option2.value = "0";
|
||||
option2.text = "";
|
||||
selectroomElement.appendChild(option2);
|
||||
selecthoteidElement.appendChild(option2);
|
||||
selectroomElement.disabled = true;
|
||||
selecthoteidElement.disabled = false;
|
||||
// 删除所有选项
|
||||
for (let i = selectroomElement.options.length - 1; i >= 0; i--) {
|
||||
selectroomElement.remove(i);
|
||||
}
|
||||
}
|
||||
//背景图
|
||||
else if (name == 3){
|
||||
|
||||
selecthoteidElement.disabled = false;
|
||||
selectroomElement.disabled = false;
|
||||
|
||||
}
|
||||
});
|
||||
selecthoteidElement.addEventListener("change", function () {
|
||||
show();
|
||||
});
|
||||
selectroomElement.addEventListener("change", function () {
|
||||
show();
|
||||
});
|
||||
|
||||
window.onload = GetstationList;
|
||||
function uploadimg(type) {
|
||||
let files = $("#photo").prop("files");
|
||||
if (files.length <= 0)
|
||||
return;
|
||||
$("#photo").closest(".input-group").find("label").html(files[0].name);
|
||||
if (type != 1)
|
||||
return;
|
||||
uploads();
|
||||
}
|
||||
function uploads() {
|
||||
if ($('#photo')[0].files[0] != undefined) {
|
||||
var name = $('#OrgId').val();//上传文件类型
|
||||
var remark = $('#remark').val(); //备注
|
||||
var houseid = $('#hoteid').val();//酒店号码
|
||||
var roomid = $('#roomid').val();//房间号码
|
||||
if (houseid == null) {
|
||||
houseid = 0
|
||||
}
|
||||
if (roomid == null) {
|
||||
roomid = 0
|
||||
}
|
||||
var formData = new FormData() //创建一个forData
|
||||
formData.append('img', $('#photo')[0].files[0])
|
||||
formData.append('type', name)
|
||||
formData.append('remark', remark)
|
||||
formData.append('houseid', houseid)
|
||||
formData.append('roomid', roomid)
|
||||
|
||||
if (name == "1") {
|
||||
uploadFile();//上传部件方法
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "/ImgServer/judgeUpdate",
|
||||
data: formData,
|
||||
type: "POST",
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
if (data == "false") {
|
||||
var s = confirm("服务器已有此文件,是否替换")
|
||||
if (s == true) {
|
||||
$.ajax({
|
||||
url: "/ImgServer/UpdateYh",
|
||||
data: formData,
|
||||
type: "POST",
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
if (data.status == true) {
|
||||
alert("上传成功");
|
||||
show();
|
||||
}
|
||||
else {
|
||||
alert("上传失败 原因:" + data.data);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("上传失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
||||
$.ajax({
|
||||
url: "/ImgServer/UpdateYh",
|
||||
data: formData,
|
||||
type: "POST",
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {//成功
|
||||
if (data.status == true) {
|
||||
alert("上传成功");
|
||||
show();
|
||||
}
|
||||
else {
|
||||
alert("上传失败 原因:" + data.data);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("上传失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("请选择文件上传");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetstationList() {
|
||||
show();
|
||||
var name = $('#OrgId').val();
|
||||
if (name==3) {
|
||||
|
||||
var houseid = $('#hoteid').val();
|
||||
$("#roomid").html("");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/APP/Expand/Dropdownlist",
|
||||
cache: false,
|
||||
data: { "Hoteid": houseid },
|
||||
success: function (data) {
|
||||
if (data.Status == 200) {
|
||||
for (var i = 0; i < data.Data.length; i++) {
|
||||
$("#roomid").append(` <option value="` + data.Data[i].ID + `">` + data.Data[i].RoomNumber + `</option>`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function show() {
|
||||
var name = $('#OrgId').val();
|
||||
var houseid = $('#hoteid').val();
|
||||
var roomid = $('#roomid').val();
|
||||
var datalist = {
|
||||
HotelID: houseid,
|
||||
roomid: roomid,
|
||||
filetype: name
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/APP/Expand/Conditionfileawholelog",
|
||||
cache: false,
|
||||
data: datalist,
|
||||
success: function (data) {
|
||||
$(".ibox-content").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function uploadFile() {
|
||||
$('#buttnShow').html('上传中');
|
||||
var fileInput = document.getElementById('photo');
|
||||
var file = fileInput.files[0];
|
||||
|
||||
var chunkSize = 1024 * 1024; // 每个分片的大小,这里设置为 1MB
|
||||
var fileSize = file.size;
|
||||
console.log("文件大小时:" + Math.round(fileSize / chunkSize)+"Mb")
|
||||
debugger
|
||||
var totalChunks = Math.ceil(fileSize / chunkSize); // 总分片数
|
||||
var currentChunk = 0; // 当前上传的分片序号
|
||||
var remark = $('#remark').val();//获取备注
|
||||
|
||||
function uploadChunk(start, end) {
|
||||
var chunk = file.slice(start, end); // 获取当前分片的数据
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('file', chunk);
|
||||
formData.append('chunkIndex', currentChunk);
|
||||
formData.append('totalChunks', totalChunks);
|
||||
formData.append('fileName', file.name);
|
||||
|
||||
fetch('/ImgServer/UploadChunk', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(function (response) {
|
||||
if (response.ok) {
|
||||
// 分片上传成功
|
||||
currentChunk++;
|
||||
if (currentChunk < totalChunks) {
|
||||
// 继续上传下一个分片
|
||||
var start = currentChunk * chunkSize;
|
||||
var end = Math.min(start + chunkSize, fileSize);
|
||||
uploadChunk(start, end);
|
||||
} else {
|
||||
// 所有分片上传完成
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/APP/ImgServer/MergeChunks",
|
||||
cache: false,
|
||||
data: { "fileName": file.name, "totalChunks": totalChunks, "remark": remark },
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
alert('文件上传成功!');
|
||||
$('#buttnShow').html('上传');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 分片上传失败
|
||||
console.log('分片上传失败:' + response.status);
|
||||
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
// 发生错误
|
||||
console.log('发生错误:' + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
// 上传逻辑
|
||||
var start = 0;
|
||||
var end = Math.min(chunkSize, fileSize);
|
||||
uploadChunk(start, end);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user