| | |
| | | :span="6" |
| | | v-for="(dataGroup, groupIndex) in jsonData" |
| | | :key="groupIndex" |
| | | |
| | | style="margin-bottom: -20px;" |
| | | style="margin-bottom: -20px" |
| | | > |
| | | <el-card class="json-block" style="width: 300px; margin-bottom: 2px"> |
| | | <el-card class="json-block" style="width: 300px; margin-bottom: 2px;height:200px" :height="groupIndex === 12 ? '190px' : '170px'" > |
| | | <div |
| | | class="button-row" |
| | | style="display: flex; justify-content: space-between" |
| | |
| | | item.button.value === 2 && item.button.name !== 'Clear ID', |
| | | 'yellow-button': |
| | | item.button.value === 1 && item.button.name !== 'Clear ID', |
| | | 'id': item.button.value === 1 && item.button.name === 'Clear ID', |
| | | id: |
| | | item.button.value === 1 && item.button.name === 'Clear ID', |
| | | }" |
| | | >{{ item.button.name }}</el-button |
| | | > |
| | |
| | | item.button.value === 2 && item.button.name !== '清除ID', |
| | | 'yellow-button': |
| | | item.button.value === 1 && item.button.name !== '清除ID', |
| | | 'id': item.button.value === 1 && item.button.name === '清除ID', |
| | | id: item.button.value === 1 && item.button.name === '清除ID', |
| | | }" |
| | | >{{ item.button.name }}</el-button |
| | | > |
| | |
| | | <span |
| | | class="name" |
| | | v-if="groupIndex === 12" |
| | | style="width: 250px" |
| | | style="width: 350px" |
| | | >{{ item.name }}</span |
| | | > |
| | | <span class="name" v-else style="width: 150px">{{ |
| | | item.name |
| | | }}</span> |
| | | |
| | | <el-input |
| | | v-if="item.type === '0'" |
| | | v-if="item.type === '0' && groupIndex==15" |
| | | v-model="item.value" |
| | | @keyup.enter.native="timeout" |
| | | style="width: 300px" |
| | | class="input-box2" |
| | | ></el-input> |
| | | <el-input |
| | | v-else-if="item.type === '0' " |
| | | v-model="item.value" |
| | | readonly="readonly" |
| | | style="width: 300px" |
| | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | this.$set(dataGroup[itemIndex].button, "value", 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | this.$set(dataGroup[itemIndex].button, "value", 1); |
| | | } |
| | | }, |
| | | //范围 0-100 |
| | | timeout(){ |
| | | |
| | | |
| | | const data3 = []; |
| | | const resetButtonValues3 = [this.jsonData[15][0].value]; |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | | data3.unshift([],[]); |
| | | // 在 data3 数组前面添加两个空数组 |
| | | |
| | | // 创建 jsonObject3 对象,并添加 data3 属性 |
| | | const jsonObject3 = { data: data3 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log("Storage wait delay:", jsonString3); |
| | | socket?.send(jsonString3); |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === "清除ID" || currentButtonName === "Clear ID") { |
| | | const data2 = []; |
| | |
| | | } |
| | | |
| | | if ( |
| | | currentButtonName === "Abort/ResumeTasks" || |
| | | currentButtonName === "急停后中止/继续选择" |
| | | currentButtonName === "A01Abort/ResumeTasks" || |
| | | currentButtonName === "A01终止/继续" || |
| | | currentButtonName === "A02Abort/ResumeTasks" || |
| | | currentButtonName === "A02终止/继续" |
| | | ) { |
| | | const data3 = []; |
| | | const resetButtonValues3 = [this.jsonData[13][0].button.value]; |
| | | const resetButtonValues3 = [this.jsonData[13][0].button.value,this.jsonData[14][0].button.value]; |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | initWebSocket() { |
| | | let viewname = "Parameter2"; |
| | | |
| | |
| | | socket.onopen = function () { |
| | | console.log("websocket已打开"); |
| | | }; |
| | | let isMouseInInputBox = false; // 标记鼠标是否在输入框内 |
| | | |
| | | const inputBox = document.querySelectorAll('.input-box2'); |
| | | inputBox.forEach(box => { |
| | | box.addEventListener('mouseenter', () => { |
| | | isMouseInInputBox = true; |
| | | }); |
| | | box.addEventListener('mouseleave', () => { |
| | | isMouseInInputBox = false; |
| | | }); |
| | | }); |
| | | // 收到消息 |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | |
| | | // const inputBox = document.querySelectorAll('.id'); |
| | | // const target = event.target; |
| | | |
| | | if (parms ) { |
| | | if (parms && !isMouseInInputBox) { |
| | | //急停按钮 |
| | | jsonData2[13][0].button.value = obj.jiting[0][0]; |
| | | jsonData2[14][0].button.value = obj.jiting[0][1]; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //清除id |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | jsonData2[15][0].value = obj.timeout[0]; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }; |
| | | |
| | |
| | | .id { |
| | | background-color: green; |
| | | } |
| | | |
| | | </style> |