From a41d9610b074c23f0e5d032f50282da7fb6763a2 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 26 五月 2025 18:31:13 +0800
Subject: [PATCH] 优化巡检记录

---
 igds-dzhwk-web/src/main/resources/static/dzhwk/n2/n2-control.js |  609 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 609 insertions(+), 0 deletions(-)

diff --git a/igds-dzhwk-web/src/main/resources/static/dzhwk/n2/n2-control.js b/igds-dzhwk-web/src/main/resources/static/dzhwk/n2/n2-control.js
new file mode 100644
index 0000000..4c18d6a
--- /dev/null
+++ b/igds-dzhwk-web/src/main/resources/static/dzhwk/n2/n2-control.js
@@ -0,0 +1,609 @@
+var layer;
+var form;
+var viewAB = "01";//01-姝i潰
+var curTask;
+var myChart1;
+var myChart2;
+var myChart3;
+var option1;
+var option2;
+var option3;
+
+/**
+ * 姘旇皟鍔ㄤ綔
+ * 01-鎶借礋鍘�
+ * 02-鎺掓皵
+ * 03-鍏呮爱
+ * 04-鍧囨爱
+ * 30-姘斿瘑鎬ф娴�
+ */
+var MODE_TAG = {
+    TAG_01: "01",
+    TAG_02: "02",
+    TAG_03: "03",
+    TAG_04: "04",
+    TAG_30: "30"
+};
+
+$(function () {
+    layui.use(['layer', 'form'], function () {
+        form = layui.form;
+        layer = layui.layer;
+
+        // 鐩戝惉浠撳簱閫夋嫨
+        form.on('select(select_depotId)', function (obj) {
+            return onDepotChange(obj);
+        });
+
+        initChart();
+
+        // flushN2Mac();
+    });
+
+    // 娣诲姞鍒囨崲鍔ㄤ綔
+    $(".js-tf-btn").click(
+        function () {
+            $(this).addClass("active").siblings(".js-tf-btn").removeClass(
+                "active");
+        });
+
+});
+
+//socket淇℃伅杩斿洖铏曠悊
+function socketOnMessage(pocket) {
+
+};
+
+// 鎸夐挳浜嬩欢鍒囨崲姝e弽闈�
+function toCut(target) {
+    viewAB = target;
+    depotId = $("#depotId").val();
+    if (!depotId) {
+        layer.alert("璇烽�夋嫨浠撳簱");
+        return;
+    }
+
+    var imgPath = "../../img/dzhwk/n2/3_box_00.png";
+    if (target == "02") {
+        imgPath = "../../img/dzhwk/n2/3_box_01.gif";
+    }
+    //鏍规嵁浠诲姟璋冩暣鍥剧墖
+    if (curTask) {
+        imgPath = imgPath.replace(imgName, imgName.substr(0, 1) + "box_" + curTask.modeTag + ".gif");
+    }
+    $("#n2_box_img").attr("src", imgPath);
+};
+
+//鍒囨崲浠撳簱锛屽垽鏂粨搴撶被鍨嬶紝鍒锋柊褰撳墠浠撳簱鏈�鏂版皵浣撴娴嬩俊鎭�
+function onDepotChange(obj) {
+    var selectDepotType = obj.elem[obj.elem.selectedIndex].getAttribute('type');
+    if (selectDepotType == depotType) {
+        renderInfo();
+        renderStatus();
+        toCut(viewAB);
+    } else {
+        changeView(selectDepotType);
+    }
+};
+
+/**
+ * 閫夋嫨浠撳簱鍚庢洿鏂板綋鍓嶄粨搴撶殑鐘舵�侊紝涓昏鏄皵璋冪姸鎬�
+ */
+function renderStatus() {
+    depotId = $("#depotId").val();
+    layer.load(1);
+    var param = {
+        companyId: companyId,
+        deptId: deptId,
+        depotId: depotId
+    };
+    $.ajax({
+        type: "POST",
+        url: "../../basic/n2/query-task-status",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            layer.closeAll();
+            console.log(result);
+            if (result.code == "0000") {
+                curTask = result.data;
+                $("#text_status").text(curTask.autoName);
+            } else {
+                layer.msg("娌℃湁鑾峰彇鍒板綋鍓嶄粨搴撴皵璋冪浉鍏崇姸鎬�");
+            }
+        },
+        error: function () {
+            layer.closeAll();
+            layer.msg("娌℃湁鑾峰彇鍒板綋鍓嶄粨搴撴皵璋冪浉鍏崇姸鎬�");
+        }
+    });
+}
+
+
+/**
+ * 閫夋嫨浠撳簱鍚庣浉鍏充俊鎭洿鏂�
+ */
+function renderInfo() {
+    depotId = $("#depotId").val();
+    layer.load(1);
+    var param = {
+        companyId: companyId,
+        deptId: deptId,
+        depotId: depotId
+    };
+    $.ajax({
+        type: "POST",
+        url: "../../basic/gas/flush-gas-depot",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            layer.closeAll();
+            if (result.code == "0000") {
+                if (result.data.perN2 > 0) {
+                    $("#text_checkDate").text(result.data.receiveDate);
+                    $("#text_n2Max").text(result.data.perN2Max);
+                    $("#text_n2Min").text(result.data.perN2Min);
+                    $("#text_n2Ave").text(result.data.perN2);
+                    $("#text_pressure").text(result.data.pressure);
+                }
+                //浠撳簱淇℃伅
+                if (result.data.depotData) {
+                    $("#text_foodVariety").text(result.data.depotData.foodVarietyName);
+                    $("#text_storeKeeper").text(result.data.depotData.storeKeeperName);
+                }
+            } else {
+                layer.msg("娌℃湁鑾峰彇鍒板綋鍓嶄粨搴撴皵浣撴娴嬩俊鎭�");
+            }
+        },
+        error: function (result) {
+            layer.closeAll();
+            layer.msg("娌℃湁鑾峰彇鍒板綋鍓嶄粨搴撴皵浣撴娴嬩俊鎭�");
+        }
+    });
+}
+
+//浼佷笟椤甸潰
+function changeView(selectDepotType) {
+    //绫诲瀷鏀瑰彉锛岃嚜鍔ㄥ垏鎹㈤〉闈�
+    if (socket) {
+        socket.close();
+    }
+    depotId = $("#depotId").val();
+    window.location.href = "../../basic/n2/gateway?depotId=" + depotId + "&depotType=" + selectDepotType + "&deptId=" + deptId;
+}
+
+/** 瑙嗛鏌ョ湅鐩存帴璺宠浆鍒拌棰戞瑙堥〉闈�**/
+function showVideo() {
+    window.parent.openTab("./basic/security/aerial-video?t=1", "瑙嗛楦熺灠", "aerial-video");
+};
+
+
+//鍒锋柊鍒舵爱鏈轰俊鎭�
+function flushN2Mac() {
+    var param = {
+        companyId: companyId,
+        deptId: deptId
+    };
+    $.ajax({
+        type: "POST",
+        url: "../../basic/n2/get-mac",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            if (result.code == "0000") {
+                renderMac(result.data);
+            } else {
+                layer.alert("娌℃湁鑾峰彇鍒板埗姘満淇℃伅");
+            }
+        },
+        error: function (result) {
+            layer.alert("娌℃湁鑾峰彇鍒板埗姘満淇℃伅");
+        }
+    });
+}
+
+
+function renderMac(macData) {
+    if (!macData) {
+        layer.alert("娌℃湁鑾峰彇鍒板埗姘満淇℃伅");
+        return;
+    }
+    $("#mac_name").text("鍒舵爱鏈�#" + macData.name);
+    if ("Y" == macData.runStatus) {
+        $("#mac_runStatus").text("寮�鍚�");
+        $("#mac_img").attr("src", "../../static/img/dzhwk/n2/mac.gif");
+    }
+    if ("N" == macData.runStatus) {
+        $("#mac_runStatus").text("鍏抽棴");
+        $("#mac_img").attr("src", "../../static/img/dzhwk/n2/mac.png");
+    }
+    if (macData.purity) {
+        option1.title[0].text = macData.purity + "%";
+        myChart1.setOption(option1);
+    }
+    if (macData.pressure) {
+        option2.title[0].text = macData.pressure + "bar";
+        myChart2.setOption(option2);
+    }
+    if (macData.flow) {
+        option3.title[0].text = macData.flow + "Nm鲁/h";
+        myChart3.setOption(option3);
+    }
+}
+
+
+/**
+ * 鏍规嵁鍔ㄤ綔鏍囩鎵ц姘旇皟鍔ㄤ綔
+ *
+ * @param modeTag
+ */
+function doExe(modeTag) {
+    layer.msg("鏆傛湭瀵规帴璁惧锛�");
+    return;
+    depotId = $("#depotId").val();
+    if (!depotId) {
+        layer.alert("璇烽�夋嫨浠撳簱");
+        return;
+    }
+    var param = {
+        depotId: depotId,
+        modeTag: modeTag,
+        companyId: companyId,
+        deptId: deptId
+    };
+    layer.load(1);
+    $.ajax({
+        type: "POST",
+        url: "../../basic/n2/run-auto",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            layer.closeAll();
+            if (result.code == "ORDER_SUCCESS") {
+                addTextStatus(modeTag, null);
+            } else {
+                layer.alert(result.msg);
+            }
+        },
+        error: function (result) {
+            layer.closeAll();
+            layer.alert("鎵ц澶辫触锛�" + result.msg);
+        }
+    });
+}
+
+/**
+ * 鏍囪褰撳墠浠撳簱鐘舵��
+ * @param modeTag  濡傛灉鏈夋爣璁板垯鏍规嵁鏍囪鎵ц
+ * @param msg 濡傛灉鏈変俊鎭垯鐩存帴鏄剧ず淇℃伅
+ */
+function addTextStatus(modeTag, msg) {
+    if (msg) {
+        $("#text_status").text(msg);
+    } else {
+        if (modeTag) {
+            if (MODE_TAG.TAG_01 == modeTag) {
+                msg = "鎶借礋鍘嬫墽琛屼腑鈥︹��"
+            }
+            if (MODE_TAG.TAG_02 == modeTag) {
+                msg = "鎺掓皵鎵ц涓�︹��"
+            }
+            if (MODE_TAG.TAG_03 == modeTag) {
+                msg = "鍏呮爱鎵ц涓�︹��"
+            }
+            if (MODE_TAG.TAG_04 == modeTag) {
+                msg = "鍧囨爱鎵ц涓�︹��"
+            }
+            if (MODE_TAG.TAG_30 == modeTag) {
+                msg = "姘斿瘑鎬ф娴嬫墽琛屼腑鈥︹��"
+            }
+            $("#text_status").text(msg);
+        }
+    }
+}
+
+//寮瑰嚭鍒舵爱鏈烘帶鍒剁獥鍙�,鐩存帴鐢ㄤ竴涓柊椤甸潰
+function showMacControl() {
+    layer.msg("鏆傛湭瀵规帴璁惧锛�");
+    return;
+    layer.open({
+        type: 2,
+        title: "鍒舵爱鏈鸿繙绋嬫搷浣�",
+        area: ['485px', '210px'],
+        shade: 0,
+        content: "../../basic/n2/mac-control",
+        btn: 0,
+        closeBtn: 2
+    });
+}
+
+//鍒濆鍖栧浘琛�
+function initChart() {
+    myChart1 = echarts.init(document.getElementById('chart1'));
+    myChart2 = echarts.init(document.getElementById('chart2'));
+    myChart3 = echarts.init(document.getElementById('chart3'));
+    var getmax = 100;
+    var getvalue = 98;
+    option1 = {
+        tooltip: [],
+        title: [{
+            text: '99%',
+            top: '45%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }, {
+            text: '姘皵绾害',
+            top: '62%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }],
+        angleAxis: {
+            show: false,
+            max: getmax * 360 / 250, //-45搴﹀埌225搴︼紝浜岃�呭亸绉诲�兼槸270搴﹂櫎360搴�
+            type: 'value',
+            startAngle: 215, //鏋佸潗鏍囧垵濮嬭搴�
+            splitLine: {
+                show: false
+            }
+        },
+        barMaxWidth: 10, //鍦嗙幆瀹藉害
+        radiusAxis: {
+            show: false,
+            type: 'category',
+        },
+        //鍦嗙幆浣嶇疆鍜屽ぇ灏�
+        polar: {
+            center: ['50%', '60%'],
+            radius: '160%'
+        },
+        series: [{
+            type: 'bar',
+            data: [{ //涓婂眰鍦嗙幆锛屾樉绀烘暟鎹�
+                value: getvalue,
+                itemStyle: {
+                    color: {
+                        type: 'linear',
+                        x: 0,
+                        y: 0,
+                        x2: 0,
+                        y2: 1,
+                        colorStops: [
+                            {
+                                offset: 0,
+                                color: '#fb8e1e',
+                            },
+                            {
+                                offset: .5,
+                                color: '#77dfa2',
+                            },
+                            {
+                                offset: 1,
+                                color: '#77dfa2',
+                            },
+                        ],
+                    },
+                },
+            }],
+            barGap: '-100%', //鏌遍棿璺濈,涓婁笅涓ゅ眰鍦嗙幆閲嶅悎
+            coordinateSystem: 'polar',
+            roundCap: true, //椤剁鍦嗚
+            z: 3 //鍦嗙幆灞傜骇锛屽悓zindex
+        },
+            { //涓嬪眰鍦嗙幆锛屾樉绀烘渶澶у��
+                type: 'bar',
+                data: [{
+                    value: getmax,
+                    itemStyle: {
+                        color: '#c7cfd9',
+                        opacity: .8,
+                        borderWidth: 0,
+                    },
+                }],
+                barGap: '-100%',
+                coordinateSystem: 'polar',
+                roundCap: true,
+                z: 1
+            },
+        ]
+    };
+    var getmax2 = 100;
+    var getvalue2 = 78;
+    option2 = {
+        title: [{
+            text: '0.0bar',
+            top: '45%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }, {
+            text: '鍑哄彛鍘嬪姏',
+            top: '62%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }],
+        angleAxis: {
+            show: false,
+            max: getmax2 * 360 / 250, //-45搴﹀埌225搴︼紝浜岃�呭亸绉诲�兼槸270搴﹂櫎360搴�
+            type: 'value',
+            startAngle: 215, //鏋佸潗鏍囧垵濮嬭搴�
+            splitLine: {
+                show: false
+            }
+        },
+        barMaxWidth: 10, //鍦嗙幆瀹藉害
+        radiusAxis: {
+            show: false,
+            type: 'category',
+        },
+        //鍦嗙幆浣嶇疆鍜屽ぇ灏�
+        polar: {
+            center: ['50%', '60%'],
+            radius: '160%'
+        },
+        series: [{
+            type: 'bar',
+            data: [{ //涓婂眰鍦嗙幆锛屾樉绀烘暟鎹�
+                value: getvalue2,
+                itemStyle: {
+                    color: {
+                        type: 'linear',
+                        x: 0,
+                        y: 0,
+                        x2: 0,
+                        y2: 1,
+                        colorStops: [
+                            {
+                                offset: 0,
+                                color: '#fb8e1e',
+                            },
+                            {
+                                offset: .5,
+                                color: '#77dfa2',
+                            },
+                            {
+                                offset: 1,
+                                color: '#77dfa2',
+                            },
+                        ],
+                    },
+                },
+            }],
+            barGap: '-100%', //鏌遍棿璺濈,涓婁笅涓ゅ眰鍦嗙幆閲嶅悎
+            coordinateSystem: 'polar',
+            roundCap: true, //椤剁鍦嗚
+            z: 3 //鍦嗙幆灞傜骇锛屽悓zindex
+        },
+            { //涓嬪眰鍦嗙幆锛屾樉绀烘渶澶у��
+                type: 'bar',
+                data: [{
+                    value: getmax,
+                    itemStyle: {
+                        color: '#c7cfd9',
+                        opacity: .8,
+                        borderWidth: 0,
+                    },
+                }],
+                barGap: '-100%',
+                coordinateSystem: 'polar',
+                roundCap: true,
+                z: 1
+            },
+        ]
+    };
+    var getmax3 = 100;
+    var getvalue3 = 75;
+    option3 = {
+        title: [{
+            text: '0.0Nm鲁/h',
+            top: '45%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }, {
+            text: '鍑哄彛娴侀噺',
+            top: '62%',
+            x: 'center',
+            textStyle: {
+                fontSize: 14,
+                color: '#000'
+            }
+        }],
+        angleAxis: {
+            show: false,
+            max: getmax * 360 / 250, //-45搴﹀埌225搴︼紝浜岃�呭亸绉诲�兼槸270搴﹂櫎360搴�
+            type: 'value',
+            startAngle: 215, //鏋佸潗鏍囧垵濮嬭搴�
+            splitLine: {
+                show: false
+            }
+        },
+
+        barMaxWidth: 10, //鍦嗙幆瀹藉害
+        radiusAxis: {
+            show: false,
+            type: 'category',
+        },
+
+        //鍦嗙幆浣嶇疆鍜屽ぇ灏�
+        polar: {
+            center: ['50%', '60%'],
+            radius: '160%'
+        },
+        series: [{
+            type: 'bar',
+            data: [{ //涓婂眰鍦嗙幆锛屾樉绀烘暟鎹�
+                value: getvalue,
+                itemStyle: {
+
+                    color: {
+                        type: 'linear',
+                        x: 0,
+                        y: 0,
+                        x2: 0,
+                        y2: 1,
+                        colorStops: [
+                            {
+                                offset: 0,
+                                color: '#fb8e1e',
+                            },
+                            {
+                                offset: .5,
+                                color: '#77dfa2',
+                            },
+                            {
+                                offset: 1,
+                                color: '#77dfa2',
+                            },
+                        ],
+                    },
+                },
+            }],
+            barGap: '-100%', //鏌遍棿璺濈,涓婁笅涓ゅ眰鍦嗙幆閲嶅悎
+            coordinateSystem: 'polar',
+            roundCap: true, //椤剁鍦嗚
+            z: 3 //鍦嗙幆灞傜骇锛屽悓zindex
+        },
+            { //涓嬪眰鍦嗙幆锛屾樉绀烘渶澶у��
+                type: 'bar',
+                data: [{
+                    value: getmax,
+                    itemStyle: {
+                        color: '#c7cfd9',
+                        opacity: .8,
+                        borderWidth: 0,
+                    },
+                }],
+                barGap: '-100%',
+                coordinateSystem: 'polar',
+                roundCap: true,
+                z: 1
+            },
+        ]
+    };
+    myChart1.setOption(option1);
+    myChart2.setOption(option2);
+    myChart3.setOption(option3);
+    window.addEventListener("resize", function () {
+        myChart1.resize();
+        myChart2.resize();
+        myChart3.resize();
+    });
+}
+

--
Gitblit v1.9.3