From 182d78dfd33a25e0648f2f566eab1f7e79a83e78 Mon Sep 17 00:00:00 2001 From: clll <1320612696@qq.com> Date: 星期五, 27 十月 2023 16:28:10 +0800 Subject: [PATCH] 模块配置和参数翻译 --- CanadaMes-ui/src/views/Electrical/Sign.vue | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue index 11e52a9..c315db8 100644 --- a/CanadaMes-ui/src/views/Electrical/Sign.vue +++ b/CanadaMes-ui/src/views/Electrical/Sign.vue @@ -3,13 +3,18 @@ <!--闈㈠寘灞戝鑸尯鍩�--> <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/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/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> - + </el-breadcrumb> <div>{{ $t('Sign') }}</div> <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir"> @@ -27,19 +32,21 @@ <script > import LanguageMixin from '../../lang/LanguageMixin' +import data from '../../configuration/Sign' let socket; export default { name: "Sign", mixins: [LanguageMixin], data () { return { + jsonData: data, activeButton: '', record: { //瀹氫箟鏁扮粍锛屽苟娣诲姞榛樿鍊� params: [1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,], xyData: [ - { name: 'D01.SR dec', value: 1 }, + { name: 'D01.SR dec222', value: 1 }, { name: "D01.SR in pos", value: 1 }, { name: "D02.SR dec", value: 1 }, { name: "D02.SR in pos", value: 1 }, @@ -148,8 +155,16 @@ }, created () { this.init(); + //this.showdata(); }, methods: { + showdata () { + console.log(1111); + console.log(this.jsonData.sign[0].name); + // console.log(this.record.xyData); + + }, + onButtonClick () { this.isButtonClicked = true; // 灏嗘寜閽鑹茶缃负钃濊壊 setTimeout(() => { @@ -192,17 +207,18 @@ let obj = JSON.parse(msg.data); this.record.params[0] = obj.sig[0]; for (let a = 0; a < this.record.params[0].length; a++) { - if (!this.record.xyData[a]) { - this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] }; + this.record.xyData[a].name = this.jsonData.sign[a].name; + this.record.xyData[a].value = this.record.params[0][a]; + } - } else { - this.record.xyData[a].value = this.record.params[0][a]; - - } - - + const language = this.$i18n.locale; + if (language === 'en-US') { + this.replaceChineseWithEnglish(); + } else { + this.localizedRoles = [...this.record.xyData]; } this.$forceUpdate(); + this.replaceChineseWithEnglish(); }.bind(this); //鍏抽棴浜嬩欢 @@ -215,6 +231,12 @@ } } }, + //璇█杞崲 + replaceChineseWithEnglish () { + const translation = this.$t('Signlang'); + this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value, unit: item.unit }; }); + //console.log(translation); + } } } -- Gitblit v1.8.0