From c4b6b51afdd3374735ed5f358457987eaa6e476f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 05 九月 2025 16:55:20 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/lift.html |  878 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 425 insertions(+), 453 deletions(-)

diff --git a/src/main/webapp/views/lift.html b/src/main/webapp/views/lift.html
index 43e400e..1d9253e 100644
--- a/src/main/webapp/views/lift.html
+++ b/src/main/webapp/views/lift.html
@@ -1,484 +1,456 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 <head>
     <meta charset="UTF-8">
-    <title>鎻愬崌鏈虹洃鎺х鐞�</title>
-    <link rel="stylesheet" type="text/css" href="../static/css/normalize.css">
-    <link rel="stylesheet" type="text/css" href="../static/css/common.css">
-    <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
-    <link rel="stylesheet" href="../static/css/lift.css">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>鎻愬崌鏈虹洃鎺х郴缁�</title>
+    <link rel="stylesheet" href="../static/vue/element/element.css">
+    <link rel="stylesheet" href="../static/css/shuttle_page.min.css">
+    <script src="../static/js/shuttle_page.js"></script>
     <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
-    <script type="text/javascript" src="../static/js/layer/layer.js"></script>
-    <script type="text/javascript" src="../static/layui/layui.js"></script>
     <script type="text/javascript" src="../static/js/common.js"></script>
+    <script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
+    <script type="text/javascript" src="../static/vue/element/element.js"></script>
+    <style>
+        body {
+            font-family: 'Noto Sans SC', sans-serif;
+            background-color: #0f172a;
+            color: #e2e8f0;
+        }
+        .card {
+            background-color: #1e293b;
+            border-radius: 0.75rem;
+            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+            transition: all 0.3s ease;
+        }
+        /*.card:hover {*/
+        /*    transform: translateY(-2px);*/
+        /*    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);*/
+        /*}*/
+        .btn {
+            background-color: #3b82f6;
+            color: white;
+            border-radius: 0.5rem;
+            padding: 0.5rem 1rem;
+            transition: all 0.3s ease;
+        }
+        .btn:hover {
+            background-color: #2563eb;
+            transform: translateY(-1px);
+        }
+        .status-active {
+            color: #4ade80;
+        }
+        .status-inactive {
+            color: #f87171;
+        }
+        .progress-bar {
+            height: 0.75rem;
+            border-radius: 0.375rem;
+            background-color: #334155;
+        }
+        .progress-fill {
+            height: 100%;
+            border-radius: 0.375rem;
+            background-color: #4ade80;
+            transition: width 0.5s ease;
+        }
+        .table-striped tbody tr:nth-child(odd) {
+            background-color: #1e293b;
+        }
+        .table-striped tbody tr:nth-child(even) {
+            background-color: #1a2537;
+        }
+    </style>
 </head>
-<body>
-<div style="padding: 10px;height: 100%;float: left;width: 6%">
-    <div class="button-window"></div>
-</div>
-<div style="height: 100%;padding-left: 6%">
-    <div style="padding: 10px;height: 100%">
-        <!-- 鏃ュ織鐩戞帶鏉� -->
-        <div class="log-board">
-            <div class="command-log" id="commandLogId">
-            </div>
-            <div class="lift-state">
-                <table id="lift-state-table">
-                    <thead>
-                    <tr>
-                        <th>鎻愬崌鏈�</th>
-                        <th>宸ヤ綔鍙�</th>
-                        <th>浠诲姟鐘舵��</th>
-                        <th>鎻愬崌鏈洪攣瀹�</th>
-                        <th>浣嶇疆鍒拌揪鍙嶉</th>
-                        <th>鍑嗗灏辩华</th>
-                        <th>杩愯涓�</th>
-                        <th>鑱旀満/鍗曟満</th>
-                        <th>骞冲彴浣嶇疆鍋忓樊鎶ヨ</th>
-                        <th>骞冲彴鎵煩鍋忓樊鎶ヨ</th>
-                        <th>骞冲彴鍥涘悜杞︽娴�</th>
-                        <th>鏈氨缁姸鎬�</th>
-                        <th>浼烘湇1閿欒</th>
-                        <th>浼烘湇2閿欒</th>
-                        <th>浼烘湇3閿欒</th>
-                        <th>浼烘湇4閿欒</th>
-                        <th>鎻愬崌鏈哄疄闄呴�熷害鍙嶉</th>
-                    </tr>
-                    </thead>
-                    <tbody>
-                    </tbody>
-                </table>
-            </div>
-        </div>
-        <!-- 鎻愬崌鏈虹姸鎬� -->
-        <div class="lift-msg">
-            <table id="lift-msg-table">
-                <thead>
-                <tr>
-                    <th>鎻愬崌鏈�</th>
-                    <th>宸ヤ綔鍙�</th>
-                    <th>杈撻�佺嚎鍓嶇鍏夌數鏈夎揣</th>
-                    <th>杈撻�佺嚎姝h浆鍙嶉</th>
-                    <th>杈撻�佺嚎鍙嶈浆鍙嶉</th>
-                    <th>杈撻�佺嚎鐢垫満杩囪浇</th>
-                    <th>杈撻�佺嚎鏈鍏夌數鏈夎揣</th>
-                    <th>杩涜緭閫佺嚎鍗℃墭鐩樻姤璀�</th>
-                    <th>鍑鸿緭閫佺嚎鍗℃墭鐩樻姤璀�</th>
-                    <th>浣滀笟鏍囪</th>
-                </tr>
-                </thead>
-                <tbody>
-                </tbody>
-            </table>
-        </div>
-        <!-- 鎵嬪姩鎿嶄綔 -->
-        <div class="lift-operation">
-            <!-- 閬僵灞� -->
-            <div class="lift-operation-shade">
-                    <span class="lift-operation-shade-span">
-                        WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
-                    </span>
-            </div>
-            <!-- 璁惧浠诲姟閫夋嫨 -->
-            <div class="task-select">
-                <!-- 閫夋嫨 -->
-                <div id="lift-select" class="operator-item">
-                    <span class="select-title">鎻愬崌鏈哄彿</span>
-                    <div class="select-container" id="liftRadioBoxId">
-                        <!--                            <label><input type="radio" name="liftSelect" value="1" checked>&nbsp;1鍙锋彁鍗囨満</label>-->
+<body class="min-h-screen">
+    <div id="app">
+        <div class="container mx-auto px-4 py-8">
+            <!-- 椤堕儴鏍囬鍜岀姸鎬佹爮 -->
+            <div class="flex flex-col md:flex-row justify-between items-center mb-8">
+                <h1 class="text-3xl font-bold text-blue-400 mb-4 md:mb-0">
+                    <i class="fas fa-robot mr-2"></i>鎻愬崌鏈虹洃鎺х郴缁�
+                </h1>
+                <div class="flex items-center space-x-4">
+                    <div class="flex items-center">
+                        <div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
+                        <span>鍦ㄧ嚎: {{ deviceStatusCountMap.online }}</span>
+                    </div>
+                    <div class="flex items-center">
+                        <div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
+                        <span>鏁呴殰: {{ deviceStatusCountMap.error }}</span>
+                    </div>
+                    <div class="flex items-center">
+                        <div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
+                        <span>绂荤嚎: {{ deviceStatusCountMap.offline }}</span>
                     </div>
                 </div>
             </div>
 
-            <!-- 璁惧浠诲姟鎿嶄綔 -->
-            <div class="task-operator">
-                <fieldset>
-                    <legend>鎵嬪姩鎿嶄綔</legend>
-                    <div class="button-group">
-                        <button class="item" onclick="liftOperator(1)">涓婂崌涓�灞�</button>
-                        <button class="item" onclick="liftOperator(2)">涓嬮檷涓�灞�</button>
-                        <button class="item" onclick="liftOperator(3)">鏈夎揣姝h浆</button>
-                        <button class="item" onclick="liftOperator(4)">鏈夎揣鍙嶈浆</button>
-                        <button class="item" onclick="liftOperator(5)">澶嶄綅</button>
+            <!-- 涓昏鐩戞帶鍖哄煙 -->
+            <div class="card p-6 mb-8">
+                <!-- 鎻愬崌鏈虹姸鎬佽〃鏍� -->
+                <div class="card p-6">
+                    <div class="flex justify-between items-center mb-4">
+                        <h2 class="text-xl font-semibold text-blue-300">
+                            <i class="fas fa-list-alt mr-2"></i>鎻愬崌鏈虹姸鎬�
+                        </h2>
+                        <div class="relative">
+                            <select v-model="selectListStatus" class="bg-slate-700 text-white rounded px-3 py-1 pr-8">
+                                <option value="all">鍏ㄩ儴鐘舵��</option>
+                                <option value="online">鍦ㄧ嚎</option>
+                                <option value="idle">绌洪棽</option>
+                                <option value="running">杩愯涓�</option>
+                                <option value="offline">绂荤嚎</option>
+                                <option value="error">鏁呴殰</option>
+                            </select>
+                        </div>
                     </div>
-                </fieldset>
+                    <div class="overflow-auto" style="height: 500px;">
+                        <table class="w-full table-striped">
+                            <thead>
+                            <tr class="text-left text-slate-300 border-b border-slate-600 bg-slate-800 sticky top-0 z-10">
+                                <th class="py-3 px-4">缂栧彿</th>
+                                <th class="py-3 px-4">宸ヤ綔鍙�</th>
+                                <th class="py-3 px-4">PLC宸ヤ綔鍙�</th>
+                                <th class="py-3 px-4">璁惧妯″紡</th>
+                                <th class="py-3 px-4">璁惧鐘舵��</th>
+                                <th class="py-3 px-4">浠诲姟鐘舵��</th>
+                                <th class="py-3 px-4">浠诲姟妯″紡</th>
+                                <th class="py-3 px-4">鍙栬揣鏁版嵁</th>
+                                <th class="py-3 px-4">鏀捐揣鏁版嵁</th>
+                                <th class="py-3 px-4">鍑哄叆搴撴ā寮�</th>
+                                <th class="py-3 px-4">鎵樼洏</th>
+                                <th class="py-3 px-4">灏忚溅</th>
+                                <th class="py-3 px-4">鏁呴殰鐮�</th>
+                                <th class="py-3 px-4">灞�</th>
+                                <th class="py-3 px-4">绔欑偣淇℃伅</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+                                <tr v-for="(item,idx) in liftList" :key="idx" class="hover:bg-slate-700">
+                                    <td class="py-3 px-4">{{ item.liftNo }}</td>
+                                    <td class="py-3 px-4">{{ item.taskNo }}</td>
+                                    <td class="py-3 px-4">{{ item.plcTaskNo }}</td>
+                                    <td class="py-3 px-4">{{ item.model$ }}</td>
+                                    <td class="py-3 px-4">{{ item.deviceStatus$ }}</td>
+                                    <td class="py-3 px-4">{{ item.protocolStatus$ }}</td>
+                                    <td class="py-3 px-4">{{ item.taskMode$ }}</td>
+                                    <td class="py-3 px-4">{{ item.pick }}</td>
+                                    <td class="py-3 px-4">{{ item.put }}</td>
+                                    <td class="py-3 px-4">{{ item.iOMode$ }}</td>
+                                    <td class="py-3 px-4">{{ item.hasTray ? '鏈�':'鏃�' }}</td>
+                                    <td class="py-3 px-4">{{ item.hasCar ? '鏈�':'鏃�' }}</td>
+                                    <td class="py-3 px-4">{{ item.errorCode }}</td>
+                                    <td class="py-3 px-4">{{ item.lev }}</td>
+                                    <td class="py-3 px-4">
+                                        <div v-for="(sta,id) in item.liftStaProtocols" :key="id">
+                                            {{ sta.lev }}灞傦紝鎵樼洏锛歿{ sta.hasTray ? 'Y':'N' }}锛屽皬杞︼細{{ sta.hasCar ? 'Y':'N' }}
+                                        </div>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+
+            <!-- 鎿嶄綔鎺у埗鍖哄煙 -->
+            <div class="card p-6 mb-8">
+                <h2 class="text-xl font-semibold text-blue-300 mb-4">
+                    <i class="fas fa-sliders-h mr-2"></i>鎺у埗闈㈡澘
+                </h2>
+                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-2">
+                    <div class="bg-slate-700 p-4 rounded-lg">
+                        <h3 class="text-lg font-medium mb-2">璁惧鎺у埗</h3>
+                        <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
+                            <div>
+                                <el-input @change="changeControlLiftNo" v-model="controlData.liftNo" style="width: 150px;" placeholder="缂栧彿"></el-input>
+                            </div>
+                            <div>
+                                <el-input v-model="controlData.sourceStaNo" style="width: 200px;" placeholder="婧愮珯"></el-input>
+                            </div>
+                            <div>
+                                <el-input v-model="controlData.staNo" style="width: 200px;" placeholder="鐩爣绔�"></el-input>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="bg-slate-700 p-4 rounded-lg">
+                        <h3 class="text-lg font-medium mb-2">璁惧鎸囦护</h3>
+                        <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
+                            <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('movePallet')">
+                                <i class="fas fa-level-up mr-1"></i>绉诲姩鎵樼洏
+                            </button>
+                            <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('switchShuttle')">
+                                <i class="fas fa-level-down mr-1"></i>灏忚溅鎹㈠眰
+                            </button>
+                            <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('move')">
+                                <i class="fas fa-battery-three-quarters mr-1"></i>绉诲姩
+                            </button>
+                            <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('reset')">
+                                <i class="fas fa-home mr-1"></i>澶嶄綅
+                            </button>
+                        </div>
+                    </div>
+                </div>
             </div>
 
         </div>
-        <!-- 鎻愬崌鏈烘棩蹇楄緭鍑� -->
-        <div class="lift-output-board">
-            <textarea id="lift-output"></textarea>
-        </div>
     </div>
-</div>
 </body>
-</html>
+
 <script>
-    // 绌虹櫧琛屾暟
-    var liftStateTableBlankRows = 0;
-    var liftMsgTableBlankRows = 0;
-    // 瀹為檯琛屾暟
-    var liftStateTableFullRows = 0;
-    var liftMsgTableFullRows = 0;
-    // 鍒濆鍖�
-    var liftOutputDom = document.getElementById("lift-output");
-    $(document).ready(function() {
-        initliftStateTable();
-        getliftStateInfo();
-        initliftMsgTable();
-        getliftMsgInfo();
-        operatorBlockShow();
-        setliftRadio();
-    });
-
-    setInterval(function () {
-        getliftStateInfo()
-        getliftMsgInfo();
-    },1000)
-    setInterval(function () {
-        getliftOutput();
-        operatorBlockShow();
-    },500);
-
-    // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
-    function operatorBlockShow() {
-        if (parent.systemRunning) {
-            $('.lift-operation').css("opacity", "0.5");
-            $('.lift-operation-shade').show();
-            $('.lift-operation-shade-span').show();
-        }  else {
-            $('.lift-operation').css("opacity", "1");
-            $('.lift-operation-shade').hide();
-            $('.lift-operation-shade-span').hide();
-        }
-    }
-
-    var layerIdx;
-    $(document).on('click ','.pos-btn', function () {
-        let liftNo = Number($(this).parent().attr("data-liftNo"));
-        layerIdx = layer.open({
-            type: 1,
-            title: false,
-            shadeClose: true,
-            offset: [$(this).offset().top + 30 + 'px', $(this).offset().left + 'px'],
-            anim: 5,
-            shade: [0],
-            area: ['310px', '370px'],
-            closeBtn: 0,
-            content: $("#lift-detl"),
-            success: function(layero, index){
-                http.get(baseUrl+ "/lift/detl/"+liftNo, null, function (res) {
-                    $('#liftNo').val(liftNo);
-                    $('#workNo').val(res.data.workNo);
-                    $('#row').val(res.data.row);
-                    $('#bay').val(res.data.bay);
-                    $('#lev').val(res.data.lev);
-                    $('#crnNo').val(res.data.crnNo);
-                    $('#pakMk').val(res.data.pakMk);
-                })
+    var app = new Vue({
+        el: '#app',
+        data: {
+            ws: null,
+            liftList: [], //鎻愬崌鏈洪泦鍚�
+            liftAllList: [],
+            selectListStatus: "all",
+            deviceStatusCountMap: {},
+            controlData: {
+                liftNo: "",
+                taskNo: "",
+                sourceLocNo: "",
+                targetLocNo: ""
             },
-            end: function () {
-                $('#liftNo').val("");
-                $('#workNo').val("");
-                $('#row').val("");
-                $('#bay').val("");
-                $('#lev').val("");
-                $('#crnNo').val("");
-                $('#pakMk').val("");
-            }
-        })
-    })
+            controlLiftInfo: null,
+        },
+        created() {
+            this.init()
+        },
+        watch: {
 
-    var layerIdx0;
-    $(document).on('click ','.mode-btn', function () {
-        let liftNo = Number($(this).parent().attr("data-liftNo"));
-        layerIdx0 = layer.open({
-            type: 1,
-            title: false,
-            shadeClose: true,
-            offset: [$(this).offset().top + 30 + 'px', $(this).offset().left + 'px'],
-            anim: 5,
-            shade: [0],
-            area: ['70%', '85%'],
-            closeBtn: 0,
-            content: $("#lift-detl2"),
-            success: function(layero, index){
-                console.log(liftNo)
-                http.get(baseUrl+ "/lift/sensor/detl/"+liftNo, null, function (res) {
-                    $('#liftNo1').val(res.data.liftNo);
-                    getColor(res.data.pakInTask,'#pakInTask');
-                    getColor(res.data.pakOutTask,'#pakOutTask');
-                    getColor(res.data.pakMoveTask,'#pakMoveTask');
-                    getColor(res.data.goHpTask,'#goHpTask');
-                    getColor(res.data.goOHpTask,'#goOHpTask');
-                    getColor(res.data.goHpAvoid,'#goHpAvoid');
-                    getColor(res.data.goOHpAvoid,'#goOHpAvoid');
-                    getColor(res.data.pakInEmpty,'#pakInEmpty');
-                    getColor(res.data.pakInFinish,'#pakInFinish');
-                    getColor(res.data.pakOutEmpty,'#pakOutEmpty');
-                    getColor(res.data.pakOutFinish,'#pakOutFinish');
-                    getColor(res.data.goHpAvoidFinish,'#goHpAvoidFinish');
-                    getColor(res.data.goOHpAvoidFinish,'#goOHpAvoidFinish');
-                    getColor(res.data.goHpAvoidErr,'#goHpAvoidErr');
-                    getColor(res.data.goOHpAvoidErr,'#goOHpAvoidErr');
-                })
+        },
+        methods: {
+            init() {
+                this.consoleInterval = setInterval(() => {
+                    this.websocketConnect();
+
+                    this.getLiftStateInfo() //鑾峰彇鎻愬崌鏈轰俊鎭�
+                }, 1000)
             },
-            end: function () {
-                $('#liftNo').val("");
-            }
-        })
-    })
+            getLiftStateInfo() {
+                this.sendWs(JSON.stringify({
+                    "url": "/lift/table/lift/state",
+                    "data": {}
+                }))
+            },
+            setLiftStateInfo(res) {
+                // 鎻愬崌鏈轰俊鎭〃鑾峰彇
+                if (res.code == 200) {
+                    let list = res.data;
 
-    function getColor(res,e){
-        $(e).val(res?"鉁�":"鈥�");
-        if (res){
-            $(e).attr("style", "color: #FD482C;");
-        }else {
-            $(e).attr("style", "color: #00FF00;");
-        }
-    }
+                    let allList = []
+                    let runningList = []
+                    let idleList = []
+                    let errorList = []
+                    let offlineList = []
+                    let onlineList = []
 
-    $(document).on('click ','#save', function () {
-        http.post(baseUrl+ "/lift/detl/update", {
-            liftNo: $('#liftNo').val(),
-            workNo: $('#workNo').val(),
-            row:  $('#row').val(),
-            bay: $('#bay').val(),
-            lev:  $('#lev').val(),
-            crnNo: $('#crnNo').val(),
-            pakMk: $('#pakMk').val(),
-        }, function (res) {
-            layer.msg("淇敼鎴愬姛", {icon: 1,});
-            layer.close(layerIdx);
-        })
-    })
+                    list.forEach((item) => {
+                        allList.push(item)
 
-    $(document).on('click ','#cancel', function () {
-        layer.close(layerIdx);
-    })
-
-    function setliftRadio() {
-        $.ajax({
-            url: baseUrl+ "/lift/table/lift/state",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                if (res.code === 200){
-                    let table = res.data;
-                    for (let i=1;i<=table.length;i++){
-                        //娓叉煋鎻愬崌鏈洪�夐」html
-                        let liftRadioBox = '<label><input type="radio" name="liftSelect" ';
-                        if (i === 1) {
-                            liftRadioBox += 'checked '
+                        if(item.protocolStatusType == "WORKING") {
+                            runningList.push(item)
                         }
-                        liftRadioBox += 'value="' + table[i - 1].liftNo + '">&nbsp;' + table[i - 1].liftNo + '鍙锋彁鍗囨満</label>'
-                        $("#liftRadioBoxId").append(liftRadioBox)
 
+                        if(item.protocolStatusType == "IDLE") {
+                            idleList.push(item)
+                        }
 
-                        //娓叉煋鎻愬崌鏈烘暟鎹淮鎶ゅ拰璁惧淇℃伅html
-                        let liftCommandLogBox = '<div class="lift-command-item" data-liftNo="' + table[i - 1].liftNo + '">\n' +
-                            '<label>' + table[i - 1].liftNo + '#</label>\n' +
-                            '</div>'
-                        $("#commandLogId").append(liftCommandLogBox);
+                        if(item.errorCode > 0) {
+                            errorList.push(item)
+                        }
+
+                        if (item.protocolStatusType == "NONE") {
+                            offlineList.push(item)
+                        }else {
+                            onlineList.push(item)
+                        }
+                    })
+
+                    if (this.selectListStatus == "all") {
+                        this.liftList = allList;
+                    }else if (this.selectListStatus == "running") {
+                        this.liftList = runningList;
+                    }else if (this.selectListStatus == "idle") {
+                        this.liftList = idleList;
+                    }else if (this.selectListStatus == "error") {
+                        this.liftList = errorList;
+                    }else if (this.selectListStatus == "offline") {
+                        this.liftList = offlineList;
+                    }else if (this.selectListStatus == "online") {
+                        this.liftList = onlineList;
                     }
-                } else if (res.code === 403){
-                    window.location.href = baseUrl+"/login";
-                }  else {
-                    console.log(res.msg);
+
+                    let tmpMap = {
+                        idle: idleList.length,
+                        running: runningList.length,
+                        error: errorList.length,
+                        offline: offlineList.length,
+                        online: idleList.length + runningList.length,
+                    }
+                    this.deviceStatusCountMap = tmpMap;
+
+                    this.liftAllList = allList;
+                    if (this.controlLiftInfo != null) {
+                        allList.forEach((item) => {
+                            if(item.liftNo == this.controlLiftInfo.liftNo) {
+                                this.controlLiftInfo = item;
+                            }
+                        });
+                    }
+                }
+            },
+            liftOperator(type) {
+                let that = this;
+                if (this.controlData.liftNo == null || this.controlData.liftNo == "") {
+                    this.$message({
+                        message: '璇疯緭鍏ヨ澶囩紪鍙�',
+                        type: 'warning'
+                    });
+                    return;
+                }
+
+                let requestParam = {
+                    liftNo: this.controlData.liftNo
+                };
+
+                if (type == 'movePallet') {
+                    if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ユ簮绔�',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    if (this.controlData.staNo == null || this.controlData.staNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ョ洰鏍囩珯',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    requestParam.liftTaskMode = 1;
+                    requestParam.sourceStaNo = this.controlData.sourceStaNo;
+                    requestParam.staNo = this.controlData.staNo;
+                }else if (type == 'switchShuttle') {
+                    if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ユ簮绔�',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    if (this.controlData.staNo == null || this.controlData.staNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ョ洰鏍囩珯',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    requestParam.liftTaskMode = 2;
+                    requestParam.sourceStaNo = this.controlData.sourceStaNo;
+                    requestParam.staNo = this.controlData.staNo;
+                }else if (type == 'move') {
+                    if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ユ簮绔�',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    if (this.controlData.staNo == null || this.controlData.staNo == "") {
+                        this.$message({
+                            message: '璇疯緭鍏ョ洰鏍囩珯',
+                            type: 'warning'
+                        });
+                        return;
+                    }
+
+                    requestParam.liftTaskMode = 3;
+                    requestParam.sourceStaNo = this.controlData.sourceStaNo;
+                    requestParam.staNo = this.controlData.staNo;
+                }else if (type == 'reset') {
+                    requestParam.liftTaskMode = 9996;
+                }
+
+                $.ajax({
+                    url: baseUrl + "/lift/operator/lift",
+                    headers: {'token': localStorage.getItem('token')},
+                    method: 'POST',
+                    data: requestParam,
+                    success: function (res) {
+                        if (res.code === 200) {
+                            that.$message({
+                                message: res.msg,
+                                type: 'success'
+                            });
+                        } else if (res.code === 403) {
+                            window.location.href = baseUrl + "/login";
+                        } else {
+                            that.$message({
+                                message: res.msg,
+                                type: 'warning'
+                            });
+                        }
+                    }
+                });
+            },
+            changeControlLiftNo() {
+                let liftNo = this.controlData.liftNo;
+                if (liftNo == null || liftNo == "") {
+                    this.controlLiftInfo = null
+                }
+
+                this.liftAllList.forEach((item) => {
+                    if (item.liftNo == liftNo) {
+                        this.controlLiftInfo = item;
+                    }
+                });
+            },
+            websocketConnect() {
+                if (this.ws == null) {
+                    this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
+                    this.ws.onopen = this.webSocketOnOpen
+                    this.ws.onerror = this.webSocketOnError
+                    this.ws.onmessage = this.webSocketOnMessage
+                    this.ws.onclose = this.webSocketClose
+                }
+            },
+            webSocketOnOpen(e) {
+                console.log("open");
+            },
+            webSocketOnError(e) {
+                this.ws = null;
+                console.log(e);
+            },
+            webSocketOnMessage(e) {
+                const result = JSON.parse(e.data);
+                if (result.url == "/lift/table/lift/state") {
+                    this.setLiftStateInfo(JSON.parse(result.data))
+                }
+            },
+            webSocketClose(e) {
+                this.ws = null;
+                console.log("close");
+            },
+            sendWs(message) {
+                if (this.ws == null) {
+                    return;
+                }
+
+                if (this.ws.readyState == WebSocket.OPEN) {
+                    this.ws.send(message);
                 }
             }
-        });
-    }
-
-    // 鎻愬崌鏈轰俊鎭〃鑾峰彇 ---- 琛ㄤ竴
-    function getliftStateInfo() {
-        let tableEl = $('#lift-state-table');
-        $.ajax({
-            url: baseUrl+ "/lift/table/lift/state",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                if (res.code === 200){
-                    let table = res.data;
-                    if (table.length > liftStateTableBlankRows && table.length !== liftStateTableFullRows) {
-                        initliftStateTable(table.length-liftStateTableBlankRows);
-                        liftStateTableFullRows = table.length;
-                    }
-                    for (let i=1;i<=table.length;i++){
-                        // $("#mode-"+table[i-1].liftNo).html(table[i-1].statusVal===0?'鑱旀満':'鑴辨満');
-                        let tr = tableEl.find("tr").eq(i);
-                        setVal(tr.children("td").eq(0), table[i-1].liftNo);
-                        setVal(tr.children("td").eq(1), table[i-1].taskNo);
-                        setVal(tr.children("td").eq(2), table[i-1].protocolStatus);
-                        setVal(tr.children("td").eq(3), table[i-1].liftLock$);
-                        setVal(tr.children("td").eq(4), table[i-1].positionArrivalFeedback$);
-                        setVal(tr.children("td").eq(5), table[i-1].ready$);
-                        setVal(tr.children("td").eq(6), table[i-1].running$);
-                        setVal(tr.children("td").eq(7), table[i-1].mode$);
-                        setVal(tr.children("td").eq(8), table[i-1].platPositionDeviationAlarm$);
-                        setVal(tr.children("td").eq(9), table[i-1].platTorqueDeviationAlarm$);
-                        setVal(tr.children("td").eq(10), table[i-1].platShuttleCheck$);
-                        setVal(tr.children("td").eq(11), table[i-1].notReady$);
-                        setVal(tr.children("td").eq(12), table[i-1].servoError1);
-                        setVal(tr.children("td").eq(13), table[i-1].servoError2);
-                        setVal(tr.children("td").eq(14), table[i-1].servoError3);
-                        setVal(tr.children("td").eq(14), table[i-1].servoError4);
-                        setVal(tr.children("td").eq(14), table[i-1].liftActualSpeed);
-                    }
-                } else if (res.code === 403){
-                    window.location.href = baseUrl+"/login";
-                }  else {
-                    console.log(res.msg);
-                }
-            }
-        });
-    }
-
-    // 鎻愬崌鏈烘暟鎹〃鑾峰彇 ---- 琛ㄤ簩
-    function getliftMsgInfo() {
-        let tableEl = $('#lift-msg-table');
-        $.ajax({
-            url: baseUrl+ "/lift/table/lift/msg",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                if (res.code === 200){
-                    var table = res.data;
-                    if (table.length > liftMsgTableBlankRows && table.length !== liftMsgTableFullRows) {
-                        initliftMsgTable(table.length-liftMsgTableBlankRows);
-                        liftMsgTableFullRows = table.length;
-                    }
-                    for (var i=1;i<=table.length;i++){
-                        var tr = tableEl.find("tr").eq(i);
-                        setVal(tr.children("td").eq(0), table[i-1].liftNo);
-                        setVal(tr.children("td").eq(1), table[i-1].workNo);
-                        setVal(tr.children("td").eq(2), table[i-1].lineFrontHasStock$);
-                        setVal(tr.children("td").eq(3), table[i-1].forwardRotationFeedback$);
-                        setVal(tr.children("td").eq(4), table[i-1].reverseFeedback$);
-                        setVal(tr.children("td").eq(5), table[i-1].motorOverload$);
-                        setVal(tr.children("td").eq(6), table[i-1].lineEndHasStock$);
-                        setVal(tr.children("td").eq(7), table[i-1].inConveyLineCardTrayAlarm$);
-                        setVal(tr.children("td").eq(8), table[i-1].outConveyLineCardTrayAlarm$);
-                        setVal(tr.children("td").eq(9), table[i-1].pakMk);
-                    }
-                } else if (res.code === 403){
-                    window.location.href = baseUrl+"/login";
-                }  else {
-                    console.log(res.msg);
-                }
-            }
-        });
-    }
-
-    // 鎻愬崌鏈烘棩蹇楄緭鍑� -----------------------------------------------------------------------
-    function getliftOutput() {
-        $.ajax({
-            url: baseUrl + "/lift/output/lift",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                if (res.code === 200) {
-                    liftOutput(res.data);
-                } else if (res.code === 403) {
-                    window.location.href = baseUrl + "/login";
-                } else {
-                    console.log(res.msg);
-                }
-            }
-        })
-    }
-
-    // 浠诲姟鎸囦护涓嬪彂
-    function liftOperator(liftTaskMode) {
-        http.post(baseUrl+"/lift/operator/lift", {
-            liftNo: $('input[name="liftSelect"]:checked').val(),
-            liftTaskMode: liftTaskMode,
-        }, function (res) {
-            layer.msg(res.msg, {icon: 1});
-        });
-    }
-
-
-    // ------------------------------------------------------------------------------------------------
-
-    // 鎻愬崌鏈轰俊鎭〃鑾峰彇  ----- 琛ㄤ竴
-    function initliftStateTable(row) {
-        let line;
-        if (row === undefined){
-            let one = $('#lift-state-table thead').height();
-            let total = $('.lift-state').height();
-            let count = total / one;
-            count = parseInt(count) - 1;
-            liftStateTableBlankRows = count;
-            line = count;
-        } else {
-            line = row;
         }
-        let html = "";
-        for (let i = 0; i < line; i ++){
-            html += " <tr>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "     </tr>\n";
-        }
-        $('#lift-state-table tbody').after(html);
-    }
-
-    // 鎻愬崌鏈烘暟鎹〃鑾峰彇  ----- 琛ㄤ簩
-    function initliftMsgTable(row) {
-        let line;
-        if (row === undefined){
-            let one = $('#lift-msg-table thead').height();
-            let total = $('.lift-msg').height();
-            let count = total / one;
-            count = parseInt(count) - 1;
-            liftMsgTableBlankRows = count;
-            line = count;
-        } else {
-            line = row;
-        }
-        let html = "";
-        for (let i = 0; i < line; i ++){
-            html += " <tr>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "       <td></td>\n" +
-                "     </tr>\n";
-        }
-        $('#lift-msg-table tbody').after(html);
-    }
-
-    // 鏃ュ織杈撳嚭妗�
-    function liftOutput(content){
-        liftOutputDom.value += content;
-        liftOutputDom.scrollTop = liftOutputDom.scrollHeight;
-    }
-
+    })
 </script>
+</html>
\ No newline at end of file

--
Gitblit v1.9.1