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/recir/recir-renderDevice-pfc.js |  237 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 237 insertions(+), 0 deletions(-)

diff --git a/igds-dzhwk-web/src/main/resources/static/dzhwk/recir/recir-renderDevice-pfc.js b/igds-dzhwk-web/src/main/resources/static/dzhwk/recir/recir-renderDevice-pfc.js
new file mode 100644
index 0000000..a6f67d8
--- /dev/null
+++ b/igds-dzhwk-web/src/main/resources/static/dzhwk/recir/recir-renderDevice-pfc.js
@@ -0,0 +1,237 @@
+var viewAB = "01";// 榛樿姝i潰
+
+/**
+ * 鏍规嵁璁惧鍒楄〃娓叉煋璁惧绀烘剰鍥撅紝瑕佹眰琚覆鏌撶殑divID = device_view
+ *
+ * @param listDevice
+ */
+renderDevice = function (listDevice) {
+    // 棣栧厛娓呯┖div涓殑鍐呭
+    $("#device_view").empty();
+
+    // 鏍规嵁璁惧鍒楄〃娣诲姞鍘熷瀷淇℃伅
+    addDevice(listDevice, viewAB);
+};
+
+// 鍒囨崲鍥剧墖a=姝i潰锛宐=鑳岄潰
+function cutImg(depotId, target) {
+    $("#device_view").empty();
+
+    var imgPath = "../../img/dzhwk/depot/pfc_a.png";
+    if (target == "02") {
+        imgPath = "../../img/dzhwk/depot/pfc_b.png";
+    }
+
+    $("#device_view").html('<img style="width: 100%;" src="'+imgPath+'"/>');
+    viewAB = target;
+};
+
+
+// 鍔ㄦ�佹坊鍔犺澶囦俊鎭�
+function addDevice(list) {
+    if (!list || list.length == 0)
+        return;
+    var mainImg = $("#device_view");
+    var parentLeft = mainImg.offset().left, parentTop = mainImg.offset().top;
+
+    var temp;
+    var left = 0, top = 0;
+    var imgResult;
+    $.each(list, function (index, item) {
+        left = parentLeft + item.posX - 15;
+        top = parentTop + item.posY - 10;
+        // console.log(item.name+"---"+left +"---"+top);
+
+        temp = "";
+        if (viewAB == item.location) {
+            imgResult = getStatusImg(item);
+
+            temp += "<div id='" + item.id + "' class='device' " + "depotid='"
+                + item.depotId + "' name='" + item.name + "' type='"
+                + item.type + "' passcode='" + item.passCode + "' serid='"
+                + item.serId + "' link='" + item.link + "' status='"
+                + item.status + "' onclick=showControl('" + item.id
+                + "') style='left:" + left + "px;top:" + top + "px;'>";
+
+            if (imgResult.statusImg.indexOf("gif") > 0) {
+                if (DeviceType.TYPE_04 == item.type) {
+                    temp += "<img class='img_device' src='" + imgResult.statusImg+ "' style='height:35px;' />";
+                } else {
+                    temp += "<img class='img_device' src='" + imgResult.statusImg + "' />";
+                }
+            } else {
+                if (DeviceType.TYPE_04 == item.type) {
+                    temp += "<img class='img_device' src='" + imgResult.statusImg+ "' style='height:35px;' />";
+                } else {
+                    temp += "<img class='img_device' src='" + imgResult.statusImg + "' />";
+                }
+            }
+            //琛ㄧず鏈夋晠闅�
+            if (imgResult.errorTag) {
+                temp += "<i class='err-img'></i>";
+            }
+            temp += "</div>";
+            mainImg.append(temp);
+        }
+    });
+};
+
+// 鏍规嵁璁惧绫诲瀷鍜岀姸鎬侊紝鑾峰彇褰撳墠璁惧鐨勬樉绀虹姸鎬佸浘鐗�
+function getStatusImg(item) {
+    var result = {
+        statusImg: null,
+        errorTag: false
+    };
+    if (DeviceType.TYPE_05 == item.type) {
+        if (!item.status || DeviceStatus.ERROR == item.status || DeviceStatus.ZERO == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_05_CLOSE.png";
+            result.errorTag = true;
+            return result;
+        }
+        result.statusImg = "/img/dzhwk/device/STATUS_05_CLOSE.png";
+        if (DeviceStatus.CLOSE == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_05_CLOSE.png";
+            return result
+        }
+        if (DeviceStatus.OPEN == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_05_OPEN.gif";
+            return result;
+        }
+    }
+    //鐜祦椋庢満
+    if (DeviceType.TYPE_04 == item.type) {
+        if (!item.status || DeviceStatus.ERROR == item.status || DeviceStatus.ZERO == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_04_CLOSE.png";
+            result.errorTag = true;
+            return result;
+        }
+        if (DeviceStatus.CLOSE == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_04_CLOSE.png";
+            return result;
+        }
+        if (DeviceStatus.F_CLOSE == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_04_CLOSE.png";
+            return result;
+        }
+        if (DeviceStatus.OPEN == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_04_OPEN.gif";
+            return result;
+        }
+        if (DeviceStatus.F_OPEN == item.status) {
+            result.statusImg = "/img/dzhwk/device/STATUS_04_OPEN.gif";
+            return result;
+        }
+    }
+    //绌鸿皟闃�闂�
+    if (DeviceType.TYPE_071 == item.type) {
+        if (!item.status){
+            result.statusImg = "/img/dzhwk/device/CIR_07_CLOSE.png";
+            result.errorTag = true;
+            return result;
+        }
+        if (DeviceStatus.ERROR == item.status){
+            result.statusImg = "/img/dzhwk/device/CIR_07_CLOSE.png";
+            return result;
+        }
+        if (DeviceStatus.CLOSE == item.status){
+            result.statusImg = "/img/dzhwk/device/CIR_07_CLOSE.png";
+            return result;
+        }
+        if (DeviceStatus.OPEN == item.status){
+            result.statusImg = "/img/dzhwk/device/CIR_07_OPEN.png";
+            return result;
+        }
+    }
+    return result;
+};
+
+// 鏍规嵁CSS鏍囩鎺у埗閭d簺缁勪欢鏀寔鎷栨嫿.device
+function dragDevice() {
+    var tips = $(".device");
+    if (tips.length == 0) {
+        return;
+    }
+    var container = $("#device_view");
+    var parentLeft = container.offset().left, parentTop = container.offset().top;
+    // console.log("parentLeft=" + parentLeft);
+    // console.log("parentTop=" + parentTop);
+    var maxX = 1800, maxY = 1000;
+    $.each(tips, function (index, item) {
+        var dd = new Dragdrop({
+            target: item,
+            area: [0, maxX, 0, maxY],
+            callback: function (obj) {
+                //console.log('x:' + (obj.moveX) + ' y:' + (obj.moveY));
+            }
+        });
+        dd.dragAll();
+    });
+};
+
+// 淇濆瓨璁惧浣嶇疆淇℃伅
+function updatePos() {
+    var tips = $(".device");
+    if (tips.length == 0) {
+        return;
+    }
+    var container = $("#device_view");
+    var parentLeft = container.offset().left, parentTop = container.offset().top;
+    // 灏佽鏁版嵁杩涜淇濆瓨
+    var data = new Array();
+    var id = null, curDepotId = null;
+    var offset;
+
+    $.each(tips, function (index, item) {
+        id = item.id;
+        curDepotId = item.getAttribute("depotid");
+        offset = $('#' + id).offset();
+        data[index] = {
+            bizId: id,
+            depotId: curDepotId,
+            selfTag: viewAB,
+            posX: offset.left - parentLeft,
+            posY: offset.top - parentTop
+        };
+    });
+    console.log(JSON.stringify(data));
+    $.ajax({
+        type: 'POST',
+        url: "../../basic/control/update-temp-pos",
+        dataType: 'JSON',
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(data),
+        success: function (result) {
+            layer.msg(result.msg);
+        },
+        error: function (result) {
+            layer.msg(result.msg);
+        }
+    });
+};
+
+/**
+ * 鏍规嵁璁惧绫诲瀷鍜岀洰鏍囩姸鎬侊紝璋冩暣鍔ㄧ敾鏁堟灉
+ *
+ * @param deviceType
+ *            璁惧绫诲瀷
+ * @param targetStatus
+ *            鐩爣鐘舵��
+ * @param isEnd
+ *            鏄惁鎵ц瀹屾垚
+ */
+function updateAnimate(deviceType, targetStatus, isEnd) {
+    // 鑾峰彇鍔ㄦ晥鐨勬搷浣�
+    var img = "/img/dzhwk/device/STATUS_05_CLOSE.png";
+    if (targetStatus == DeviceStatus.CLOSE) {
+        img = "/img/dzhwk/device/ANIMATE_05_CLOSE.gif";
+        if (isEnd)
+            img = "/img/dzhwk/device/STATUS_05_CLOSE.png";
+    }
+    if (targetStatus == DeviceStatus.OPEN) {
+        img = "/img/dzhwk/device/ANIMATE_05_OPEN.gif";
+        if (isEnd)
+            img = "/img/dzhwk/device/STATUS_05_OPEN.png";
+    }
+
+    $("#img_animate").attr('src', img);
+}
\ No newline at end of file

--
Gitblit v1.9.3