123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- var normal = '<div style="width: 10px; height: 10px; display: inline-block; border-radius: 5px; background-color: green;"></div>'
- var abnormal = '<div style="width: 10px; height: 10px; display: inline-block; border-radius: 5px; background-color: red;"></div>'
- var offline = '<div style="width: 10px; height: 10px; display: inline-block; border-radius: 5px; background-color: gray;"></div><span> 离线</span>'
- var online = '<div style="width: 10px; height: 10px; display: inline-block; border-radius: 5px; background-color: green;"></div><span> 在线</span>'
- function getCims() {
- $.ajax({
- url: "/Cim/GetCims",
- method: "GET",
- headers: { "Content-Type": "application/json" },
- async: true,
- data: {
- isShowError: $("#isShowError").prop("checked")
- },
- success: function (result) {
- if (result.code === 0) {
- $("#cims").html("");
- for (var i = 0; i < result.data.length; i++) {
- var html =
- "<div class='col-lg-3'>" +
- "<div class='cim-div'>" +
- "<ul style='list-style: none; padding: 0;'>" +
- "<li style='padding-top: 2px;'><b>" + result.data[i].topic + "</b></li>" +
- "<li style='padding-top: 4px;'>" + (result.data[i].isConnected === true ? online : offline) + "</li>" +
- "<li style='padding-top: 2px;'>IP. " + result.data[i].ipAddress + "</li>" +
- "<li style='padding-top: 2px;'>Name. " + result.data[i].user + "</li>" +
- "<li style='padding-top: 2px;'>PLC. " + (result.data[i].plcIsConnected === true ? normal : abnormal) +
- " / EAP. " + (result.data[i].eapIsConnected === true ? normal : abnormal) + "</li>" +
- "<li style='padding-top: 4px;'>EAP. " + result.data[i].eapip + ":" + result.data[i].eapPort + "</li>" +
- "<li style='padding-top: 4px;'>Ver. " + result.data[i].version + "</li>" +
- "<li style='padding-top: 4px;'>" + result.data[i].time + "</li>" +
- "</ul>" +
- "</div>" +
- "</div>";
- $("#cims").append(html);
- }
- }
- }
- });
- }
- function getChangeShifts() {
- $.ajax({
- url: "/Cim/ChangeShifts",
- method: "GET",
- headers: { "Content-Type": "application/json" },
- async: true,
- success: function (result) {
- if (result.code === 0) {
- $("#changeShift").html("");
- $("#changeShiftLabel").text("未换班机台 " + result.data.length + " 台");
- for (var i = 0; i < result.data.length; i++) {
- var html =
- "<p>" + result.data[i].topic + "</P>";
- $("#changeShift").append(html);
- }
- }
- }
- });
- }
- $("#isShowError").change(function () {
- getCims();
- });
- function Init() {
- getCims();
- getChangeShifts();
- }
- Init();
- setInterval(Init, 10000);
- function modal_issued_show() {
- $("#modal_issued").modal("show");
- }
- var zTreeObj;
- var setting = {
- check: {
- enable: true
- }
- };
- $.ajax({
- url: "/ProductionLine/GetProductionLineMachineTree",
- type: "GET",
- async: true,
- success: function (zNodes) {
- zTreeObj = $.fn.zTree.init($("#productionLineTree"), setting, zNodes);
- }
- });
- function setEap() {
- var nodes = zTreeObj.getCheckedNodes(true);
- if (nodes.length === 0) {
- alert("请勾选设备!");
- return;
- }
- var ids = new Array();
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].level === 1) {
- ids.push(nodes[i].id);
- }
- }
- if (ids.length === 0) {
- alert("请勾选设备!");
- return;
- }
- var ip = $("#eapIp").val();
- var port = $("#eapPort").val();
- if (ip === "" || port === "") {
- alert("请填写 IP/Port!");
- return;
- }
- $.ajax({
- url: "/Cim/SetEAP",
- type: "POST",
- async: true,
- data: {
- "ids": ids.toString(),
- "ip": ip,
- "port": port
- },
- success: function (rev) {
- alert(rev.message);
- }
- });
- }
- function setEapIp() {
- var nodes = zTreeObj.getCheckedNodes(true);
- if (nodes.length === 0) {
- alert("请勾选设备!");
- return;
- }
- var ids = new Array();
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].level === 1) {
- ids.push(nodes[i].id);
- }
- }
- if (ids.length === 0) {
- alert("请勾选设备!");
- return;
- }
- var ip = $("#eapIp1").val();
- if (ip === "") {
- alert("请填写 IP!");
- return;
- }
- $.ajax({
- url: "/Cim/SetEapIp",
- type: "POST",
- async: true,
- data: {
- "ids": ids.toString(),
- "ip": ip
- },
- success: function (rev) {
- alert(rev.message);
- }
- });
- }
- function setUpdateApp() {
- var nodes = zTreeObj.getCheckedNodes(true);
- if (nodes.length === 0) {
- alert("请勾选设备!");
- return;
- }
- var ids = new Array();
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].level === 1) {
- ids.push(nodes[i].id);
- }
- }
- if (ids.length === 0) {
- alert("请勾选设备!");
- return;
- }
- $.ajax({
- url: "/Cim/UpdateApp",
- type: "POST",
- async: true,
- data: {
- "ids": ids.toString()
- },
- success: function (rev) {
- alert(rev.message);
- }
- });
- }
|