From 46adcbf7494340a495539708210bb39110bdc33b Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期六, 29 十一月 2025 17:35:03 +0800
Subject: [PATCH] 快速登记、化验及称重作业页面提交1

---
 fzzy-igdss-web/src/main/resources/static/common/igds-common.js |  238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 238 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-web/src/main/resources/static/common/igds-common.js b/fzzy-igdss-web/src/main/resources/static/common/igds-common.js
new file mode 100644
index 0000000..7213f8f
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/common/igds-common.js
@@ -0,0 +1,238 @@
+//鏍规嵁娴忚鍣ㄤ腑鐨勫湴鍧�鍒濆鍖朩S鐨勮矾寰�
+function initWsUrl() {
+    //http://ibms.fzzygf.com
+    //http://127.0.0.1:8080/igds
+    var href = window.location.href;
+    var arrUrl = href.split("//");
+    href = arrUrl[1];
+    arrUrl = href.split("/");
+    //濡傛灉娌℃湁閰嶇疆contextPath
+    if (arrUrl.length == 1) {
+        return "ws://" + arrUrl[0] + "/websocket";
+    }
+    //濡傛灉contextPath = igds
+    if ("igds" == arrUrl[1]) {
+        return "ws://" + arrUrl[0] + "/" + arrUrl[1] + "/websocket";
+    }
+    //濡傛灉contextPath = zxlk
+    if ("zxlk" == arrUrl[1]) {
+        return "ws://" + arrUrl[0] + "/" + arrUrl[1] + "/websocket";
+    }
+    return "ws://" + arrUrl[0] + "/websocket";
+};
+
+/**
+ *
+ * @param deptId 鍒嗗簱缂栫爜
+ * @param bizType 涓氬姟缂栧彿
+ * @param bizTag 鑷畾涔変笟鍔℃爣绛� 濡傛灉涓簄ull榛樿鍙朿ommon
+ * @param userId 褰撳墠鐢ㄦ埛Id
+ */
+function initWS(deptId, bizType, bizTag, userId) {
+    if (null == bizTag) bizTag = "common";
+    var wsPath = initWsUrl() + "/" + deptId + "/" + bizType + "/" + bizTag + "/" + userId;
+    if (typeof (WebSocket) == "undefined") {
+        layer.msg("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket锛岃浣跨敤涓绘祦娴忚鍣�");
+        return;
+    }
+    // 鍒涘缓杩炴帴
+    var socket = new WebSocket(wsPath);
+    // 鎵撳紑浜嬩欢
+    socket.onopen = function () {
+        socket.send(bizType);
+    };
+    // 鑾峰緱娑堟伅浜嬩欢鏄悗鍙扮┛浠剁殑WebPocket瀵硅薄淇℃伅
+    socket.onmessage = function (result) {
+        var pocket = JSON.parse(result.data);
+        socketOnMessage(pocket);
+    };
+    // 鍏抽棴浜嬩欢
+    socket.onclose = function () {
+        console.log("Socket closed鈥︹��");
+    };
+
+    // 鍏抽棴WebSocket杩炴帴
+    function closeWebSocket() {
+        socket.close();
+    }
+
+    // 鍙戠敓浜嗛敊璇簨浠�
+    socket.onerror = function () {
+        alert("Socket error鈥︹��");
+    };
+
+    $(window).unload(function () {
+        closeWebSocket();
+    });
+}
+
+// 鍑哄叆搴撲笓鐢ㄨ繛鎺ワ紝娣诲姞娴佺▼鑺傜偣鍙傛暟
+function initInoutWS(companyId, bizType, progress, userId) {
+    var wsPath = initWsUrl() + "/" + companyId + "/" + bizType + "/" + progress
+        + "/" + userId;
+    if (typeof (WebSocket) == "undefined") {
+        layer.msg("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket锛岃浣跨敤涓绘祦娴忚鍣�");
+        return;
+    }
+    // 瀹炵幇鍖朩ebSocket瀵硅薄锛屾寚瀹氳杩炴帴鐨勬湇鍔″櫒鍦板潃涓庣鍙� 聽寤虹珛杩炴帴
+    var socket = new WebSocket(wsPath);
+    // 鎵撳紑浜嬩欢
+    socket.onopen = function () {
+        socket.send(bizType);
+    };
+    // 鑾峰緱娑堟伅浜嬩欢鏄悗鍙扮┛浠剁殑WebPocket瀵硅薄淇℃伅
+    socket.onmessage = function (result) {
+        var pocket = JSON.parse(result.data);
+        socketOnMessage(pocket);
+    };
+    // 鍏抽棴浜嬩欢
+    socket.onclose = function () {
+        console.log("Socket closed鈥︹��");
+    };
+
+    // 鍏抽棴WebSocket杩炴帴
+    function closeWebSocket() {
+        socket.close();
+    }
+    // 鍙戠敓浜嗛敊璇簨浠�
+    socket.onerror = function () {
+        alert("Socket error鈥︹��");
+    }
+    $(window).unload(function () {
+        socket.close();
+    });
+};
+
+function INOUT_PROGRESS_MSG(code) {
+    if (InoutProgress.REGISTER == code) return "鐧昏";
+    if (InoutProgress.CHECK == code) return "鍖栭獙";
+    if (InoutProgress.HANDLE == code) return "鍊间粨";
+    if (InoutProgress.WEIGHT_TAG == code) return "绉伴噸";
+    if (InoutProgress.WEIGHT_FULL == code) return "婊¤溅绉伴噸";
+    if (InoutProgress.WEIGHT_EMPTY == code) return "绌鸿溅绉伴噸";
+    if (InoutProgress.PAY == code) return "鏀粯";
+    if (InoutProgress.CARD_BACK == code) return "鍗″洖鏀�";
+    if (InoutProgress.RECORD == code) return "娴佺▼瀹屾垚";
+    return "鏈煡";
+};
+
+/**
+ * 鏍规嵁鐘舵�佺紪鐮佽繑鍥炰腑鏂�
+ * @param code
+ */
+function DEPOT_STATUS_MSG(code) {
+    if (code == DepotStatus.S_01) return "绌轰粨";
+    if (code == DepotStatus.S_02) return "鍏ュ簱涓�";
+    if (code == DepotStatus.S_03) return "灏佷粨";
+    if (code == DepotStatus.S_04) return "鍑哄簱涓�";
+    if (code == DepotStatus.S_05) return "灏佷粨-姘旇皟涓�";
+    if (code == DepotStatus.S_06) return "灏佷粨-鐔忚捀涓�";
+    if (code == DepotStatus.S_07) return "灏佷粨-閫氶涓�";
+    if (code == DepotStatus.S_08) return "灏佷粨-娓╂帶涓�";
+    if (code == DepotStatus.S_09) return "鍏朵粬";
+    return code;
+}
+
+/**
+ * fmt 鏃堕棿鏍煎紡鍖栦緥濡傦細yyyy-MM-dd hh:mm:ss date 鏃堕棿 return 瀛楃涓�
+ */
+function dateFtt(fmt, date) {
+    if (!date) return "";
+    var o = {
+        "M+": date.getMonth() + 1, // 鏈堜唤
+        "d+": date.getDate(), // 鏃�
+        "h+": date.getHours(), // 灏忔椂
+        "m+": date.getMinutes(), // 鍒�
+        "s+": date.getSeconds(), // 绉�
+        "q+": Math.floor((date.getMonth() + 3) / 3), // 瀛e害
+        "S": date.getMilliseconds()
+        // 姣
+    };
+    if (/(y+)/.test(fmt))
+        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "")
+            .substr(4 - RegExp.$1.length));
+    for (var k in o)
+        if (new RegExp("(" + k + ")").test(fmt))
+            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
+                : (("00" + o[k]).substr(("" + o[k]).length)));
+    return fmt;
+}
+
+function dateFtt2(fmt, date) {
+    if (!date) return "";
+    var date2 = new Date(date);
+    return dateFtt(fmt, date2);
+}
+
+// 鍒锋柊鏃堕棿
+function initTime() {
+    setInterval(function () {
+        $("#navBarDate").html(formatDate('mm鏈坉d鏃�', new Date()));
+        $("#navBarTime").html(formatDate('HH:MM:SS', new Date()));
+        $("#navBarWeek").html(getWeekDate());
+    }, 1000);
+}
+
+/**
+ * 鏍煎紡鍖栨棩鏈�
+ *
+ * @param fmt
+ * @param date
+ * @return {*}
+ */
+function formatDate(fmt, date) {
+    var ret;
+    var opt = {
+        "Y+": date.getFullYear().toString(),        // 骞�
+        "m+": (date.getMonth() + 1).toString(),     // 鏈�
+        "d+": date.getDate().toString(),            // 鏃�
+        "H+": date.getHours().toString(),           // 鏃�
+        "M+": date.getMinutes().toString(),         // 鍒�
+        "S+": date.getSeconds().toString()          // 绉�
+        // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆
+    };
+    for (var k in opt) {
+        ret = new RegExp("(" + k + ")").exec(fmt);
+        if (ret) {
+            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
+        }
+    }
+    return fmt;
+}
+
+/**
+ * 鑾峰彇褰撳墠鏄熸湡鍑�
+ */
+function getWeekDate() {
+    var now = new Date();
+    var day = now.getDay();
+    var weeks = new Array("鏄熸湡鏃�", "鏄熸湡涓�", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�");
+    var week = weeks[day];
+    return week;
+}
+
+/**
+ * 鍒囨崲椤甸潰
+ * @param pageTag
+ */
+function changePage(pageTag) {
+    var url = "../dept-board/index";
+
+    if ("inout" == pageTag) {
+        url = "../dept-board/inout";
+    }
+    if ("ai" == pageTag) {
+        url = "../dept-board/ai";
+    }
+    if ("video" == pageTag) {
+        url = "../dept-board/video";
+    }
+    //鍚庡彴绠$悊棣栭〉
+    if ("backstage" == pageTag) {
+        url = "../index";
+        window.parent.open(url, "_self");
+        return;
+    }
+
+    window.location.href = url;
+}

--
Gitblit v1.9.3