初始化
This commit is contained in:
147
Face.Web/Plugin/allPages.js
Normal file
147
Face.Web/Plugin/allPages.js
Normal file
@@ -0,0 +1,147 @@
|
||||
|
||||
//$(".dataCount").html($("#dataCount").val());
|
||||
|
||||
//var pagesNum = $("li.pages").size();//获取页数
|
||||
$("li.left").hide();
|
||||
|
||||
|
||||
//if (pagesNum > 5) {
|
||||
// $("li.right").show();
|
||||
//} else {
|
||||
// $("li.right").hide();
|
||||
//}
|
||||
|
||||
//第一页
|
||||
function firstPage(url) {
|
||||
search(url, 0, 8, 0);
|
||||
}
|
||||
|
||||
function firstPage16(url) {
|
||||
search(url, 0, 16, 0);
|
||||
}
|
||||
|
||||
//最后一页
|
||||
function lastPage(url) {
|
||||
var pagesNum = $("li.pages").length;//获取页数
|
||||
var max = pagesNum * 8;
|
||||
var min = (pagesNum - 1) * 8;
|
||||
search(url, min, max, (pagesNum - 1));//起始显示,显示结束,页数背景色的下标
|
||||
}
|
||||
|
||||
//最后一页
|
||||
function lastPage16(url) {
|
||||
var pagesNum = $("li.pages").length;//获取页数
|
||||
var max = pagesNum * 16;
|
||||
var min = (pagesNum - 1) * 16;
|
||||
search(url, min, max, (pagesNum - 1));//起始显示,显示结束,页数背景色的下标
|
||||
}
|
||||
|
||||
//选择页数
|
||||
function SpecifyPage(url,page) {
|
||||
//console.log(page);
|
||||
var max = (page + 1) * 8;
|
||||
var min = page * 8;
|
||||
console.log(max);
|
||||
console.log(min);
|
||||
search(url, min, max, page);
|
||||
}
|
||||
//选择页数
|
||||
function SpecifyPage16(url, page) {
|
||||
//console.log(page);
|
||||
var max = (page + 1) * 16;
|
||||
var min = page * 16;
|
||||
console.log(max);
|
||||
console.log(min);
|
||||
search(url, min, max, page);
|
||||
}
|
||||
|
||||
function queryInfo(url) {
|
||||
search(url, 0, 8, 1);
|
||||
}
|
||||
|
||||
function search(url, dataMin, dataMax, Pages, extraCondition) {//查询SN号按钮
|
||||
console.log("123");
|
||||
extraCondition = extraCondition || {};
|
||||
//debugger
|
||||
$("#faceDetailsBox").html("");//bug 操作页面清空
|
||||
var HotelID = $("#OrgId").val();
|
||||
var Status = $("#OrgId3").val();
|
||||
var Notbing = $("#OrgId2").val();
|
||||
var FaceName = $("#txtOpname").val();
|
||||
var RoomStatus = $("#RoomStatus").val();
|
||||
var RoomDate = $("#startTs").val();
|
||||
|
||||
var endDate = $("#endTs").val();
|
||||
|
||||
var RoomName = $("#RoomName").val();
|
||||
|
||||
var isShowS8 = 1;
|
||||
if ($("#pmslogHideS8").length > 0)
|
||||
isShowS8 = $("#pmslogHideS8").get(0).checked ? 0 : 1
|
||||
|
||||
|
||||
let data = { "HotelID": HotelID, "Status": Status, "Notbing": Notbing, "FaceName": FaceName, "dataMin": dataMin, "dataMax": dataMax, "Pages": Pages, "RoomStatus": RoomStatus, "RoomDate": RoomDate, "RoomMinDate": RoomDate, "RoomMaxDate": endDate, "RoomName": RoomName, showS8: isShowS8 };
|
||||
|
||||
for (var p in extraCondition) {
|
||||
for (var q in data) {
|
||||
if (q === p) {
|
||||
data[q] = extraCondition[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: "post", // 提交方式
|
||||
success: function (data) {
|
||||
//console.log(data);
|
||||
//console.log(133221413);
|
||||
$(".ibox-content").html(data);
|
||||
$("li.pages").hide();
|
||||
if (Pages >= 5) {
|
||||
var maxPages = Pages + 3
|
||||
var minPages = Pages-3;
|
||||
for (var i = minPages; i < maxPages; i++) {
|
||||
$("li.pages").eq(i).show();//显示页数
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < 5; i++) {
|
||||
$("li.pages").eq(i).show();//显示页数
|
||||
}
|
||||
}
|
||||
if ($("li.pages").length != 0) {
|
||||
var pages = $("li.pages").length - 3;//获取页数
|
||||
if (Pages >= pages) {
|
||||
$("li.right").hide();
|
||||
}
|
||||
if (Pages > 3) {
|
||||
$("li.left").show();
|
||||
} else {
|
||||
$("li.left").hide();
|
||||
}
|
||||
$("li.pages a").eq(Pages-1).css("color", "white");//添加选中字体颜色
|
||||
$("li.pages a").eq(Pages-1).css("background-color", "#00BFFF");//添加选中背景颜色
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getQueryVariable(variable) {
|
||||
let query = window.location.search.substring(1);
|
||||
let vars = query.split("&");
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
let pair = vars[i].split("=");
|
||||
if (pair[0] == variable) { return pair[1]; }
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
135
Face.Web/Plugin/basicfunc.js
Normal file
135
Face.Web/Plugin/basicfunc.js
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
|
||||
//修改管理员
|
||||
$("#btnModifyPLine").click(function () {
|
||||
|
||||
var btnText = $('#btnModifyPLine').html()
|
||||
$("#btnModifyPLine").attr("disabled", "true"); //设置禁用按钮
|
||||
$('#btnModifyPLine').text('提交中...'); //显示提交中
|
||||
|
||||
$("#modifyPLineForm").ajaxSubmit({
|
||||
url: "/APP/BasicFunc/ModifyPLine",
|
||||
type: "post",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('保存成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 2000,
|
||||
callback: function () {
|
||||
$('#btnModifyPLine').text(btnText); //还原显示
|
||||
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
|
||||
location.href = "/APP/BasicFunc/PLineList";
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$.toastr.error('保存失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
$('#btnModifyPLine').text(btnText); //还原显示
|
||||
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
|
||||
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
|
||||
$('#btnModifyPLine').text(btnText); //还原显示
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//修改提交
|
||||
function excutedUpDate(btnID, url, formID, sucUrl) {
|
||||
var btnText = $('#' + btnID).html();
|
||||
$('#' + btnID).attr("disabled", "true"); //设置禁用按钮
|
||||
$('#' + btnID).text('提交中...'); //显示提交中
|
||||
|
||||
$('#' + formID).ajaxSubmit({
|
||||
url: url,
|
||||
type: "POST",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
if (!res.Message) {
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
alert('成功')
|
||||
}
|
||||
else {
|
||||
$.toastr.success('保存成功! <br />' + res.Message,
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 3000,
|
||||
callback: function () {
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
location.href = sucUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
$.toastr.error('保存失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
//添加修改内部单生产计划
|
||||
function excutedUpDatePPlan(btnID, url, formID, orderInternalID) {
|
||||
var btnText = $('#' + btnID).html();
|
||||
$('#' + btnID).attr("disabled", "true"); //设置禁用按钮
|
||||
$('#' + btnID).text('提交中...'); //显示提交中
|
||||
|
||||
$('#' + formID).ajaxSubmit({
|
||||
url: url,
|
||||
type: "POST",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('保存成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 2000,
|
||||
callback: function () {
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
gotoDetailPartial('/APP/PPlan/PPlanInternalDetails', orderInternalID, 'pPlanInterBox_Content')
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$.toastr.error('保存失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#' + btnID).removeAttr('disabled')//重置按钮
|
||||
$('#' + btnID).text(btnText); //还原显示
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
197
Face.Web/Plugin/common.js
Normal file
197
Face.Web/Plugin/common.js
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
|
||||
//修改数据库选择
|
||||
$("#userCustomer").change(function () {
|
||||
var customerID = $("#userCustomer").val();
|
||||
$("#ordersPlannedSpeedBox_Content").empty();
|
||||
// Ajax提交数据
|
||||
$.ajax({
|
||||
url: "/app/Home/SetCustomerID",//"APP/login/login", // 提交到controller的url路径
|
||||
type: "post", // 提交方式
|
||||
data: { "customerID": customerID }, // data为String类型,必须为 Key/Value 格式。
|
||||
dataType: "json", // 服务器端返回的数据类型
|
||||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||||
if (res.Status == 200) {
|
||||
//textToast(res.Message);
|
||||
//gotoDetailCommon();//首页数据表格显示
|
||||
}
|
||||
else if (res.Status != 200) {
|
||||
//textToast(res.Message);
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//打开普通的局部页
|
||||
function gotoCommonPartial(url, containerDiv) {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
$('#' + containerDiv).html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 链接到明细数据页
|
||||
function gotoDetailPartial(url, id, containerDiv) {
|
||||
url = url + "/" + id;
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
$('#' + containerDiv).html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//打开普通的局部页
|
||||
function gotoCommonPartialNeedDate(url, containerDiv) {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
addDatepicker();
|
||||
$('#' + containerDiv).html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 链接到明细数据页 需要时间控件
|
||||
function gotoDetailPartialNeedDate(url, id, containerDiv) {
|
||||
url = url + "/" + id;
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
addDatepicker();
|
||||
$('#' + containerDiv).html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 链接到明细数据页 两个视图
|
||||
function gotoDetailPartialTwoView(url, id, containerDiv, url2, containerDiv2) {
|
||||
url = url + "/" + id;
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
$('#' + containerDiv).html(data);
|
||||
gotoDetailPartial(url2, id, containerDiv2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addDatepicker() {
|
||||
$.getScript('/Theme/js/plugins/datapicker/bootstrap-datepicker.js');
|
||||
|
||||
$.getScript('/Theme/js/plugins/datapicker/locales/bootstrap-datepicker.zh-CN.js');
|
||||
|
||||
}
|
||||
|
||||
function gotoDetailCommon() {
|
||||
// Ajax提交数据
|
||||
$.ajax({
|
||||
url: "/app/Order/GetOrdersPlannedSpeed",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||||
|
||||
if (res.Status == 200) {
|
||||
$("#ordersPlannedSpeedBox_Content").empty();
|
||||
if (res.Data) {
|
||||
//填充数据
|
||||
var jsonArray = res.Data;
|
||||
var headArray = [];
|
||||
|
||||
//循环取字段名
|
||||
for (var i in jsonArray[0]) {
|
||||
headArray[headArray.length] = i;
|
||||
}
|
||||
|
||||
var div = document.getElementById("ordersPlannedSpeedBox_Content");
|
||||
var table = document.createElement("table");
|
||||
table.id = "new_table";
|
||||
table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
|
||||
|
||||
var theadH = document.createElement("thead");
|
||||
var thead = document.createElement("tr");
|
||||
|
||||
//表头 从1开始 忽略ID
|
||||
for (var count = 1; count < headArray.length; count++) {
|
||||
var td = document.createElement("th");
|
||||
td.innerHTML = headArray[count];
|
||||
thead.appendChild(td);
|
||||
}
|
||||
theadH.appendChild(thead);
|
||||
table.appendChild(theadH);
|
||||
|
||||
var theadY = document.createElement("tbody");
|
||||
|
||||
//表格数据
|
||||
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
|
||||
|
||||
var tr = document.createElement("tr");
|
||||
|
||||
tr.setAttribute("onclick", "clickaction(" + jsonArray[tableRowNo]["ID"] + ")")
|
||||
|
||||
//从1开始 忽略ID
|
||||
for (var headCount = 1; headCount < headArray.length; headCount++) {
|
||||
var cell = document.createElement("td");
|
||||
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
|
||||
tr.appendChild(cell);
|
||||
}
|
||||
theadY.appendChild(tr);
|
||||
table.appendChild(theadY);
|
||||
|
||||
}
|
||||
div.appendChild(table);
|
||||
} else { }
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
function updateCommonCache(url, sucUrl) {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('更新成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 350,
|
||||
callback: function () {
|
||||
location.href = sucUrl;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$.toastr.error('清除失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
21
Face.Web/Plugin/inspinia-partial.js
Normal file
21
Face.Web/Plugin/inspinia-partial.js
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
// Collapse ibox function
|
||||
$('.collapse-link-partial').click(function () {
|
||||
var ibox = $(this).closest('div.ibox');
|
||||
var button = $(this).find('i');
|
||||
var content = ibox.find('div.ibox-content');
|
||||
content.slideToggle(200);
|
||||
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
|
||||
ibox.toggleClass('').toggleClass('border-bottom');
|
||||
setTimeout(function () {
|
||||
ibox.resize();
|
||||
ibox.find('[id^=map-]').resize();
|
||||
}, 50);
|
||||
});
|
||||
|
||||
// Close ibox function
|
||||
$('.close-link-partial').click(function () {
|
||||
var content = $(this).closest('div.ibox');
|
||||
content.remove();
|
||||
});
|
||||
54
Face.Web/Plugin/loadImage.js
Normal file
54
Face.Web/Plugin/loadImage.js
Normal file
@@ -0,0 +1,54 @@
|
||||
// onload是等所有的资源文件加载完毕以后再绑定事件
|
||||
window.onload = function () {
|
||||
|
||||
}
|
||||
|
||||
//// 获取图片列表,即img标签列表
|
||||
var imgs = document.querySelectorAll('img');
|
||||
function getTop(e) {
|
||||
return e.offsetTop;
|
||||
}
|
||||
// 懒加载实现
|
||||
function lazyload(imgs) {
|
||||
|
||||
imgs = document.querySelectorAll('img');
|
||||
|
||||
for (let i of imgs) {
|
||||
if ($(i).is(':visible') == true) {
|
||||
let trueSrc = i.getAttribute("data-src");
|
||||
if (trueSrc != 'null' && trueSrc != null && trueSrc.indexOf('{{') < 0 && trueSrc.indexOf('}}') < 0) {
|
||||
$(i).removeAttr("data-src")
|
||||
i.setAttribute("src", trueSrc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
// 可视区域高度
|
||||
var h = window.innerHeight;
|
||||
//滚动区域高度
|
||||
var s = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
for (let i of imgs) {
|
||||
//图片距离顶部的距离大于可视区域和滚动区域之和时懒加载
|
||||
//计算方式和第一种方式不同
|
||||
if (i.getBoundingClientRect().top < window.innerHeight) {
|
||||
let trueSrc = i.getAttribute("data-src");
|
||||
if (trueSrc != 'null' && trueSrc != null && trueSrc.indexOf('{{') < 0 && trueSrc.indexOf('}}') < 0) {
|
||||
$(i).removeAttr("data-src")
|
||||
i.setAttribute("src", trueSrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setTimeout(lazyload(imgs), 20);
|
||||
|
||||
// 滚屏函数
|
||||
window.onscroll = function () {
|
||||
//保证每次取到的为最新的
|
||||
lazyload(imgs);
|
||||
}
|
||||
62
Face.Web/Plugin/login.js
Normal file
62
Face.Web/Plugin/login.js
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
//登录
|
||||
$("#btnlogin").click(function () {
|
||||
|
||||
var btnText = $('#btnlogin').html();
|
||||
$("#btnlogin").attr("disabled", "true"); //设置禁用按钮
|
||||
$('#btnlogin').text('登录中...'); //显示提交中
|
||||
|
||||
$("#loginForm").ajaxSubmit({
|
||||
url: "/APP/login/login",
|
||||
type: "post",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
save_cookies();
|
||||
$.toastr.success('登录成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 350,
|
||||
location.href = "/APP/Home/Index";
|
||||
});
|
||||
$('#btnlogin').text(btnText); //还原显示
|
||||
$('#btnlogin').removeAttr('disabled')//重置按钮
|
||||
} else {
|
||||
|
||||
$.toastr.error('登录失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
$('#btnlogin').text(btnText); //还原显示
|
||||
$('#btnlogin').removeAttr('disabled')//重置按钮
|
||||
//toastr.options = {
|
||||
// closebutton: false,
|
||||
// progressbar: true,
|
||||
// showmethod: 'slidedown',
|
||||
// timeout: 2000,
|
||||
// positionclass: "toast-top-center",
|
||||
//};
|
||||
//toastr.error("登录失败:" + res.message);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#btnlogin').removeAttr('disabled')//重置按钮
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function save_cookies() {
|
||||
if ($("#remember").prop("checked")) {
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
|
||||
$.cookie("remember", "true", { expires: 7 });
|
||||
$.cookie("username", username, { expires: 7 });
|
||||
$.cookie("password", password, { expires: 7 });
|
||||
} else {
|
||||
$.cookie("remember", "false", { expires: -1 });
|
||||
$.cookie("username", "", { expires: -1 });
|
||||
$.cookie("password", "", { expires: -1 });
|
||||
}
|
||||
};
|
||||
1
Face.Web/Plugin/login.min.js
vendored
Normal file
1
Face.Web/Plugin/login.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
$("#btnlogin").click(function () { var a = $("#btnlogin").html(); $("#btnlogin").attr("disabled", "true"); $("#btnlogin").text("登录中..."); $("#loginForm").ajaxSubmit({ url: "/APP/login/login", type: "post", success: function (b) { if (b.Status == 200) { save_cookies(); $.toastr.success("登录成功", { position: "top-center", time: 350, callback: function () { location.href ="/APP/Home/Index"}});$("#btnlogin").text(a);$("#btnlogin").removeAttr("disabled")}else{$.toastr.error("登录失败! <br />"+b.Message,{time:3000,position:"top-center"});$("#btnlogin").text(a);$("#btnlogin").removeAttr("disabled")}},error:function(b){$("#btnlogin").removeAttr("disabled");alert(b)}})});function save_cookies(){if($("#remember").prop("checked")){var b=$("#username").val();var a=$("#password").val();$.cookie("remember","true",{expires:7});$.cookie("username",b,{expires:7});$.cookie("password",a,{expires:7})}else{$.cookie("remember","false",{expires:-1});$.cookie("username","",{expires:-1});$.cookie("password","",{expires:-1})}};
|
||||
311
Face.Web/Plugin/pplan.js
Normal file
311
Face.Web/Plugin/pplan.js
Normal file
@@ -0,0 +1,311 @@
|
||||
|
||||
function gotoDetailPartialNew(id) {
|
||||
$("#pPlanInterBox_Content").empty();
|
||||
removePPInfo();
|
||||
// Ajax提交数据
|
||||
$.ajax({
|
||||
url: "/APP/PPlan/PPlanInternalDetailsNew",//"@Url.Action("PPlanInternalDetailsNew", "PPlan")",//"APP/login/login", // 提交到controller的url路径
|
||||
type: "post", // 提交方式
|
||||
data: { "id": id }, // data为String类型,必须为 Key/Value 格式。
|
||||
dataType: "json", // 服务器端返回的数据类型
|
||||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||||
|
||||
if (res.Status == 200) {
|
||||
setPPInfo(res);
|
||||
if (res.Data.rows) {
|
||||
//填充数据
|
||||
var jsonArray = res.Data.rows;
|
||||
var headArray = [];
|
||||
|
||||
//循环取字段名
|
||||
for (var i in jsonArray[0]) {
|
||||
headArray[headArray.length] = i;
|
||||
}
|
||||
|
||||
var div = document.getElementById("pPlanInterBox_Content");
|
||||
var table = document.createElement("table");
|
||||
table.id = "new_table";
|
||||
table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
|
||||
|
||||
var theadH = document.createElement("thead");
|
||||
var thead = document.createElement("tr");
|
||||
|
||||
for (var count = 1; count < headArray.length; count++) {
|
||||
var td = document.createElement("th");
|
||||
td.innerHTML = headArray[count];
|
||||
thead.appendChild(td);
|
||||
}
|
||||
theadH.appendChild(thead);
|
||||
table.appendChild(theadH);
|
||||
|
||||
var theadY = document.createElement("tbody");
|
||||
|
||||
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
|
||||
|
||||
var tr = document.createElement("tr");
|
||||
for (var headCount = 1; headCount < headArray.length; headCount++) {
|
||||
var cell = document.createElement("td");
|
||||
|
||||
cell.setAttribute("class", jsonArray[tableRowNo][headArray[0]] + " " + headArray[headCount]);
|
||||
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
|
||||
//cell.data("station", headArray[headCount]);
|
||||
cell.dataset.station = headArray[headCount];
|
||||
cell.dataset.datetime = jsonArray[tableRowNo][headArray[1]];
|
||||
tr.appendChild(cell);
|
||||
}
|
||||
theadY.appendChild(tr);
|
||||
table.appendChild(theadY);
|
||||
|
||||
}
|
||||
div.appendChild(table);
|
||||
|
||||
|
||||
newTable(table.id);
|
||||
|
||||
$('.ToDay.Date').css({ 'border-bottom': '1px solid #FFF' });
|
||||
$('.Total').css({ 'border-bottom': '1px solid #333' });
|
||||
$('.Total:not(.Date)').css({ 'font-weight': '600', 'font-style': 'italic' });
|
||||
//$("#pPlanInterBox_Content").focus();
|
||||
//location.href = "#ppInfo";
|
||||
//$('html, body').animate({ scrollTop: $('#ppInfo').offset().top }, 1000);
|
||||
//for (var tableRowNo = 1; tableRowNo <= (jsonArray.length / 2); tableRowNo++) {
|
||||
|
||||
// mergeCell('new_table', tableRowNo * 2 - 1, tableRowNo * 2, 0);
|
||||
//}
|
||||
}
|
||||
else {
|
||||
$("#pPlanInterBox_Content").html("<small><strong> 暂无生产计划</strong ></small >");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
function mergeCell(table1, startRow, endRow, col) {
|
||||
var tb = document.getElementById(table1);
|
||||
if (!tb || !tb.rows || tb.rows.length <= 0) {
|
||||
return;
|
||||
}
|
||||
if (col >= tb.rows[0].cells.length || (startRow >= endRow && endRow != 0)) {
|
||||
return;
|
||||
}
|
||||
if (endRow == 0) {
|
||||
endRow = tb.rows.length - 1;
|
||||
}
|
||||
for (var i = startRow; i < endRow; i++) {
|
||||
if (tb.rows[startRow].cells[col].innerHTML == tb.rows[i + 1].cells[col].innerHTML) { //如果相等就合并单元格,合并之后跳过下一行
|
||||
tb.rows[i + 1].removeChild(tb.rows[i + 1].cells[col]);
|
||||
tb.rows[startRow].cells[col].rowSpan = (tb.rows[startRow].cells[col].rowSpan) + 1;
|
||||
} else {
|
||||
mergeCell(table1, i + 1, endRow, col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var oTable;
|
||||
function newTable(tbid) {
|
||||
oTable = $('#' + tbid).DataTable({
|
||||
"bFilter": false, //过滤功能
|
||||
"info": false,
|
||||
"ordering": false,
|
||||
"lengthChange": false,
|
||||
"bAutoWidth": false,//自动宽度
|
||||
"bPaginate": false, //翻页功能
|
||||
|
||||
//表头固定
|
||||
//"fixedHeader": true,
|
||||
//"scrollX": "500px",
|
||||
//"scrollY": "400px",
|
||||
//"scrollCollapse": true,
|
||||
////固定首列,需要引入相应 dataTables.fixedColumns.min.js
|
||||
//"fixedColumns": {
|
||||
// "leftColumns": 2
|
||||
//},
|
||||
//"columnDefs": [{
|
||||
// targets: 0, //第1列
|
||||
// createdCell: function (td, cellData, rowData, row, col) {
|
||||
|
||||
// var rowspan = (row+1)%2;
|
||||
// if (rowspan == 0) {
|
||||
// $(td).remove();
|
||||
// }
|
||||
// else {
|
||||
// $(td).attr('rowspan', 2);
|
||||
// }
|
||||
// }
|
||||
//}],
|
||||
});
|
||||
|
||||
//即时编辑
|
||||
oTable.$('td:not(.Date,.Total,.DataType)').editable(function (value, settings) {
|
||||
var station = this.dataset.station;//站
|
||||
|
||||
var datetime = this.dataset.datetime;//日期
|
||||
var oiID = $("#oiID").val();//内部单号
|
||||
var projectID = $("#projectID").val();//机型
|
||||
SetPPCount(projectID, oiID, station, datetime, value);//修改数量
|
||||
return (value);
|
||||
},
|
||||
{
|
||||
"indicator": '保存中...',//提交处理过程中显示的提示文字
|
||||
"tooltip": '单击编辑...',//鼠标悬停时的提示信息
|
||||
//"cssclass": 'form-control',
|
||||
"width": "60px",
|
||||
"height": "100%",
|
||||
"placeholder": "0",
|
||||
//"style": 'input:{width:60px;}',
|
||||
//"onblur": 'ignore',//方便调试样式
|
||||
});
|
||||
|
||||
$.editable.addInputType('birthday', {
|
||||
element: function (settings, original) {
|
||||
var input = $('<input type="text" size="8" readonly>').datetimepicker({
|
||||
language: 'zh-CN',
|
||||
//locale: moment.locale('zh-CN'),
|
||||
format: 'yyyy/mm/dd',
|
||||
autoclose: 1,
|
||||
startView: 2,
|
||||
minView: 2,
|
||||
});
|
||||
$(this).append(input);
|
||||
return (input);
|
||||
}
|
||||
});
|
||||
|
||||
//即时编辑
|
||||
oTable.$('.Date:not(.Total)').editable(function (value, settings) {
|
||||
var datetime = this.dataset.datetime;//日期
|
||||
var oiID = $("#oiID").val();//内部单号
|
||||
var projectID = $("#projectID").val();//机型
|
||||
SetPPDate(projectID, oiID, datetime, value);
|
||||
return (value);
|
||||
},
|
||||
{
|
||||
"cancel": '取消',//取消编辑按钮的文字
|
||||
"submit": '确定',//确认提交按钮的文字
|
||||
|
||||
"indicator": '保存中...',//提交处理过程中显示的提示文字
|
||||
"tooltip": '单击编辑...',//鼠标悬停时的提示信息
|
||||
//"cssclass": 'form-control',
|
||||
"width": "60px",
|
||||
"height": "100%",
|
||||
"placeholder": "0",
|
||||
"type": 'birthday',
|
||||
//"style": 'input:{width:60px;}',
|
||||
"onblur": 'ignore',//方便调试样式
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//设置计划信息
|
||||
function setPPInfo(res) {
|
||||
$("#customerAbbr").html(res.Data.CustomerAbbr);
|
||||
$("#projectName").html(res.Data.ProjectName);
|
||||
$("#orderNo").html(res.Data.OrderNo);
|
||||
$("#internalNo").html(res.Data.InternalNo);
|
||||
$("#deliveryTime").html(res.Data.DeliveryTimeStr);
|
||||
$("#stationText").html(res.Data.StationText);
|
||||
$("#oiID").val(res.Data.ID);
|
||||
$("#projectID").val(res.Data.ProjectID);
|
||||
|
||||
$("#ppInfo").attr("style", "display:block;");
|
||||
}
|
||||
|
||||
//清除计划信息
|
||||
function removePPInfo() {
|
||||
$("#customerAbbr").html("");
|
||||
$("#projectName").html("");
|
||||
$("#orderNo").html("");
|
||||
$("#internalNo").html("");
|
||||
$("#deliveryTime").html("");
|
||||
$("#stationText").html("");
|
||||
$("#oiID").val("");
|
||||
$("#projectID").val("");
|
||||
|
||||
$("#ppInfo").attr("style", "display:none;");
|
||||
};
|
||||
|
||||
//新增行
|
||||
function fnClickAddRow() {
|
||||
var oiID = $("#oiID").val();//内部单号
|
||||
var projectID = $("#projectID").val();//机型
|
||||
$.ajax({
|
||||
url: "/APP/PPlan/AddPPlanForTB", //"@Url.Action("AddPPlanForTB", "PPlan")",
|
||||
type: "post",
|
||||
data: { "projectID": projectID, "oiID": oiID },
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('提交成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 550,
|
||||
});
|
||||
gotoDetailPartialNew(oiID);
|
||||
}
|
||||
else {
|
||||
$.toastr.error('提交失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function SetPPCount(projectID, oiID, station, datetime, value) {
|
||||
$.ajax({
|
||||
url: "/APP/PPlan/EditPPlanForTB",//"@Url.Action("EditPPlanForTB", "PPlan")",
|
||||
type: "post",
|
||||
data: { "projectID": projectID, "oiID": oiID, "stationName": station, "datetime": datetime, "count": value },
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('提交成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 550,
|
||||
});
|
||||
gotoDetailPartialNew(oiID);
|
||||
}
|
||||
else {
|
||||
$.toastr.error('提交失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function SetPPDate(projectID, oiID, datetime, value) {
|
||||
$.ajax({
|
||||
url: "/APP/PPlan/EditPPlanDate",//"@Url.Action("EditPPlanDate", "PPlan")",
|
||||
type: "post",
|
||||
data: { "projectID": projectID, "oiID": oiID, "datetime": datetime, "upDate": value },
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('提交成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 550,
|
||||
});
|
||||
gotoDetailPartialNew(oiID);
|
||||
}
|
||||
else {
|
||||
$.toastr.error('提交失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
2
Face.Web/Plugin/pplan.min.js
vendored
Normal file
2
Face.Web/Plugin/pplan.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
114
Face.Web/Plugin/user.js
Normal file
114
Face.Web/Plugin/user.js
Normal file
@@ -0,0 +1,114 @@
|
||||
|
||||
//添加会员
|
||||
$("#btnaddUser").click(function () {
|
||||
|
||||
var btnText = $('#btnaddUser').html()
|
||||
$("#btnaddUser").attr("disabled", "true"); //设置禁用按钮
|
||||
$('#btnaddUser').text('提交中...'); //显示提交中
|
||||
|
||||
$("#addUserForm").ajaxSubmit({
|
||||
url: "/APP/Fuser/addUser",
|
||||
type: "post",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('添加成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 2000,
|
||||
callback: function () {
|
||||
location.href = "/APP/Fuser/addUser";
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$.toastr.error('添加失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
|
||||
$('#btnaddUser').removeAttr('disabled')//重置按钮
|
||||
$('#btnaddUser').text(btnText); //还原显示
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#btnaddUser').removeAttr('disabled')//重置按钮
|
||||
$('#btnaddUser').text(btnText); //还原显示
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//会员详情
|
||||
function userDetails(id) {
|
||||
|
||||
// Ajax提交数据
|
||||
$.ajax({
|
||||
url: "/App/Fuser/modifyUser",//@Url.Action("GetDataqueryDetails", "ConditionQuery")",//"APP/login/login", // 提交到controller的url路径
|
||||
type: "get", // 提交方式
|
||||
data: { "ID": id }, // data为String类型,必须为 Key/Value 格式。
|
||||
//dataType: "json", // 服务器端返回的数据类型
|
||||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||||
$("#userDetailsBox").html(res);
|
||||
//$.toastr.success('添加成功');
|
||||
},
|
||||
|
||||
});
|
||||
};
|
||||
//添加管理员
|
||||
function userDetailss() {
|
||||
|
||||
// Ajax提交数据
|
||||
$.ajax({
|
||||
url: "/App/Fuser/addUser",//@Url.Action("GetDataqueryDetails", "ConditionQuery")",//"APP/login/login", // 提交到controller的url路径
|
||||
type: "get", // 提交方式
|
||||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||||
$("#userDetailsBox").html(res);
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//修改会员
|
||||
$("#btnModifyUser").click(function () {
|
||||
|
||||
var btnText = $('#btnModifyUser').html()
|
||||
$("#btnModifyUser").attr("disabled", "true"); //设置禁用按钮
|
||||
$('#btnModifyUser').text('提交中...'); //显示提交中
|
||||
|
||||
$("#modifyUserForm").ajaxSubmit({
|
||||
url: "/APP/user/ModifyUser",
|
||||
type: "post",
|
||||
success: function (res) {
|
||||
if (res.Status == 200) {
|
||||
$.toastr.success('修改成功',
|
||||
{
|
||||
position: 'top-center',
|
||||
time: 2000,
|
||||
callback: function () {
|
||||
location.href = "/APP/User/UserList";
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$.toastr.error('添加失败! <br />' + res.Message, {
|
||||
time: 3000,
|
||||
position: 'top-center'
|
||||
});
|
||||
$('#btnModifyUser').text(btnText); //还原显示
|
||||
$('#btnModifyUser').removeAttr('disabled')//重置按钮
|
||||
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
$('#btnModifyUser').removeAttr('disabled')//重置按钮
|
||||
$('#btnModifyUser').text(btnText); //还原显示
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user