| | |
| | | }}</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/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') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</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/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Automatic State') |
| | | }}</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> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualJog') |
| | | }}</router-link> |
| | | |
| | | <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition') |
| | | }}</router-link> |
| | | |
| | | <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/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Address parameter settings') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning2') |
| | | }}</router-link> --> |
| | | |
| | | <!-- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition2') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Speed parameter settings') |
| | | }}</router-link> |
| | | |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="26"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:auto;"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;"> |
| | | <el-card class="json-block" style="width:auto;margin-bottom: 10px;"> |
| | | <el-row > |
| | | <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12"> |
| | | <div class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style='width:230px;'>{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input> |
| | | |
| | | <el-input v-if="item.type === '0' && groupIndex === 0" v-model="item.value" @keyup.enter.native="zuhe1" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input> |
| | | <el-input v-else-if="item.type === '0' && groupIndex === 1" v-model="item.value" @keyup.enter.native="zuhe2" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input> |
| | | <el-input v-else-if="item.type === '0' " v-model="item.value" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <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': true, 'error-button': item.button.name === '故障' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | |
| | | <el-button v-if="item.button && language === 'en-US' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1,'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'error-button3': item.button.name === 'NotZero' && item.button.value === 1,'fuwei': item.button.name === 'Reset' && item.button.value === 1,'huiling': item.button.name === 'Home' && item.button.value === 1,'qidong': item.button.name === 'A01 Semi-Auto' && item.button.value === 1,'qidong2': item.button.name === 'A02 Semi-Auto' && item.button.value === 1,'qidong3': item.button.name === 'A01 Semi-Auto Start' && item.button.value === 1,'qidong4': item.button.name === 'A02 Semi-Auto Start' && item.button.value === 1,'qidong5': item.button.name === 'A02 Semi-Auto' && item.button.value === 1,'jiting': item.button.name === 'Abort/ResumeTasks' && item.button.value === 1,'yihuiling': item.button.name === 'Zero' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | <el-button v-if="item.button && language === 'zh-CN' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1,'error-button3': item.button.name === '未回零' && item.button.value === 1,'error-button2': item.button.name === '未回零' && item.button.value === 0,'fuwei': item.button.name === '复位' && item.button.value === 1,'huiling': item.button.name === '回零' && item.button.value === 1,'qidong': item.button.name === 'A01半自动' && item.button.value === 1,'qidong2': item.button.name === 'A02半自动' && item.button.value === 1,'qidong3': item.button.name === 'A01半自动启动' && item.button.value === 1,'qidong4': item.button.name === 'A02半自动启动' && item.button.value === 1,'qidong5': item.button.name === 'A02半自动' && item.button.value === 1,'jiting': item.button.name === '急停后中止/继续选择' && item.button.value === 1,'yihuiling': item.button.name === '已回零' && item.button.value === 1 }" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/ServoManualone' |
| | | import { throttle } from 'lodash'; |
| | | |
| | | let socket; |
| | | export default { |
| | | name: "ServoManualone", |
| | | mixins: [LanguageMixin], |
| | | |
| | | data() { |
| | | return { |
| | | jsonData: data , |
| | | |
| | | language:this.$i18n.locale, |
| | | zhi:"1", |
| | | zhi2:"1" |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | |
| | | activated(){ |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | const language = this.$i18n.locale; |
| | | // console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | |
| | | |
| | | |
| | | }, |
| | | // destroyed(){ |
| | | // this.close(); |
| | | // this.$router.go(0); |
| | | // }, |
| | | methods: { |
| | | closeSocket() { |
| | | // 关闭 WebSocket 连接 |
| | | socket.close(); |
| | | }, |
| | | |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | } |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === '半自动启动') { |
| | | const data = []; |
| | | zuhe1(){ |
| | | |
| | | for (let i = 0; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 9999).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | |
| | | } |
| | | |
| | | |
| | | data.push([], [], []); |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 9999).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | |
| | | } |
| | | data.push([], [],[]); |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | }, |
| | | zuhe2(){ |
| | | |
| | | const data2 = []; |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 8888).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values2 = inputData.map(item => item.value); |
| | | |
| | | data2.push(values2); |
| | | |
| | | } |
| | | data2.unshift([]); |
| | | |
| | | data2.push([], [],[]); |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 8888).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values2 = inputData.map(item => item.value); |
| | | |
| | | data2.push(values2); |
| | | data2.push( [],[], []); |
| | | |
| | | } |
| | | |
| | | |
| | | const jsonObject = { data:data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | |
| | | //A01半自动启动提交 |
| | | if (currentButtonName === 'A01半自动启动' ||currentButtonName === 'A01 Semi-Auto Start') { |
| | | const data = []; |
| | | |
| | | |
| | | const values = [this.jsonData[0][10].button.value] |
| | | |
| | | data.push(values); |
| | | |
| | | |
| | | data.unshift([], [],[],[], [],[],[], []); |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | //A02半自动启动 提交 |
| | | |
| | | if (currentButtonName === 'A02半自动启动' ||currentButtonName === 'A02 Semi-Auto Start') { |
| | | const data2 = []; |
| | | |
| | | const values2 = [this.jsonData[1][8].button.value] |
| | | |
| | | data2.push(values2); |
| | | |
| | | |
| | | data2.unshift([],[], [],[],[], [],[],[], []); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const jsonObject = { data:data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | //复位提交 |
| | | |
| | | if (currentButtonName === '复位' || currentButtonName === 'Reset') { |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && ['复位', 'Reset'].includes(subItem.button.name)); |
| | | |
| | | |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(resetButtonValues.flat()); |
| | | |
| | | // 在 data2 数组前面添加两个空数组 |
| | | data2.unshift([], []); |
| | | data2.push([], [], [], [], []); |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data2 属性 |
| | | const jsonObject2 = { data: data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | |
| | | } |
| | | ////回零提交 |
| | | if (currentButtonName === '回零' || currentButtonName === 'Home') { |
| | | const data3 = []; |
| | | const resetButtonValues3 = this.jsonData.map(item => { |
| | | const buttonItem3 = item.find(subItem => subItem.button && ['回零', 'Home'].includes(subItem.button.name)); |
| | | |
| | | return buttonItem3 ? buttonItem3.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | | |
| | | // 在 data3 数组前面添加两个空数组 |
| | | data3.unshift([], [], []); |
| | | data3.push([], [], [], []); |
| | | |
| | | // 创建 jsonObject3 对象,并添加 data3 属性 |
| | | const jsonObject3 = { data: data3 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log('回零:', jsonString3); |
| | | socket?.send(jsonString3); |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //A01半自动提交 |
| | | |
| | | if (currentButtonName === 'A01半自动' || currentButtonName === 'A01 Semi-Auto' ) { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | this.zhi=1; |
| | | // if(this.jsonData[0].button.name==='A01半自动' || this.jsonData[0].button.name === 'A01 Semi-Auto'){ |
| | | // this.jsonData[0].button.value=1 |
| | | // } |
| | | |
| | | |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A01半自动" || obj2.button.name === "A01 Semi-Auto")) { |
| | | obj2.button.value = 1; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | }else{ |
| | | elements[i].style.display = 'none'; |
| | | this.zhi=0; |
| | | // if(this.jsonData[0].button.name==='A01半自动' || this.jsonData[0].button.name === 'A01 Semi-Auto'){ |
| | | // this.jsonData[0].button.value=0 |
| | | // } |
| | | |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A01半自动" || obj2.button.name === "A01 Semi-Auto")) { |
| | | obj2.button.value = 0; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | data.push([this.zhi]); |
| | | |
| | | data.unshift([],[],[],[],[],[]); |
| | | data.push([]); |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | const jsonObject2 = { data2 }; |
| | | if (currentButtonName === 'A02半自动' || currentButtonName === 'A02 Semi-Auto' ) { |
| | | // 获取所有class为special-class2的元素 |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | |
| | | const data = []; |
| | | // 遍历所有元素 |
| | | for (let i = 0; i < elements.length; i++) { |
| | | // 如果元素隐藏 |
| | | if (elements[i].style.display === 'none') { |
| | | // 显示元素 |
| | | elements[i].style.display = ''; // 显示元素 |
| | | this.zhi2=1; |
| | | // 遍历jsonData |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | // 遍历arr |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | // 如果button的name为A02半自动或者A02 Semi-Auto |
| | | if (obj2.button && (obj2.button.name === "A02半自动" || obj2.button.name === "A02 Semi-Auto")) { |
| | | // 设置button的value为1 |
| | | obj2.button.value = 1; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }else{ |
| | | // 如果元素显示 |
| | | elements[i].style.display = 'none'; |
| | | this.zhi2=0; |
| | | // 遍历jsonData |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | // 遍历arr |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | // 如果button的name为A02半自动或者A02 Semi-Auto |
| | | if (obj2.button && (obj2.button.name === "A02半自动" || obj2.button.name === "A02 Semi-Auto")) { |
| | | // 设置button的value为0 |
| | | obj2.button.value = 0; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 将zhi2添加到data数组中 |
| | | data.push([this.zhi2]); |
| | | |
| | | // 将data数组添加到jsonObject中 |
| | | data.unshift([],[],[],[],[],[],[]); |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | |
| | | } |
| | | if (currentButtonName === 'A01半自动') { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (currentButtonName === 'A02半自动') { |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | let socketUrl = "ws://" +this.$t('ip')+ ":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | | socket = null; |
| | | } |
| | | |
| | | // 开启一个websocket服务 |
| | | socket = new WebSocket(socketUrl); |
| | | |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | // console.log(obj) |
| | | console.log(obj) |
| | | const weihuiling=obj.weihuiling; |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function(event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | if (obj.zuhe1 && inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | |
| | | //启动按钮 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 6; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined') { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined'&& item.read !== '9999' && item.read !== '8888') { |
| | | item.value = obj[`zuhe${i+1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | } |
| | | //进片id |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 9999) { |
| | | subItem.value = obj.jinpianid[0]; |
| | | } |
| | | |
| | | |
| | | }); |
| | | }); |
| | | //取片id |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 8888) { |
| | | subItem.value = obj.qupianid[0]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, 50); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | |
| | | |
| | | if (obj.qidong){ |
| | | |
| | | |
| | | |
| | | |
| | | jsonData2[0][9].button.value = obj.qidong[0][0]; // 第一个子数组中第一个 type=66 的 button |
| | | jsonData2[0][10].button.value = obj.qidong[0][1]; // 第一个子数组中第二个 type=66 的 button |
| | | jsonData2[1][7].button.value = obj.qidong[0][2]; // 第二个子数组中第一个 type=66 的 button |
| | | jsonData2[1][8].button.value = obj.qidong[0][3]; |
| | | //故障更新 |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "故障" || obj2.button.name === "Fault")) { |
| | | obj2.button.value = obj.guzhang[0][i]; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // 复位更新 |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "复位" || obj2.button.name === "Reset")) { |
| | | obj2.button.value = obj.fuwei[0][i]; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | //未回零更新 |
| | | |
| | | jsonData2[2][3].button.value = weihuiling[0][0]; |
| | | jsonData2[3][3].button.value = weihuiling[0][1]; |
| | | jsonData2[4][4].button.value = weihuiling[0][2]; |
| | | jsonData2[5][4].button.value = weihuiling[0][3]; |
| | | |
| | | |
| | | // if(jsonData2[2][3].button.value===1){ |
| | | |
| | | // jsonData2[2][3].button.name.replace("未回零","回零") ; |
| | | // } |
| | | |
| | | // console.log(jsonData2[5][4].button.value) |
| | | if(jsonData2[2][3].button.value===1 && (jsonData2[2][3].button.name==="NotZero" ||jsonData2[2][3].button.name==="未回零")){ |
| | | jsonData2[2][3].button.name=jsonData2[2][3].button.name.replace("未回零","已回零") ; |
| | | jsonData2[2][3].button.name=jsonData2[2][3].button.name.replace("NotZero","Zero") ; |
| | | } |
| | | if(jsonData2[3][3].button.value===1 && (jsonData2[3][3].button.name==="NotZero" ||jsonData2[3][3].button.name==="未回零")){ |
| | | jsonData2[3][3].button.name=jsonData2[3][3].button.name.replace("未回零","已回零") ; |
| | | jsonData2[3][3].button.name=jsonData2[3][3].button.name.replace("NotZero","Zero") ; |
| | | } |
| | | if(jsonData2[4][4].button.value===1 && (jsonData2[4][4].button.name==="NotZero" ||jsonData2[4][4].button.name==="未回零")){ |
| | | jsonData2[4][4].button.name=jsonData2[4][4].button.name.replace("未回零","已回零") ; |
| | | jsonData2[4][4].button.name=jsonData2[4][4].button.name.replace("NotZero","Zero") ; |
| | | } |
| | | if(jsonData2[5][4].button.value===1 && (jsonData2[5][4].button.name==="NotZero" ||jsonData2[5][4].button.name==="未回零")){ |
| | | jsonData2[5][4].button.name=jsonData2[5][4].button.name.replace("未回零","已回零") ; |
| | | jsonData2[5][4].button.name=jsonData2[5][4].button.name.replace("NotZero","Zero") ; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if(jsonData2[2][3].button.value===0 && (jsonData2[2][3].button.name==="Zero" ||jsonData2[2][3].button.name==="已回零")){ |
| | | jsonData2[2][3].button.name=jsonData2[2][3].button.name.replace("已回零","未回零") ; |
| | | jsonData2[2][3].button.name=jsonData2[2][3].button.name.replace("Zero","NotZero") ; |
| | | } |
| | | if(jsonData2[3][3].button.value===0 && (jsonData2[3][3].button.name==="Zero" ||jsonData2[3][3].button.name==="已回零")){ |
| | | jsonData2[3][3].button.name=jsonData2[3][3].button.name.replace("已回零","未回零") ; |
| | | jsonData2[3][3].button.name=jsonData2[3][3].button.name.replace("Zero","NotZero") ; |
| | | } |
| | | if(jsonData2[4][4].button.value===0 && (jsonData2[4][4].button.name==="Zero" ||jsonData2[4][4].button.name==="已回零")){ |
| | | jsonData2[4][4].button.name=jsonData2[4][4].button.name.replace("已回零","未回零") ; |
| | | jsonData2[4][4].button.name=jsonData2[4][4].button.name.replace("Zero","NotZero") ; |
| | | } |
| | | if(jsonData2[5][4].button.value===0 && (jsonData2[5][4].button.name==="Zero" ||jsonData2[5][4].button.name==="已回零")){ |
| | | jsonData2[5][4].button.name=jsonData2[5][4].button.name.replace("已回零","未回零") ; |
| | | jsonData2[5][4].button.name=jsonData2[5][4].button.name.replace("Zero","NotZero") ; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | }, 200); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | |
| | | }; |
| | | |
| | | |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | //替换语言 |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('ServoManualone') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else if (obj.title && obj.title.name) { |
| | | const newName = nameMap[obj.title.name] || obj.title.name; |
| | | return { ...obj, title: { ...obj.title, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | html,body{ |
| | | width:100%; |
| | | height:85%; |
| | | |
| | | } |
| | | |
| | | .item-row { |
| | | display: flex; |
| | |
| | | background-color: red; |
| | | } |
| | | |
| | | .error-button2 { |
| | | background-color: red; |
| | | } |
| | | .fuwei { |
| | | background-color: green; |
| | | } |
| | | |
| | | .qidong { |
| | | background-color: green; |
| | | } |
| | | |
| | | .qidong3 { |
| | | background-color: green; |
| | | } |
| | | .qidong { |
| | | background-color: green; |
| | | } |
| | | |
| | | .qidong4 { |
| | | background-color: green; |
| | | } |
| | | |
| | | |
| | | .qidong5 { |
| | | background-color: green; |
| | | } |
| | | |
| | | .huiling { |
| | | background-color: green; |
| | | } |
| | | .jiting{ |
| | | background-color: green; |
| | | } |
| | | |
| | | .error-button3{ |
| | | background-color: green; |
| | | |
| | | } |
| | | |
| | | .yihuiling{ |
| | | |
| | | background-color: green; |
| | | } |
| | | </style> |