| | |
| | | <template> |
| | | <div class="app"> |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</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/alarm" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Alarm") }}</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/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('Parameter') |
| | | }}</router-link> |
| | | }}</router-link> --> |
| | | <router-link |
| | | to="/Electrical/Sign" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("I/O") }}</router-link |
| | | > |
| | | <router-link |
| | | to="/Electrical/Servomanual" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Manual/Automatic") }}</router-link |
| | | > |
| | | </el-breadcrumb> |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Automatic State') |
| | | }}</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/Parameter2" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Glass Data") }}</router-link |
| | | > |
| | | <!-- <router-link |
| | | to="/Electrical/ManualJog" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("ManualJog") }}</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">{{ |
| | | <router-link |
| | | to="/Electrical/ManualonePosition" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Manual Control") }}</router-link |
| | | > |
| | | |
| | | <router-link |
| | | to="/Electrical/Servomanualone" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" v-show="false" |
| | | >{{ $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("Cage Positions") }}</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">{{ |
| | | }}</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> |
| | | |
| | | }}</router-link> --> |
| | | <router-link |
| | | to="/Electrical/AutomaticParameterSetting" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Speed parameter settings") }}</router-link |
| | | > |
| | | |
| | | <router-link |
| | | to="/Electrical/InteractionState" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("PLC-MES Info") }}</router-link |
| | | > |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="18" class='card'> |
| | | <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block"> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <el-row :gutter="18" class="card" style="width: 1400px"> |
| | | <el-col |
| | | :span="7" |
| | | v-for="(dataGroup, groupIndex) in jsonData" |
| | | :key="groupIndex" |
| | | > |
| | | <el-card class="json-block" style="width: 400px"> |
| | | <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> |
| | | <span |
| | | v-if="item.title" |
| | | :name="item.title.name" |
| | | class="action-button" |
| | | >{{ item.title.name }}</span |
| | | > |
| | | </div> |
| | | </div> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div |
| | | v-for="(item, itemIndex) in dataGroup" |
| | | :key="itemIndex" |
| | | class="item-container" |
| | | > |
| | | <div class="item-row"> |
| | | <span class="name" style="width:250px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend" ></el-input> |
| | | <span v-if="item.unit" :name="item.unit" >{{ item.unit }}</span> |
| | | <span class="name" style="width: 250px">{{ item.name }}</span> |
| | | <el-input |
| | | v-if="item.type === '0'" |
| | | style="width: 120px" |
| | | v-model="item.value" |
| | | 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 + |
| | | `}` |
| | | " |
| | | @keyup.enter.native="submitDataToBackend($event)" |
| | | ></el-input> |
| | | <span v-if="item.unit" :name="item.unit">{{ item.unit }}</span> |
| | | |
| | | <el-button |
| | | v-if=" |
| | | item.type === '0' && |
| | | item.name !== '格子间距' && |
| | | item.name !== 'GridSpacing' |
| | | " |
| | | class="input-box" |
| | | @click="updateButtonValue(dataGroup, itemIndex, groupIndex)" |
| | | >{{ $t("Set") }}</el-button |
| | | > |
| | | |
| | | <!-- <el-button |
| | | v-if="item.type === '0' && item.name !== '格子间距' && item.name !== '出片接片地址' && item.name !== '存片接片地址'" |
| | | class="input-box" @click="submitDataToBackend();">取地址</el-button> --> |
| | | </div> |
| | | |
| | | <div class="button-row" style="display: flex; justify-content: space-between; flex-wrap: wrap;"> |
| | | <el-button |
| | | v-if="item.button" |
| | | v-model="item.button.value" |
| | | :name="item.button.name" |
| | | |
| | | :class="{ |
| | | dow: item.button.value === 0, |
| | | op: item.button.value === 1, |
| | | }" |
| | | class="action-button" |
| | | @click=" |
| | | updateButtonValue2(dataGroup, itemIndex); |
| | | submitDataToBackend2(item.button.name); |
| | | " |
| | | > |
| | | {{ item.button.name }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-button @click="submitDataToBackend">提交数据到后端</el-button> --> |
| | | |
| | | |
| | | |
| | | <div> |
| | | |
| | | <el-dialog |
| | | :visible="isPromptVisible" |
| | | title="Prompt" |
| | | width="30%" |
| | | :close-on-click-modal="false" |
| | | @close="handleCloseDialog" |
| | | > |
| | | <el-input v-model="password2" type="password" :placeholder="$t('Please enter the password')"></el-input> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="handleCancel">{{ $t('Home') }}</el-button> |
| | | <el-button type="primary" @click="handleConfirm">{{ $t('Confirm') }}</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </template> |
| | | |
| | | |
| | | |
| | | |
| | | <script> |
| | | let socket; |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/Positioning1' |
| | | import LanguageMixin from "../../lang/LanguageMixin"; |
| | | import data from "../../configuration/Positioning1"; |
| | | import {SelectPassword} from "../../api/home"; |
| | | |
| | | export default { |
| | | name: "Positioning1", |
| | | mixins: [LanguageMixin], |
| | | data () { |
| | | data() { |
| | | return { |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | jsonData: data, // 加载整个data.json文件作为jsonData |
| | | A01: "", |
| | | A02: "", |
| | | B01: "", |
| | | B02: "", |
| | | password:"" , |
| | | password2:"" , |
| | | jianju: "", |
| | | |
| | | isPromptVisible: false, |
| | | |
| | | }; |
| | | }, |
| | | activated(){ |
| | | activated() { |
| | | document.body.style.zoom = "90%"; |
| | | this.initWebSocket(); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === "en-US") { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | this.load(); |
| | | |
| | | this.initWebSocket (); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }, |
| | | // 调用函数,显示密码输入对话框 |
| | | this.showPasswordPrompt(); |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | | |
| | | showPasswordPrompt() { |
| | | this.isPromptVisible = true; |
| | | }, |
| | | handleCancel() { |
| | | this.$router.push('/home'); |
| | | this.isPromptVisible = false; |
| | | }, |
| | | handleConfirm() { |
| | | // 验证密码并执行相应操作 |
| | | if (this.password === this.password2) { |
| | | // 密码正确,执行操作 |
| | | console.log('Password correct, perform operation'); |
| | | this.$message.success(this.$t('success password')); |
| | | this.isPromptVisible = false; |
| | | this.password2=""; |
| | | |
| | | // 在这里执行你的操作 |
| | | } else { |
| | | this.$message.error(this.$t('Incorrect password')); |
| | | this.showPasswordPrompt(); |
| | | } |
| | | |
| | | }, |
| | | handleCloseDialog() { |
| | | // 在这里处理弹框关闭事件,如果需要的话 |
| | | console.log('Dialog closed'); |
| | | }, |
| | | |
| | | |
| | | // showPasswordPrompt() { |
| | | // // 显示遮罩层 |
| | | // this.isPromptVisible = true; |
| | | |
| | | // this.$prompt( |
| | | // this.$t('Are you sure to perform this operation?'), |
| | | // this.$t('prompt'), |
| | | // { |
| | | // inputType: 'password', |
| | | // inputPlaceholder: this.$t('Please enter the password'), |
| | | // confirmButtonText: this.$t('Yes'), |
| | | // showClose: false, // 不显示右上角的关闭按钮 |
| | | // showCancelButton: false, // 不显示取消按钮 |
| | | // type: 'warning', |
| | | // } |
| | | // ).then(({ value }) => { |
| | | // // 验证密码是否正确 |
| | | // if (value !== this.password) { |
| | | // this.$message.error(this.$t('Incorrect password')); |
| | | // // 不关闭对话框,重新触发密码输入对话框 |
| | | // this.showPasswordPrompt(); |
| | | // } else { |
| | | // // 密码正确,执行操作 |
| | | // // 这里可以添加你想要执行的操作 |
| | | // // 如果没有操作,可以省略这个 else 代码块 |
| | | // } |
| | | // }).catch(() => { |
| | | // // 如果用户取消操作,也不做任何处理 |
| | | // console.log('取消1'); |
| | | // }).finally(() => { |
| | | // // 关闭遮罩层 |
| | | // this.isPromptVisible = false; |
| | | // }); |
| | | // }, |
| | | |
| | | |
| | | load(){ |
| | | |
| | | SelectPassword().then(res => { |
| | | this.password = res.data.password; |
| | | console.log(this.password) |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | console.log(this.jsonData) |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | updateButtonValue2 (dataGroup, itemIndex) { |
| | | if (dataGroup[itemIndex].button.value2 === 0) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value2', 1); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value2', 0); |
| | | } |
| | | }, |
| | | updateButtonValue(dataGroup, itemIndex, groupIndex) { |
| | | if (groupIndex == 1) { |
| | | const value = parseFloat(this.A01); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | console.log(value); |
| | | } |
| | | if (groupIndex == 2) { |
| | | const value = parseFloat(this.A02); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | console.log(value); |
| | | } |
| | | |
| | | if (groupIndex == 3) { |
| | | const value = parseFloat(this.A01) + parseFloat(this.jianju); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | console.log(value); |
| | | } |
| | | if (groupIndex == 4) { |
| | | const value = parseFloat(this.A02) + parseFloat(this.jianju); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | } |
| | | if (groupIndex == 5) { |
| | | const value = parseFloat(this.B01) - parseFloat(this.jianju); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | } |
| | | if (groupIndex == 6) { |
| | | const value = parseFloat(this.B02) + parseFloat(this.jianju); |
| | | |
| | | this.$set(dataGroup[itemIndex], "value", value); |
| | | } |
| | | |
| | | this.submitDataToBackend(event); |
| | | }, |
| | | //提交数据到后端 |
| | | submitDataToBackend () { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '0') { |
| | | submitDataToBackend(event) { |
| | | const inputData = this.jsonData.map((dataGroup) => { |
| | | return dataGroup.map((item) => { |
| | | if (item.type === "0") { |
| | | return { value: parseInt(item.value) }; |
| | | } else if (item.button) { |
| | | return { value: parseInt(item.title.value) }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | // 将inputData转换为整数数组 |
| | | const integerArray = inputData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | const integerArray = inputData.map((dataGroup) => { |
| | | return dataGroup.map((item) => { |
| | | if (item !== null) { |
| | | return item.value; |
| | | } |
| | |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | // console.log('提交以下数据到后端:', jsonString); |
| | | socket?.send(jsonString); |
| | | }, |
| | | initWebSocket () { |
| | | |
| | | |
| | | |
| | | console.log("提交以下数据到后端:", jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | event.target.blur(); // 取消输入框焦点 |
| | | }, |
| | | |
| | | submitDataToBackend2 (currentButtonName) { |
| | | |
| | | if (currentButtonName === 'A01 Calibration Pos' || currentButtonName === 'A02 Calibration Pos' || currentButtonName === 'A01原点记忆' || currentButtonName === 'A02原点记忆') { |
| | | this.$prompt( |
| | | this.$t('Are you sure to perform this operation?'), |
| | | this.$t('prompt'), |
| | | { |
| | | inputType: 'password', |
| | | inputPlaceholder: this.$t('Please enter the password'), |
| | | confirmButtonText: this.$t('Yes'), |
| | | cancelButtonText: this.$t('No'), |
| | | type: 'warning', |
| | | } |
| | | ).then(({ value }) => { |
| | | // 验证密码是否正确 |
| | | if (value !== this.password) { |
| | | this.$message.error(this.$t('Incorrect password')); |
| | | return; |
| | | } |
| | | |
| | | // 密码正确,继续提交数据到后端 |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '1'&& item.button) { |
| | | |
| | | return { value: item.button.value2 }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | const data = []; |
| | | data.push(values); |
| | | |
| | | data.unshift([], [], [],[],[],[],[]); |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | }).catch(() => { |
| | | // 取消操作 |
| | | console.log('取消1'); |
| | | }); |
| | | } else { |
| | | console.log('取消2'); |
| | | } |
| | | }, |
| | | initWebSocket() { |
| | | let viewname = "Positioning1"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = |
| | | "ws://" + |
| | | this.$t("ip") + |
| | | ":8888" + |
| | | "/springboot-vue3/api/talk/" + |
| | | viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | }; |
| | | |
| | | // 收到消息 |
| | | // 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); |
| | | const jsonData2 = this.jsonData; |
| | | document.addEventListener('mouseover', function (event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | const parms = obj.params; |
| | | if (parms && inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | |
| | | // console.log(parms) |
| | | |
| | | const parms = obj.params; |
| | | |
| | | let index = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) { |
| | | obj.value = parms[0][index]; |
| | | index++; |
| | | } |
| | | if (parms) { |
| | | // 只有在鼠标不在输入框内时才更新数据 |
| | | // console.log(parms) |
| | | |
| | | let index = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if ( |
| | | obj.type === "0" && |
| | | Object.prototype.hasOwnProperty.call(obj, "value") |
| | | ) { |
| | | obj.value = parms[0][index]; |
| | | index++; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // console.log(jsonData2); |
| | | |
| | | } |
| | | }); |
| | | |
| | | this.A01 = obj.shishi1[0][0]; |
| | | |
| | | this.A02 = obj.shishi1[0][1]; |
| | | |
| | | this.B01 = obj.shishi1[0][2]; |
| | | |
| | | this.B02 = obj.shishi1[0][3]; |
| | | this.jianju = obj.params[0][0]; |
| | | |
| | | jsonData2[7][0].button.value = obj.PLCOriginmarkingarraylist[0][0]; |
| | | jsonData2[7][1].button.value = obj.PLCOriginmarkingarraylist[0][1]; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | // 关闭事件 |
| | | socket.onclose = function () { |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function(){ |
| | | this.$router.afterEach(function () { |
| | | socket.close(); |
| | | }) |
| | | |
| | | }); |
| | | } |
| | | }, |
| | | //语言替换 |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('langPositioning1') |
| | | 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; |
| | | } |
| | | }); |
| | | }); |
| | | const nameMap = this.$t("langPositioning1"); |
| | | 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) |
| | | |
| | | }, |
| | | send () { |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | }, |
| | | send() { |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | .action-button { |
| | | margin-right: 30px; |
| | | background: #66b1ff; |
| | | color: #FFF; |
| | | color: #fff; |
| | | } |
| | | |
| | | .blue-button { |
| | | background-color: skyblue; |
| | | } |
| | | .op { |
| | | background-color: #66b1ff; |
| | | } |
| | | |
| | | .dow { |
| | | background-color: #A0A0A0; |
| | | } |
| | | </style> |