wu
2023-12-01 482c178f89c516440628acb70b2f050747f00449
CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -11,29 +11,26 @@
      }}</router-link>
      <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
      }}</router-link>
      <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
        $t('ServoManual') }}</router-link>
         <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
        }}</router-link>
    </el-breadcrumb>
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
        $t('Servomanualone')
        <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Servomanualone')
      }}</router-link>
      <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
      }}</router-link>
      <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
      }}</router-link>
      <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
        $t('Positioning1')
            <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1')
      }}</router-link>
      <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
        $t('Positioning2')
            <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2')
      }}</router-link>
    </el-breadcrumb>
    <el-row :gutter="40">
      <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
        <el-card class="json-block" style="width:260px;">
      <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"   style="margin-bottom: -20px;">
        <el-card class="json-block"  style="width:260px;margin-bottom: 2px;">
          <div class="button-row" style="display: flex; justify-content: space-between;">
            <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
              <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
@@ -44,16 +41,14 @@
            <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
              <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button"
                @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name)"
                :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID', 'red-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{
                  item.button.name }}</el-button>
  :class="{ 'green-button': item.button.value === 0  && item.button.name !== '清除ID','red-button': item.button.value === 2 && item.button.name !== '清除ID' ,'yellow-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ item.button.name }}</el-button>
            </div>
          </div>
          <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
            <div class="item-row">
              <span class="name" style="width:150px;">{{ item.name }}</span>
              <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;"
                class="input-box"></el-input>
              <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly"    style="width:400px;" class="input-box"></el-input>
            </div>
          </div>
@@ -69,6 +64,9 @@
import data from '../../configuration/parameter2'
let socket;
export default {
    destroyed() {
    socket.close();
  },
  name: "Parameter2",
  mixins: [LanguageMixin],
  data () {
@@ -105,13 +103,13 @@
        });
        const values = inputData.flat().filter(item => item !== null).map(item => item.value);
        const jsonObject = { data: values };
        // 提交数据到后端
        const jsonString = JSON.stringify(jsonObject);
        console.log('Type为3的value:', jsonString);
        socket?.send(jsonString);
     window.location.reload();
      }
    },
    initWebSocket () {
@@ -151,8 +149,8 @@
          const parms = obj.params;
          // const xiaoche = obj.params[3];
          console.log(parms);
    //  console.log(parms);
//清除id
          for (let i = 0; i < jsonData2.length; i++) {
            let arr = jsonData2[i];
            for (let j = 0; j < arr.length; j++) {
@@ -164,7 +162,7 @@
          }
//ID
          for (let i = 0; i < jsonData2.length; i++) {
            let arr = jsonData2[i];
            for (let j = 0; j < arr.length; j++) {
@@ -176,7 +174,7 @@
          }
//手动状态
          for (let i = 0; i < jsonData2.length; i++) {
            let arr = jsonData2[i];
            for (let j = 0; j < arr.length; j++) {
@@ -188,7 +186,7 @@
          }
//扫描枪扫码的ID
          jsonData2.forEach((item) => {
            item.forEach((subItem) => {
              if (subItem.read === 66) {
@@ -198,6 +196,8 @@
          });
//A01当前格子
          let lastParmsArray = parms[parms.length - 1];
          let lastParmsIndex = 0;
@@ -236,6 +236,7 @@
          console.log("websocket发生了错误");
        };
      }
    },
    send () {
@@ -252,8 +253,7 @@
.item-row {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  /* 调整每个项目之间的间距 */
  margin-bottom: 5px; /* 调整每个项目之间的间距 */
}
.action-button {
@@ -261,7 +261,6 @@
  background: #66b1ff;
  color: #FFF;
}
.blue-button {
  background-color: skyblue;
}
@@ -273,4 +272,8 @@
.red-button {
  background-color: red;
}
.yellow-button{
  background-color: blue;
}
</style>