| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
|
| | |
| | | <span class="name" style="width:300px;">{{ item.name }}</span>
|
| | |
|
| | | <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0' && groupIndex === 0 && (itemIndex === 2)" readonly v-model="item.value"
|
| | | class="input-box"></el-input>
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | |
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 " v-model="item.value" @keyup.enter.native="A01start"
|
| | | class="input-box"></el-input>
|
| | | <el-input style="width: 250px;" v-else-if="(item.state !== 0) && (item.type === '0') && (itemIndex === 2)" v-model="item.value" readonly class="input-box"></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 " v-model="item.value" @keyup.enter.native="A01start($event)"
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | | <el-input style="width: 250px;" v-else-if="(item.state !== 0) && (item.type === '0') && (itemIndex === 2)" v-model="item.value" readonly class="input-box" ></el-input>
|
| | |
|
| | |
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value" @keyup.enter.native="A02start"
|
| | | class="input-box"></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value" @keyup.enter.native="B01start"
|
| | | class="input-box"></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value" @keyup.enter.native="B02start"
|
| | | class="input-box"></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value" @keyup.enter.native="A02start($event)"
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value" @keyup.enter.native="B01start($event)"
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value" @keyup.enter.native="B02start($event)"
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | | <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0'" v-model="item.value"
|
| | | class="input-box"></el-input>
|
| | | class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
|
| | | </div>
|
| | | </div>
|
| | | <div class="button-row" style="display: flex; justify-content: space-between;">
|
| | |
| | | <script>
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | import data from '../../configuration/Manualoneposition'
|
| | | import { throttle } from 'lodash';
|
| | |
|
| | | import ManualonePosition2 from './ManualonePosition2.vue';
|
| | | // import { createWebSocket } from '../../api/websocket.js';
|
| | | let socket;
|
| | | export default {
|
| | | name: "ManualonePosition",
|
| | |
| | |
|
| | |
|
| | | },
|
| | | A01start(){
|
| | | A01start(event){
|
| | |
|
| | | const data = [];
|
| | |
|
| | | for (let i = 0; i < 1; i++) {
|
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
|
| | | |
| | | return { value: item.value };
|
| | | });
|
| | |
|
| | | const values = inputData.map(item => item.value);
|
| | |
|
| | | console.log(values);
|
| | |
|
| | | if (values.length > 0) {
|
| | |
|
| | | let firstValue = values[0];
|
| | | if (!(firstValue >= "1" && firstValue <= "210") && firstValue !== "888" && firstValue !== "1000") {
|
| | | values.shift();
|
| | | this.$message.error("Out of range");
|
| | |
|
| | | return false;
|
| | | }
|
| | | }
|
| | | data.push(values);
|
| | | |
| | | |
| | | }
|
| | | data.push([], [], [],[],[],[]);
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | const jsonString = JSON.stringify(jsonObject);
|
| | | console.log('所有Type为0的value:', jsonString);
|
| | | socket?.send(jsonString);
|
| | |
|
| | | event.target.blur(); // 取消输入框焦点
|
| | | },
|
| | | A02start(){
|
| | | A02start(event){
|
| | | const data = [];
|
| | |
|
| | | for (let i = 1; i < 2; i++) {
|
| | |
| | | });
|
| | |
|
| | | const values = inputData.map(item => item.value);
|
| | | if (values.length > 0) {
|
| | |
|
| | | let firstValue = values[0];
|
| | | if (!(firstValue >= "1" && firstValue <= "210") && firstValue !== "888" && firstValue !== "1000") {
|
| | | values.shift();
|
| | | this.$message.error("Out of range");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | data.unshift([]);
|
| | | data.push(values);
|
| | | }
|
| | |
| | | const jsonString = JSON.stringify(jsonObject);
|
| | | console.log('所有Type为0的value:', jsonString);
|
| | | socket?.send(jsonString);
|
| | |
|
| | | event.target.blur(); // 取消输入框焦点
|
| | | },
|
| | | B01start(){
|
| | | B01start(event){
|
| | | const data = [];
|
| | |
|
| | | for (let i = 2; i < 3; i++) {
|
| | |
| | | const jsonString = JSON.stringify(jsonObject);
|
| | | console.log('所有Type为0的value:', jsonString);
|
| | | socket?.send(jsonString);
|
| | |
|
| | | event.target.blur(); // 取消输入框焦点
|
| | | },
|
| | | B02start(){
|
| | | B02start(event){
|
| | | const data = [];
|
| | |
|
| | | for (let i = 3; i < 4; i++) {
|
| | |
| | | });
|
| | |
|
| | | const values = inputData.map(item => item.value);
|
| | |
|
| | | if (values.length > 0) {
|
| | |
|
| | | let firstValue = values[0];
|
| | | if (!(firstValue >= "106" && firstValue <= "210")) {
|
| | | values.shift();
|
| | | this.$message.error("Out of range");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | data.unshift([], [], []);
|
| | | data.push(values);
|
| | | }
|
| | |
| | | const jsonString = JSON.stringify(jsonObject);
|
| | | console.log('所有Type为0的value:', jsonString);
|
| | | socket?.send(jsonString);
|
| | |
|
| | | event.target.blur(); // 取消输入框焦点
|
| | | },
|
| | | submitDataToBackend (currentButtonName) {
|
| | | if (currentButtonName === 'A01启动' || currentButtonName === 'A01 Start') {
|
| | |
| | | }
|
| | |
|
| | | if (currentButtonName === '故障' || currentButtonName === 'Fault') {
|
| | | return false;
|
| | |
|
| | | const data2 = [];
|
| | | const resetButtonValues = this.jsonData.map(item => {
|
| | | // const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障' || subItem.button.name === 'Fault');
|
| | | const buttonItem = item.find(subItem => subItem.button && ['故障', 'Fault'].includes(subItem.button.name));
|
| | | return buttonItem ? buttonItem.button.value : null;
|
| | | }).filter(value => value !== null);
|
| | | // const data2 = [];
|
| | | // const resetButtonValues = this.jsonData.map(item => {
|
| | | // // const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障' || subItem.button.name === 'Fault');
|
| | | // const buttonItem = item.find(subItem => subItem.button && ['故障', 'Fault'].includes(subItem.button.name));
|
| | | // return buttonItem ? buttonItem.button.value : null;
|
| | | // }).filter(value => value !== null);
|
| | |
|
| | | // 将得到的值添加到 data 数组中
|
| | | data2.push(...resetButtonValues);
|
| | | data2.unshift([], [], [], []);
|
| | | const jsonObject2 = { data:data2 };
|
| | | data.push([],[]);
|
| | | // // 将得到的值添加到 data 数组中
|
| | | // data2.push(...resetButtonValues);
|
| | | // data2.unshift([], [], [], []);
|
| | | // const jsonObject2 = { data:data2 };
|
| | | // data.push([],[]);
|
| | |
|
| | | // 提交数据到后端
|
| | | const jsonString2 = JSON.stringify(jsonObject2);
|
| | | console.log('所有故障的value:', jsonString2);
|
| | | socket?.send(jsonString2);
|
| | | // // 提交数据到后端
|
| | | // const jsonString2 = JSON.stringify(jsonObject2);
|
| | | // console.log('所有故障的value:', jsonString2);
|
| | | // socket?.send(jsonString2);
|
| | |
|
| | |
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if (currentButtonName === '回零' || currentButtonName === 'Zero') {
|
| | | if (currentButtonName === '回零' || currentButtonName === 'Home') {
|
| | |
|
| | | const data2 = [];
|
| | | const resetButtonValues = this.jsonData.map(item => {
|
| | | const buttonItem = item.find(subItem => subItem.button && ['回零', 'Zero'].includes(subItem.button.name));
|
| | | const buttonItem = item.find(subItem => subItem.button && ['回零', 'Home'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null;
|
| | | }).filter(value => value !== null);
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | |
| | |
|
| | | },
|
| | |
|
| | |
| | | };
|
| | |
|
| | | // 收到消息
|
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | | // let isMouseInInputBox = false; // 标记鼠标是否在输入框内
|
| | |
|
| | | // const inputBox = document.querySelectorAll('.input-box');
|
| | | // inputBox.forEach(box => {
|
| | | // box.addEventListener('mouseenter', () => {
|
| | | // isMouseInInputBox = true;
|
| | | // });
|
| | | // box.addEventListener('mouseleave', () => {
|
| | | // isMouseInInputBox = false;
|
| | | // });
|
| | | // });
|
| | |
|
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | |
|
| | | // 添加判断条件:如果光标在输入框内,则不执行后续逻辑
|
| | | if (document.activeElement.tagName.toLowerCase() === 'input') {
|
| | | return;
|
| | | }
|
| | |
|
| | | let obj = JSON.parse(msg.data);
|
| | | // console.log(obj);
|
| | | const jsonData2 = this.jsonData;
|
| | | const weihuiling = obj.weihuiling;
|
| | | const handleMouseMove = throttle(function (event) {
|
| | | const inputBox = document.querySelectorAll('.el-card__body');
|
| | | const target = event.target;
|
| | | if (obj.zuhe1 &&inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
|
| | |
|
| | |
|
| | | if(obj.zuhe1){
|
| | |
|
| | | // console.log(obj);
|
| | | |
| | | // 执行更新逻辑
|
| | | for (let i = 0; i < 4; i++) {
|
| | | jsonData2[i].forEach((item, index) => {
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | | }, 50);
|
| | |
|
| | | document.addEventListener('mouseover', handleMouseMove);
|
| | | |
| | | |
| | |
|
| | |
|
| | | if(obj.zuhe1){
|