From 4aa0b9c9c2c56ec1af1dc3ee8ef12c9374b3d1ff Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 27 十一月 2025 11:36:08 +0800
Subject: [PATCH] 修改车间记录列表数据显示异常问题
---
HTML/js/public.js | 305 ++++++++++++++++++++++++++------------------------
1 files changed, 158 insertions(+), 147 deletions(-)
diff --git a/HTML/js/public.js b/HTML/js/public.js
index ff31e00..f7ca469 100644
--- a/HTML/js/public.js
+++ b/HTML/js/public.js
@@ -1,69 +1,73 @@
//var IP = "http://47.104.149.73:1991";//鎺ュ彛IP
-// var IP = "http://172.16.71.101:8082/";//鎺ュ彛IP
+//var IP = "http://172.16.71.101:8082/";//鎺ュ彛IP
//var IP = "http://localhost:13243/api";
-//var IP = "http://localhost:50515/api"; //鏈湴
-var IP="https://localhost:44363/api";
-// var IP = "http://localhost:44318/api";
+//var IP = "http://localhost:50515/api";//鏈湴
+//var IP = "http://localhost:44318/api";
//var IP = "http://192.168.1.6:8017";
-//var IP = "http://192.168.1.226:8086";
-// var IP = "http://192.168.62.200:8888/api"; //bkl鏈嶅姟鍣�
+//var IP = "http://192.168.1.226:8086";
+//var IP = "http://192.168.62.200:8888/api";//bkl鏈嶅姟鍣�
+//杩愯
+var IP = "https://localhost:44363/api";
+
+
var pageCnt = 15;
var pageLimits = [10, 15, 20, 30, 50, 70, 100];
-function pageCntFirst()
-{
- sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun013", {}, 'get', function (res) {
- console.log(res.data.SetValue)
- if (res.code == 0) { //鎴愬姛
- if(res.data.IsEnable == 'NO')
- {
+function pageCntFirst() {
+ sendData(
+ IP + "/Basis/GetFunSettingByNo?funSetNo=" + "Fun013",
+ {},
+ "get",
+ function (res) {
+ console.log(res.data.SetValue);
+ if (res.code == 0) {
+ //鎴愬姛
+ if (res.data.IsEnable == "NO") {
pageCnt = parseInt(res.data.SetValue);
// console.log(pageLimits.indexOf(pageCnt) == '-1')
- if (pageLimits.indexOf(pageCnt) == '-1')
- {
+ if (pageLimits.indexOf(pageCnt) == "-1") {
pageLimits.push(pageCnt);
-
- pageLimits.sort(function(a,b){
- 銆�銆�return a - b;
- })
+
+ pageLimits.sort(function (a, b) {
+ return a - b;
+ });
}
+ }
}
}
- });
+ );
}
function sendData(url, data, type, callbackFun) {
var deferred = $.Deferred();
if (type != "get") {
data = JSON.stringify(data);
- }
- if (url!=IP+"/WeatherForecast/Login") {
- if (!$.cookie('token')) {
+ }
+ if (url != IP + "/WeatherForecast/Login") {
+ if (!$.cookie("token")) {
callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
- try{
- parent.window.location.href = '/views/Login.html';
- }
- catch(error){
- window.location.href = '/views/Login.html';
+ try {
+ parent.window.location.href = "/views/Login.html";
+ } catch (error) {
+ window.location.href = "/views/Login.html";
}
return;
}
- if(isTokenExpired($.cookie('token'))){
- try{
- parent.window.location.href = '/views/Login.html';
- }
- catch(error){
- window.location.href = '/views/Login.html';
+ if (isTokenExpired($.cookie("token"))) {
+ try {
+ parent.window.location.href = "/views/Login.html";
+ } catch (error) {
+ window.location.href = "/views/Login.html";
}
return;
}
- }
+ }
$.ajax({
url: url,
data: data,
type: type,
headers: {
"Content-Type": "application/json; charset=UTF-8",
- "ToKen":$.cookie('token')
+ ToKen: $.cookie("token"),
},
timeout: 45000,
async: true,
@@ -84,29 +88,29 @@
});
}
function isTokenExpired(token) {
- const tokenParts = token.split('.');
+ const tokenParts = token.split(".");
if (tokenParts.length !== 3) {
return true; // JWT 鏍煎紡涓嶆纭�
}
const payloadBase64 = tokenParts[1];
const payload = JSON.parse(atob(payloadBase64));
-
+
if (!payload || !payload.exp) {
return true; // 娌℃湁鏈夋晥杞借嵎鎴栬�呮病鏈夎繃鏈熸椂闂�
}
-
+
const now = Date.now() / 1000; // 褰撳墠鏃堕棿鎴筹紙绉掞級
const expiration = payload.exp;
-
+
return now >= expiration;
}
function synData(url, data, type, callbackFun) {
var deferred = $.Deferred();
if (type != "get") {
data = JSON.stringify(data);
- }
- if (url!=IP+"/WeatherForecast/Login") {
- if (!$.cookie('token')) {
+ }
+ if (url != IP + "/WeatherForecast/Login") {
+ if (!$.cookie("token")) {
callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
}
}
@@ -116,7 +120,7 @@
type: type,
headers: {
"Content-Type": "application/json; charset=UTF-8",
- "ToKen":$.cookie('token')
+ ToKen: $.cookie("token"),
},
timeout: 45000,
async: false,
@@ -125,7 +129,7 @@
success: function (res, status, xhr) {
callbackFun(res);
},
- error: function (res, status, error) {
+ error: function (res, status, error) {
callbackFun(res, status, error);
// layer.msg(res.statusText, {
// icon: 2,
@@ -140,16 +144,20 @@
if (str == null || str == "" || str == undefined) {
return "";
} else {
- var date = new Date(str
+ var date = new Date(
+ str
//parseInt(str.replace("/Date(", "").replace(")/", ""), 10)
);
Y = date.getFullYear();
- M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1);
- D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
- h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours());
+ M =
+ date.getMonth() + 1 < 10
+ ? "0" + (date.getMonth() + 1)
+ : date.getMonth() + 1;
+ D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
m = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
- return Y +"-"+ M +"-" +D+" " + h+":" + m + ":" + s;
+ return Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s;
}
}
// 鏍规嵁鏃堕棿鎴宠浆鎹负鏃堕棿鏍煎紡:骞�-鏈�-鏃�
@@ -157,7 +165,8 @@
if (str == null || str == "" || str == undefined) {
return "";
} else {
- var date = new Date(str
+ var date = new Date(
+ str
// parseInt(str.replace("/Date(", "").replace(")/", ""), 10)
);
Y = date.getFullYear() + "-";
@@ -215,7 +224,7 @@
console.log(topHeight);
console.log(centerHeight);
- var hh = bodyHeight - topHeight-centerHeight - 26 ;//6鏄痓ody涓婂唴杈硅窛
+ var hh = bodyHeight - topHeight - centerHeight - 26; //6鏄痓ody涓婂唴杈硅窛
return hh;
}
//鑾峰彇闄ゆ悳绱㈡潯浠跺60%楂樺害
@@ -226,103 +235,105 @@
// console.log(bodyHeight);
// console.log(topHeight);
// console.log(centerHeight);
-
- var hh = bodyHeight - topHeight -centerHeight - 26 ;//6鏄痓ody涓婂唴杈硅窛銆�20鏄痩ayui-card-body涓婁笅鍐呰竟璺�
- var h1 = parseInt(hh*0.6)
+
+ var hh = bodyHeight - topHeight - centerHeight - 26; //6鏄痓ody涓婂唴杈硅窛銆�20鏄痩ayui-card-body涓婁笅鍐呰竟璺�
+ var h1 = parseInt(hh * 0.6);
return h1;
}
//鑾峰彇闄ゆ悳绱㈡潯浠跺40%楂樺害
function GetTableBottomHeight() {
var bodyHeight = $("#body").outerHeight();
- var topHeight = $("#top").outerHeight();
+ var topHeight = $("#top").outerHeight();
var centerHeight = $("#center").outerHeight();
-
- var hh = bodyHeight - topHeight-centerHeight - 26 ;//6鏄痓ody涓婂唴杈硅窛
- var h2 = parseInt(hh*0.4)
+ var hh = bodyHeight - topHeight - centerHeight - 26; //6鏄痓ody涓婂唴杈硅窛
+ var h2 = parseInt(hh * 0.4);
return h2;
}
//鑾峰彇闄ゆ悳绱㈡潯浠朵互鍙婇〉绛惧楂樺害
function GetTableTabHeight() {
- var bodyHeight = $("#body").outerHeight();
- var topHeight = $("#top").outerHeight();
- var centerHeight = $("#center").outerHeight();
- var tabHeight = $("#tab").outerHeight();
- // console.log(bodyHeight);
- // console.log(topHeight);
- // console.log(centerHeight);
- // console.log(tabHeight);
-
- var hh = bodyHeight - topHeight-centerHeight-tabHeight - 57 ;//6鏄痓ody涓婂唴杈硅窛
- return hh;
+ var bodyHeight = $("#body").outerHeight();
+ var topHeight = $("#top").outerHeight();
+ var centerHeight = $("#center").outerHeight();
+ var tabHeight = $("#tab").outerHeight();
+ // console.log(bodyHeight);
+ // console.log(topHeight);
+ // console.log(centerHeight);
+ // console.log(tabHeight);
+
+ var hh = bodyHeight - topHeight - centerHeight - tabHeight - 57; //6鏄痓ody涓婂唴杈硅窛
+ return hh;
}
-
+
//鍒ゆ柇鏄惁姝f暣鏁� true 姝f暣鏁� false 鍏朵粬
-function isIntNum(val){
+function isIntNum(val) {
var regPos = /^\d+$/;
//var regNeg = /^\-[1-9][0-9]"*$/;
-
- if (regPos.test(val))//&®Neg.test(val))
- {
- return true;
- }
- else
- {
+
+ if (regPos.test(val)) {
+ //&®Neg.test(val))
+ return true;
+ } else {
return false;
}
}
//鍒ゆ柇鏄惁寮�鍚痶able鍒楄〃鍒楀璋冩暣鍔熻兘銆�
-var isSetColW=false;
-function GetIsSetColW()
-{
- sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun014", {}, 'get', function (res) {
- if (res.code == 0) { //鎴愬姛
- if(res.data.IsEnable == 'NO')
- {
- isSetColW=true;
+var isSetColW = false;
+function GetIsSetColW() {
+ sendData(
+ IP + "/Basis/GetFunSettingByNo?funSetNo=" + "Fun014",
+ {},
+ "get",
+ function (res) {
+ if (res.code == 0) {
+ //鎴愬姛
+ if (res.data.IsEnable == "NO") {
+ isSetColW = true;
+ }
}
}
- });
+ );
}
//鑷畾涔夊垪瀹藉姛鑳斤紝tableId锛氳〃鏍糹d锛孒ref锛氳〃鏍艰幏鍙栨暟鎹柟娉曪紝ColsSysArr锛氳嚜瀹氬垪琛ㄥごurl缂栫爜鍚庢暟鎹�
-function SetTableColW(tableId,Href,ColsSysArr){
- if(isSetColW){
+function SetTableColW(tableId, Href, ColsSysArr) {
+ if (isSetColW) {
//閫氳繃琛ㄦ牸id鑾峰彇琛ㄦ牸琛ㄥご鐨勭偣鍑讳簨浠�
- var target= $('#'+tableId+'').next().find('.layui-table-header');
- target.on('click', '.layui-table-cell', function(){
- var that=this;
- var colText=that.innerText;//鎵惧埌鎵�鐐瑰嚮鍒楃殑鍒楀悕
- if(colText==''){
+ var target = $("#" + tableId + "")
+ .next()
+ .find(".layui-table-header");
+ target.on("click", ".layui-table-cell", function () {
+ var that = this;
+ var colText = that.innerText; //鎵惧埌鎵�鐐瑰嚮鍒楃殑鍒楀悕
+ if (colText == "") {
return;
}
- var colWidth=that.clientWidth+"";//鎵惧埌鎵�鐐瑰嚮鍒楃殑鍒楀
+ var colWidth = that.clientWidth + ""; //鎵惧埌鎵�鐐瑰嚮鍒楃殑鍒楀
ColsSysArr = decodeURIComponent(decodeURIComponent(ColsSysArr));
- var param5={
- Href:Href,
- ColsJson:'',
- ColsSysArr:ColsSysArr,
- ColText:colText,
- ColWidth:colWidth
- };
- sendData(IP + "/Sys/SaveClosUser", param5, 'post', function(res){
- if(res.code === 0){
-
- }else { //涓嶆垚鍔�
-
- }
+ var param5 = {
+ Href: Href,
+ ColsJson: "",
+ ColsSysArr: ColsSysArr,
+ ColText: colText,
+ ColWidth: colWidth,
+ };
+ sendData(IP + "/Sys/SaveClosUser", param5, "post", function (res) {
+ if (res.code === 0) {
+ } else {
+ //涓嶆垚鍔�
+ }
});
});
- }
+ }
}
//娣辨嫹璐�
function deepClone(source) {
- if (typeof source !== 'object' || source == null) {
+ if (typeof source !== "object" || source == null) {
return source;
}
const target = Array.isArray(source) ? [] : {};
for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
- if (typeof source[key] === 'object' && source[key] !== null) {
+ if (typeof source[key] === "object" && source[key] !== null) {
target[key] = deepClone(source[key]);
} else {
target[key] = source[key];
@@ -330,7 +341,7 @@
}
}
return target;
-}
+}
/**
* 灏嗚〃鍗曡祴鍊间负鎸囧畾鐨勫璞�
* @param {Object} data - 鍖呭惈琛ㄥ崟鏁版嵁鐨勫璞�
@@ -339,57 +350,57 @@
function setFormData(data, formSelector) {
var $form = $(formSelector);
- $.each(data, function(key, value) {
- var $field = $form.find('[name=' + key + ']');
+ $.each(data, function (key, value) {
+ var $field = $form.find("[name=" + key + "]");
- if ($field.length > 0) {
- var fieldType = $field.attr('type');
+ if ($field.length > 0) {
+ var fieldType = $field.attr("type");
- switch (fieldType) {
- case 'checkbox':
- if (Array.isArray(value)) {
- $field.each(function() {
- $(this).prop('checked', value.includes($(this).val()));
- });
- } else {
- $field.prop('checked', value);
- }
- break;
- case 'radio':
- $field.filter('[value=' + value + ']').prop('checked', true);
- break;
- default:
- $field.val(value);
- break;
+ switch (fieldType) {
+ case "checkbox":
+ if (Array.isArray(value)) {
+ $field.each(function () {
+ $(this).prop("checked", value.includes($(this).val()));
+ });
+ } else {
+ $field.prop("checked", value);
}
+ break;
+ case "radio":
+ $field.filter("[value=" + value + "]").prop("checked", true);
+ break;
+ default:
+ $field.val(value);
+ break;
}
+ }
});
}
//鍒嗛〉鏍煎紡鍖�
var FnParseData = function (res) {
return {
- "code": res.code == 0 ? 0 : res.code, // 瑙f瀽鎺ュ彛鐘舵��
- "msg": res.msg, // 瑙f瀽鎻愮ず鏂囨湰
- "count": res.data.Total, // 瑙f瀽鏁版嵁闀垮害
- "data": res.data.Items // 瑙f瀽鏁版嵁鍒楄〃
+ code: res.code == 0 ? 0 : res.code, // 瑙f瀽鎺ュ彛鐘舵��
+ msg: res.msg, // 瑙f瀽鎻愮ず鏂囨湰
+ count: res.data.Total, // 瑙f瀽鏁版嵁闀垮害
+ data: res.data.Items, // 瑙f瀽鏁版嵁鍒楄〃
};
-}
+};
//璋冪敤鎵撳嵃
-function openPrintDialog(printData, printType){
+function openPrintDialog(printData, printType) {
layer.open({
type: 2,
- title: '鎵撳嵃',
+ title: "鎵撳嵃",
// content: '../../js/hiprint/custom.html',
- content: '/views/SystemSettings/PrintModule.html',
+ content: "/views/SystemSettings/PrintModule.html",
maxmin: true,
- area: ['100%', '100%'],
+ area: ["100%", "100%"],
data: printData,
success: function (layero, index) {
- var body = layer.getChildFrame('body',index);
- body.find('#printData').val(JSON.stringify(printData));
- body.find('#printType').val(printType);
- }
+ var body = layer.getChildFrame("body", index);
+ body.find("#printData").val(JSON.stringify(printData));
+ body.find("#printType").val(printType);
+ },
});
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0