CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -8,6 +8,7 @@
  <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
  <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
  <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
  <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
  </el-breadcrumb>
  <div>Parameter</div>
  
@@ -17,7 +18,7 @@
    </div>
    <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
      <el-input style="width: 280px;" class="in_mc" v-model="item.name"  readonly></el-input>
      <el-input v-model="item.value" style="width: 80px;"></el-input>
      <el-input v-model.number="item.value" style="width: 80px;" @input="handleChange(index, $event.target.value)"></el-input>
    </div>
  </el-form>
  </div>
@@ -32,20 +33,21 @@
  return {
  record: {
  params: [100, 200, 10, 10, 10, 10],
  xyData: [{ name: "conveyor Velocity(Auto SLOW)", value: 100 },
    { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 10 },
    { name: "B01 B02 TRAVEL JOG Velocity", value: 10 },
    { name: "conveyor Velocity(Manual)", value: 10},
    { name: "B01 B02 TRAVEL JOG Velocity", value: 10},
    { name: "conveyor Velocity(Manual)", value: 10 }],
  canshu: [
  'conveyor Velocity(Auto SLOW)',
  'B01 B02 TRAVEL POS Velocity AUTO',
  'B01 B02 TRAVEL JOG Velocity',
  'conveyor Velocity(Manual)',
  'B01 B02 TRAVEL JOG Velocity',
  'conveyor Velocity(Manual)'
  xyData: [
  { name: "conveyor Velocity(Auto FAST)", value: 0 },
  { name: "conveyor Velocity(Auto SLOW)", value: 0 },
  { name: "conveyor Velocity(Manual)", value: 0 },
  { name: "A01 A02 TURN JOG Velocity", value: 0 },
  { name: "A01 A02 TRAVEL JOG Velocity", value: 0 },
  { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
  { name: "A01 A02 TURN POS Velocity AUTO", value: 0 },
  { name: "A01 A02 TURN POS Velocity manual", value: 0 },
  { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0 },
  { name: "A01 A02 TRAVEL POS Velocity manual", value: 0 },
  { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0 },
  { name: "B01 B02 TRAVEL POS Velocity manual", value: 0 }
  ],
  canshu: []
  },
  messagepack: {
  data: { taskname: "" }
@@ -53,21 +55,19 @@
  queryInfo: {
  data: "1",
  pageSize: 10
  },
  }
  };
  },
  created() {
  this.initWebSocket();
  },
  methods: {
  initWebSocket() {
  let viewname = "action";
  let viewname = "Parameter";
  
    if (typeof WebSocket == "undefined") {
    if (typeof WebSocket === "undefined") {
      console.log("您的浏览器不支持WebSocket");
    } else {
      //console.log("您的浏览器支持WebSocket");
      let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
  
      if (socket != null) {
@@ -112,16 +112,19 @@
      // 发生错误事件
      socket.onerror = function () {
        console.log("websocket发生了错误");
      }
      };
    }
  },
  send() {
  this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组
    this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 转换为整数数组
  console.log(this.messagepack);
  socket?.send(JSON.stringify(this.messagepack));
  },
  handleChange(index, value) {
    this.record.xyData[index].value = value;
}
  }
  }
  };
  </script>
  
  <style>