From 1350665c843a890eab32a43c8768c1bc1495ba49 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 30 五月 2025 15:54:59 +0800
Subject: [PATCH] 重新执行npm install后,生成新的package-lock.json文件

---
 src/views/autoTest.vue |  883 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 883 insertions(+), 0 deletions(-)

diff --git a/src/views/autoTest.vue b/src/views/autoTest.vue
new file mode 100644
index 0000000..0ec644f
--- /dev/null
+++ b/src/views/autoTest.vue
@@ -0,0 +1,883 @@
+<template>
+  <div class="autoTest">
+
+    <!-- 鑿滃崟鏍� strat -->
+    <div class="menu">
+      <div class="menu-left">
+        <div class="menu-left-name">鑷姩鍖栨祴璇�</div>
+        <div class="menu-left-triangle"></div>
+      </div>
+      <div class="menu-right">
+        <div class="link menu-right-item" @click="onGetProductList">閫夋嫨浜у搧鍨嬪彿</div>
+        <div class="link menu-right-item" v-if="!showLeft" @click="showLeft = true">鏄剧ず棰勭疆鎸囦护</div>
+        <div class="link menu-right-item" v-if="showLeft" @click="showLeft = false">闅愯棌棰勭疆鎸囦护</div>
+        <div class="link menu-right-item" @click="onFinishWork()">缁撴潫宸ヤ綔</div>
+      </div>
+    </div>
+    <!-- 鑿滃崟鏍� end -->
+
+    <!-- 鍐呭 strat -->
+    <div class="content">
+      <transition name="slide-fade">
+        <div class="left" v-if="showLeft">
+          <div class="title">
+            <span>棰勭疆鎸囦护</span>
+            <div class="title-slot">
+              <button @click="type = '1'" :class="'title-button link ' + (type == '1' ? 'actived' : '')">娴嬭瘯鎸囦护</button>
+              <button @click="type = '2'" :class="'title-button link ' + (type == '2' ? 'actived' : '')">璁剧疆鎸囦护</button>
+            </div>
+          </div>
+          <div class="content scrollList">
+            <div class="list-item" v-for="item, index in commandList" :key="index">
+              <span class="pro text" :title="`${item.proName}(${item.proType})`">{{ item.proName }}({{ item.proType
+                }})</span>
+              <span class="name text" :title="item.name">{{ item.name }}</span>
+              <span class="value text" :title="item.value">{{ item.value }}</span>
+              <button class="action link" @click="inputValue = item.value"><i class="iconfont icon-shuru" /> 杈撳叆</button>
+              <button class="action link" :disabled="!connStatus" @click="sendMessage(item.value)"><i class="iconfont icon-fasong" /> 鍙戦��</button>
+            </div>
+          </div>
+        </div>
+      </transition>
+      <div class="right">
+        <div class="title">
+          <span>涓插彛閫氫俊宸茶繛鎺�</span>
+          <span :class="'connStatus ' + (connStatus ? 'connected' : 'blink disConnected')"></span>
+          <div class="title-slot">
+            <button v-if="!connStatus" @click="setWebSocketConn" class="title-button link"><i
+                class="iconfont icon-lianjie" />
+              杩炴帴涓插彛閫氫俊</button>
+            <button v-if="connStatus" @click="closeWebSocketConn" class="title-button link"><i
+                class="iconfont icon-lianjie" />
+              鏂紑涓插彛閫氫俊</button>
+            <button @click="messageList = []" class="title-button link"><i class="iconfont icon-qingkong" />
+              娓呯┖閫氫俊璁板綍</button>
+          </div>
+        </div>
+        <div class="messageList scrollList" id="messages">
+          <div v-for="item, index in messageList" :key="index" :class="`messageItem ${item.type}`">
+            <span class="name" v-if="item.type == 'receive'">鏀�</span>
+            <span :class="`content ${item.type}`">{{ item.content }}</span>
+            <span class="name" v-if="item.type == 'send'">鍙�</span>
+          </div>
+        </div>
+        <div class="sendBox">
+          <input v-model="inputValue" placeholder="璇疯緭鍏ユ寚浠�"></input>
+          <button class="send link" :disabled="!connStatus" @click="sendInputMessage"><i class="iconfont icon-fasong" /> 鍙戦��</button>
+          <button class="clear link" @click="inputValue = null"><i class="iconfont icon-qingkong" /> 娓呯┖</button>
+        </div>
+      </div>
+    </div>
+    <!-- 鍐呭 end -->
+
+
+    <!-- 浜у搧鍨嬪彿鍒楄〃 strat -->
+    <Dialog :visible="showProductList">
+      <div class="product-list">
+        <div class="close link" @click="showProductList = false"><i class="close iconfont icon-shanchu" /></div>
+        <div class="title">閫夋嫨浜у搧鍨嬪彿</div>
+        <div class="product-list-wrap scrollList">
+          <div class="product-list-item" v-for="item, index in productList" :key="index">
+            <span class="name">{{ item.name }}</span>
+            <span class="type">{{ item.type }}</span>
+            <span class="action link" @click="onSelectProduct(item)">閫夋嫨</span>
+          </div>
+        </div>
+      </div>
+    </Dialog>
+    <!-- 浜у搧鍨嬪彿鍒楄〃 end -->
+  </div>
+</template>
+
+<script>
+import Dialog from '../components/Dialog.vue'
+
+export default {
+  name: "autoTest",
+  components: {
+    Dialog,
+  },
+  data() {
+    return {
+      isAlert: false, // 纭妗嗙姸鎬�
+      showLeft: true,
+      type: null,
+      showProductList: false,
+      productList: [],
+      connStatus: false,
+      productId: null,
+      productName: null,
+      productType: null,
+      commandList: [],
+      messageList: [],
+      inputValue: null,
+
+    }
+  },
+  computed: {
+
+  },
+  watch: {
+    productId: function (newVal, oldVal) {
+      this.onGetCommandList()
+    },
+    type: function (newVal, oldVal) {
+      this.onGetCommandList()
+    },
+    messageList: {
+      deep: true,
+      handler: function (newVal, oldVal) {
+        setTimeout(() => {
+          var div = document.getElementById('messages')
+          div.scrollTop = div.scrollHeight
+        }, 100)
+      }
+    }
+  },
+  mounted() {
+    // 鎭㈠鐧诲綍鎬�
+    this.onGetLoginInfo()
+    // 鍒囨崲鎸囦护绫诲瀷
+    this.type = '1'
+    // 閾炬帴缃戜覆涓棿浠�
+    this.setWebSocketConn()
+    // 閫氳繃浜嬩欢鎬荤嚎鎺ユ敹鎵弿缁撴灉
+    this.$bus.$off('scanResult')
+    this.$bus.$on('scanResult', (val) => {
+      console.log('[repair] 鎬荤嚎鎺ユ敹 =>', val)
+      this.handleScanVal(val)
+    })
+    // 閫氳繃浜嬩欢鎬荤嚎鎺ユ敹寮圭獥鐘舵��
+    this.$bus.$off('isAlert')
+    this.$bus.$on('isAlert', (val) => {
+      this.isAlert = val
+    })
+  },
+  beforeDestroy() {
+    this.$bus.$off('isAlert')
+    this.$bus.$off('scanResult')
+  },
+  methods: {
+    // 鑾峰彇鐧诲綍淇℃伅
+    onGetLoginInfo() {
+      var that = this;
+      var params = {
+        workId: localStorage.getItem("workId"),
+      };
+      that
+        .$axiosAdmin({
+          method: "get",
+          url: "station/workOrder/getWorkLast",
+          params: params,
+        })
+        .then((res) => {
+          if (res.success && res.content.workType == 6) {
+          } else {
+            localStorage.clear()
+            this.goto('start')
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    // 璺宠浆璺敱
+    goto: function (path) {
+      if (path != this.$route.name) {
+        this.$router.push({
+          name: path,
+        });
+      }
+    },
+    // 鎵爜缁撴灉澶勭悊
+    handleScanVal: function (val) {
+      console.log('[repair] 鎵爜澶勭悊 =>', val)
+      if (this.isAlert) {
+        return
+      }
+      // 鎵爜娉ㄩ攢
+      if (val == '102007') {
+        this.$alert.close()
+        this.onFinishWork()
+        return
+      }
+      // 鎵爜鎻愪氦
+      if (val == '102001' || val == '102006') {
+        if (this.activeTab == 0) {
+          this.handleSubmit(val)
+        }
+        return
+      }
+      // 鎵爜鍙栨秷
+      if (val == '102002') {
+        if (this.activeTab == 0) {
+          this.handleCancel(val)
+        }
+        return
+      }
+      // 杩涘叆宸ヤ綔鍙�
+      if (this.activeTab == 0) {
+        this.onGetDeviceInfo(0, val)
+        return
+      }
+      // 杩涘叆浣滀笟浜哄憳
+      if (this.activeTab == 1) {
+        if (val.substr(0, 3) == '101') {
+          this.handleAddPeople(val)
+        } else {
+          this.$notify({
+            title: '娣诲姞澶辫触',
+            message: '璇锋壂鎻忔纭殑浜哄憳浜岀淮鐮併��',
+            type: 'error'
+          })
+          return
+        }
+        return
+      }
+    },
+    // 缁撴潫宸ヤ綔
+    onFinishWork: function () {
+      var that = this;
+      this.$alert.show({
+        modelTitle: "缁撴潫宸ヤ綔",
+        modelContent: '纭鍚庡皢閫�鍑哄伐浣滅姸鎬侊紝鏄惁缁撴潫褰撳墠宸ヤ綔锛�',
+        callBack: () => {
+          that
+            .$axiosAdmin({
+              method: "post",
+              url: "station/workOrder/logout",
+              params: {
+                workId: localStorage.getItem('workId'),
+              },
+            })
+            .then((res) => {
+              if (res.success == true) {
+                this.$notify({
+                  title: '缁撴潫宸ヤ綔鎴愬姛',
+                  message: `宸查��鍑哄伐浣滃彴锛岃閲嶆柊璁ら宸ヤ綔浠诲姟銆俙,
+                  type: 'success'
+                })
+                this.goto('start')
+                localStorage.clear()
+              } else {
+                this.$notify({
+                  title: '缁撴潫宸ヤ綔澶辫触',
+                  message: res.content,
+                  type: 'error'
+                })
+              }
+            })
+            .catch((err) => {
+              console.log(err);
+            });
+        },
+        cancleBack: () => {
+          this.$alert.close()
+          this.$bus.$off('scanResult')
+          this.$bus.$on('scanResult', (val) => {
+            console.log('[repair] 鎬荤嚎鎺ユ敹 =>', val)
+            this.handleScanVal(val)
+          })
+        }
+      })
+    },
+    // 鑾峰彇浜у搧鍒楄〃
+    onGetProductList: function () {
+      var that = this;
+      that
+        .$axiosAdmin({
+          method: "get",
+          url: "station/assemblyStep/all",
+        })
+        .then((res) => {
+          if (res.success == true) {
+            that.productList = res.content;
+            that.showProductList = true
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    // 閫夋嫨浜у搧
+    onSelectProduct: function (item) {
+      this.productId = item.id
+      this.productName = item.name
+      this.productType = item.type
+      this.showProductList = false
+    },
+    // 鑾峰彇浜у搧棰勭疆鎸囦护
+    onGetCommandList: function () {
+      var that = this;
+      this.commandList = []
+      that
+        .$axiosAdmin({
+          method: "get",
+          url: "station/assemblyStep/getCommand",
+          params: {
+            proId: this.productId,
+            type: this.type,
+          },
+        })
+        .then((res) => {
+          if (res.success == true) {
+            that.commandList = JSON.parse(JSON.stringify(res.content));
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    // 鍒涘缓缃戜覆涓棿浠惰繛鎺�
+    setWebSocketConn: function () {
+      var that = this;
+      if ('WebSocket' in window) {
+        this.webSocketConn = new WebSocket('ws://localhost:65532')
+        this.webSocketConn.onopen = function () {
+          that.connStatus = true
+          that.messageList.push({
+            type: 'system',
+            content: '缃戜覆涓棿浠跺凡杩炴帴'
+          },)
+        }
+        this.webSocketConn.onmessage = function (evt) {
+          that.messageList.push({
+            type: 'receive',
+            content: evt.data
+          },)
+        }
+        this.webSocketConn.onclose = function () {
+          that.connStatus = false
+          that.messageList.push({
+            type: 'system',
+            content: '缃戜覆涓棿浠跺凡鏂紑'
+          },)
+          if (that.sending) {
+            that.sending = false
+            that.messageList.push({
+              type: 'system',
+              content: '宸插仠姝㈤槦鍒楀彂閫�'
+            },)
+          }
+        }
+        this.webSocketConn.onerror = function () {
+          that.messageList.push({
+            type: 'system',
+            content: '缃戜覆涓棿浠惰繛鎺ュ紓甯�'
+          },)
+        }
+      } else {
+        this.$alert('褰撳墠娴忚鍣ㄤ笉鏀寔websocket杩炴帴', "鎻愮ず", {
+          confirmButtonText: "纭畾",
+        });
+      }
+    },
+    // 鏂紑缃戜覆涓棿浠惰繛鎺�
+    closeWebSocketConn: function () {
+      this.webSocketConn.close()
+    },
+    // 娓呯┖閫氫俊璁板綍
+    clearMessageList: function () {
+      this.messageList.splice(0, this.messageList.length)
+    },
+    // 鍙戦�佹寚浠よ緭鍏ユ鍐呭
+    sendInputMessage: function () {
+      var that = this;
+      if (this.inputValue) {
+        this.webSocketConn.send(this.inputValue)
+        this.messageList.push({
+          type: 'send',
+          content: this.inputValue
+        },)
+        // this.inputValue = null
+      } else {
+        this.$alert('璇疯緭鍏ユ寚浠ゅ唴瀹�', "鎻愮ず", {
+          confirmButtonText: "纭畾",
+        })
+      }
+    },
+    // 鍙戦�佹寚浠�
+    sendMessage: function (message) {
+      var that = this;
+      this.webSocketConn.send(message)
+      this.messageList.push({
+        type: 'send',
+        content: message
+      },)
+    },
+  },
+  destroyed() {
+    this.closeWebSocketConn()
+  }
+};
+</script>
+
+<style lang="less" scope>
+.autoTest {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  overflow: hidden;
+
+  // 涓昏彍鍗�
+  .menu {
+    border-bottom: 1px solid #0089ff;
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 30px;
+
+    // 涓昏彍鍗曞乏渚ф爣棰樻爮
+    .menu-left {
+      display: flex;
+
+      .menu-left-name {
+        padding: 0 20px 0 30px;
+        border-radius: 10px 0 0 0;
+        height: 40px;
+        line-height: 40px;
+        background-color: #0089ff;
+        font-size: 20px;
+      }
+
+      .menu-left-triangle {
+        margin-left: -1px;
+        width: 30px;
+        height: 40px;
+        background: linear-gradient(60deg, #0089ff 50%, transparent 50%, transparent 100%);
+      }
+    }
+
+    // 涓昏彍鍗曞彸渚ф寜閽爮
+    .menu-right {
+      display: flex;
+
+      // 涓昏彍鍗曞彸渚ф寜閽爮鎸夐挳
+      .menu-right-item {
+        margin-left: 15px;
+        padding: 0 15px;
+        border-radius: 10px 10px 0 0;
+        height: 40px;
+        line-height: 40px;
+        background-color: #0089ff;
+        font-size: 20px;
+      }
+    }
+  }
+
+  // 涓诲唴瀹�
+  .content {
+    flex-grow: 1;
+    display: flex;
+    justify-content: space-between;
+
+    .left {
+      background-color: #003366;
+      // width: 915px; // 涓�鍗婂搴�
+      width: 1200px;
+      margin-right: 30px;
+      border-radius: 10px;
+      overflow: hidden;
+
+      .content {
+        height: 792px;
+        display: block;
+
+        .list-item {
+          display: flex;
+          justify-content: flex-start;
+          align-items: center;
+          width: 100%;
+          height: 60px;
+          border-bottom: 1px solid #002244;
+          box-sizing: border-box;
+          padding: 0 30px;
+          font-size: 20px;
+
+          .name,
+          .pro {
+            width: 300px;
+          }
+
+          .value {
+            flex-grow: 1;
+            font-weight: 700;
+          }
+
+          .action {
+            display: block;
+            width: 104px;
+            height: 40px;
+            line-height: 40px;
+            text-align: center;
+            border-radius: 10px;
+            font-size: 16px;
+            font-weight: normal;
+            background-color: #002244;
+            color: #fff;
+            margin-right: 10px;
+            border: none;
+            outline: none;
+          }
+
+          .action:last-child {
+            margin-right: 0;
+          }
+        }
+      }
+    }
+
+    .right {
+      background-color: #003366;
+      flex-grow: 1;
+      border-radius: 10px;
+      display: flex;
+      flex-direction: column;
+      overflow: hidden;
+
+      .messageList {
+        height: 711px;
+        display: block;
+
+        .messageItem {
+          display: flex;
+          align-items: flex-start;
+          margin-bottom: 10px;
+
+          .content {
+            min-height: 40px;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            border-radius: 5px;
+            max-width: 400px;
+            word-break: break-all;
+            overflow: hidden;
+            padding: 10px;
+            box-sizing: border-box;
+          }
+
+          .name {
+            display: inline-block;
+            width: 40px;
+            height: 40px;
+            line-height: 40px;
+            text-align: center;
+            margin: 0 10px;
+            font-size: 18px;
+            color: #fff;
+            border-radius: 5px;
+            background-color: #409eff;
+          }
+
+          .send {
+            background-color: #002244;
+            display: block;
+            text-align: left;
+          }
+          
+          .receive {
+            display: block;
+            text-align: left;
+            background-color: #333;
+          }
+        }
+
+        .system {
+          justify-content: center;
+          color: #888;
+          font-size: 14px;
+        }
+
+        .send {
+          align-items: flex-start;
+          justify-content: flex-end;
+        }
+
+        .receive {
+          align-items: flex-start;
+        }
+      }
+
+      .sendBox {
+        height: 80px;
+        border-top: 1px solid #002244;
+        display: flex;
+
+        input {
+          flex-grow: 1;
+          border: none;
+          outline: none;
+          background-color: #003366;
+          padding: 0 20px;
+          font-size: 20px;
+          font-weight: 700;
+          color: #fff;
+        }
+
+        .send,
+        .clear {
+          width: 150px;
+          height: 80px;
+          line-height: 80px;
+          text-align: center;
+          font-size: 22px;
+          font-weight: 700;
+          color: #fff;
+          border: none;
+          outline: none;
+          background-color: #003366;
+          border-left: 1px solid #002244;
+        }
+
+        .send {
+          color: green;
+        }
+
+        .clear {
+          color: red;
+        }
+      }
+    }
+
+    .title {
+      text-align: left !important;
+      padding-left: 30px;
+      display: block;
+      font-size: 26px;
+      text-align: center;
+      height: 80px;
+      line-height: 80px;
+      border-bottom: 1px solid #002244;
+      box-sizing: border-box;
+      font-weight: 700;
+      position: relative;
+
+      .connStatus {
+        display: inline-block;
+        margin-left: 15px;
+        width: 15px;
+        height: 15px;
+        border-radius: 50%;
+      }
+
+      .connected {
+        background-color: #336666;
+        background-color: green;
+      }
+
+      .disConnected {
+        background-color: red;
+      }
+
+      .title-slot {
+        height: 80px;
+        position: absolute;
+        top: 0;
+        right: 20px;
+        display: flex;
+        align-items: center;
+
+        .title-button {
+          height: 40px;
+          line-height: 40px;
+          padding: 0 20px;
+          border-radius: 10px;
+          font-size: 16px;
+          font-weight: normal;
+          background-color: #002244;
+          color: #fff;
+          border: none;
+          outline: none;
+          margin-right: 10px;
+        }
+
+        .title-button:disabled {
+          background-color: #ccc;
+          cursor: not-allowed;
+        }
+
+        .actived {
+          background-color: #0089ff;
+        }
+      }
+    }
+
+  }
+
+  // 浜у搧鍒楄〃
+  .product-list {
+    width: 1150px;
+    height: 700px;
+    background-color: #003366;
+    position: relative;
+
+    .none {
+      width: 100%;
+      height: 450px;
+      line-height: 450px;
+      text-align: center;
+      font-size: 30px;
+    }
+
+    .title {
+      padding-left: 30px;
+      box-sizing: border-box;
+      font-size: 30px;
+      height: 80px;
+      line-height: 80px;
+      border-bottom: 1px solid #002244;
+    }
+
+    .close {
+      position: absolute;
+      display: block;
+      width: 80px;
+      height: 80px;
+      line-height: 80px;
+      text-align: center;
+      font-size: 30px;
+      right: 0;
+      top: 0;
+      color: #fff;
+    }
+
+    .product-list-wrap {
+      width: 100%;
+      height: 100%;
+      // background-color: red;
+      padding-bottom: 80px;
+
+      .product-list-item {
+        font-size: 24px;
+        height: 80px;
+        line-height: 80px;
+        border-bottom: 1px solid #002244;
+        box-sizing: border-box;
+        padding: 0 30px;
+        display: flex;
+        justify-content: space-between;
+
+        .name {
+          width: 500px;
+        }
+
+        .type {
+          width: 500px;
+        }
+
+        .action {
+          text-align: right;
+          width: 90px;
+        }
+
+      }
+    }
+  }
+
+  // 鏂囧瓧婧㈠嚭闅愯棌鍔犳偓鍋滄彁绀�
+  .text {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+  }
+
+}
+button:disabled {
+  color: #616161 !important;
+  cursor: not-allowed;
+}
+.scrollList {
+  overflow: scroll;
+  scrollbar-width: none;
+  /* Firefox */
+  -ms-overflow-style: none;
+  /* IE 10+ */
+}
+
+.scrollList::-webkit-scrollbar {
+  display: none;
+  /* Chrome Safari */
+}
+
+.slide-fade-enter-active {
+  transition: all .1s linear;
+}
+
+.slide-fade-leave-active {
+  transition: all .1s linear;
+
+}
+
+.slide-fade-enter,
+.slide-fade-leave-to
+
+/* .slide-fade-leave-active for below version 2.1.8 */
+  {
+  transform: translateX(-500px);
+  opacity: 0;
+}
+
+/* 瀹氫箟keyframe鍔ㄧ敾锛屽懡鍚嶄负blink */
+@keyframes blink {
+  0% {
+    opacity: 1;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+/* 娣诲姞鍏煎鎬у墠缂� */
+@-webkit-keyframes blink {
+  0% {
+    opacity: 1;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@-moz-keyframes blink {
+  0% {
+    opacity: 1;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@-ms-keyframes blink {
+  0% {
+    opacity: 1;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@-o-keyframes blink {
+  0% {
+    opacity: 1;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+/* 瀹氫箟blink绫�*/
+.blink {
+  color: red;
+  font-size: 46px;
+  animation: blink 1s linear infinite;
+  /* 鍏跺畠娴忚鍣ㄥ吋瀹规�у墠缂� */
+  -webkit-animation: blink 1s linear infinite;
+  -moz-animation: blink 1s linear infinite;
+  -ms-animation: blink 1s linear infinite;
+  -o-animation: blink 1s linear infinite;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.8.0