diff --git a/src/assets/new-screen/zhongzien.png b/src/assets/new-screen/zhongzien.png new file mode 100644 index 0000000..f4a3a3b Binary files /dev/null and b/src/assets/new-screen/zhongzien.png differ diff --git a/src/filters/index.js b/src/filters/index.js index 10bf7ee..e5578a2 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -202,20 +202,20 @@ export function kgFormat(num, digits) { export function moneyUnitFormat(num) { if (sessionStorage.getItem('language') === 'en') { if (!num) { - return 'RMB' + return 'EUR' } if (Number(num) >= 1E4) { - return 'CNY10K' + return 'EUR10K' } - return 'RMB' + return 'EUR' } else { if (!num) { - return '元' + return 'EUR' } if (Number(num) >= 1E4) { - return '万元' + return 'EUR10K' } - return '元' + return 'EUR' } } /** diff --git a/src/lang/dynamicPolicy/en.js b/src/lang/dynamicPolicy/en.js index b7dac24..5095773 100644 --- a/src/lang/dynamicPolicy/en.js +++ b/src/lang/dynamicPolicy/en.js @@ -32,13 +32,13 @@ export default { stationRunPlan: 'The actual operation plan curve of the power station', runEarning: 'Actual operating earnings', recommend: 'Referral strategy earnings', - valley: '谷(0.1kWh/元)', - flat: '平(0.3kWh/元)', - peak: '峰(0.6kWh/元)', + valley: '谷(0.1kWh/EUR)', + flat: '平(0.3kWh/EUR)', + peak: '峰(0.6kWh/EUR)', earningForecast: 'Revenue forecasts', defaultEarning: 'Default policy earnings', estimateEarning: 'Estimated earnings increase', - rmb: 'RMB', + rmb: 'EUR', stts: 'Earnings budgeting', sjsyje: 'Amount of actual earnings', mrjhqx: 'Default plan curve earnings', diff --git a/src/lang/dynamicPolicy/zh.js b/src/lang/dynamicPolicy/zh.js index 361a537..01c71eb 100644 --- a/src/lang/dynamicPolicy/zh.js +++ b/src/lang/dynamicPolicy/zh.js @@ -32,13 +32,13 @@ export default { stationRunPlan: '电站实际运行计划曲线', runEarning: '实际运行收益', recommend: '推荐策略收益', - valley: '谷(0.1kWh/元)', - flat: '平(0.3kWh/元)', - peak: '峰(0.6kWh/元)', + valley: '谷(0.1kWh/EUR)', + flat: '平(0.3kWh/EUR)', + peak: '峰(0.6kWh/EUR)', earningForecast: '收益预测', defaultEarning: '默认策略收益', estimateEarning: '预估收益提升', - rmb: '元', + rmb: 'EUR', stts: '收益预算', sjsyje: '实际收益金额', mrjhqx: '默认计划曲线收益', diff --git a/src/lang/index.js b/src/lang/index.js index 0f00a71..8616736 100644 --- a/src/lang/index.js +++ b/src/lang/index.js @@ -80,9 +80,11 @@ export function getLanguage() { // if has not choose language const language = (navigator.language || navigator.browserLanguage).toLowerCase() const locales = Object.keys(messages) + console.log(JSON.stringify('语言:' + language, locales)) + for (const locale of locales) { if (language.indexOf(locale) > -1) { - return locale + return locale !== 'en' ? 'en' : locale } } return 'en' diff --git a/src/lang/revenue/en.js b/src/lang/revenue/en.js index 4e7ca5f..9646fa5 100644 --- a/src/lang/revenue/en.js +++ b/src/lang/revenue/en.js @@ -34,7 +34,7 @@ export default { selectTemValid: 'Please select template validity', type: 'Type', selectType: 'Please select type', - electrovalency: 'Electricity(RMB)', + electrovalency: 'Electricity(EUR)', sure: 'Sure', cancel: 'Cancel', noSelectData: 'No data is selected', @@ -121,7 +121,7 @@ export default { img: 'Image', eleLevel: 'Electricity Price Level', fsdd: 'The price of time-of-use electricity', - dietailUnit: 'RMB/kWh', + dietailUnit: 'EUR/kWh', eleprice: 'The price of electricity and electricity', historytrend: 'Historical trends', curve: 'Curve', @@ -154,11 +154,11 @@ export default { charge: 'Charge', time: 'Time', ele: 'Electricity(kWh)', - expend: 'expenditures(RMB)', + expend: 'expenditures(EUR)', disCharge: 'Discharge', projectRevenue: 'Project Revenue', monthTotalChargePrice: 'Total Charging Price Monthly', - rmb: 'RMB', + rmb: 'EUR', monthTotalDisChargePrice: 'Total Discharging Price Monthly', earnings: 'Revenue', earningsRecalculation: 'Revenue Recalculation', @@ -204,7 +204,7 @@ export default { }, glance: { day: 'day', - wRMB: 'Million RMB', + wRMB: 'EUR10K', safeDays: 'Safe Operation Days', totalCapacity: 'Total Installed Capacity', totalCharge: 'Total Charging Volume', @@ -232,7 +232,7 @@ export default { setRevenue: 'Settlement Revenue', chargeCost: 'Charging Cost', dischargeRev: 'Discharge Revenue', - rmb: 'RMB', + rmb: 'EUR', setRatio: 'Settlement Ratio', selectSetRatio: 'Please select settlement ratio', priceCurve: 'Real-Time Electricity Price Curve', @@ -243,9 +243,9 @@ export default { noData: 'No Data', inputNumber: 'Please input a number from 0-100', earningGlance: 'Revenue Glance', - unit: 'Unit:RMB/kWh', + unit: 'Unit:EUR/kWh', unitKw: 'Unit:kW', planCurve: 'Plan Curve', - unitRMB: 'Unit:RMB' + unitRMB: 'Unit:EUR' } } diff --git a/src/lang/revenue/zh.js b/src/lang/revenue/zh.js index 7479410..6cff10f 100644 --- a/src/lang/revenue/zh.js +++ b/src/lang/revenue/zh.js @@ -34,7 +34,7 @@ export default { selectTemValid: '请选择模板有效期', type: '类型', selectType: '请选择类型', - electrovalency: '电价(元)', + electrovalency: '电价(EUR)', sure: '确认', cancel: '取消', noSelectData: '未选择数据', @@ -123,7 +123,7 @@ export default { img: '图片', eleLevel: '电价水平', fsdd: '分时电度用电价格', - dietailUnit: '元/千瓦时', + dietailUnit: 'EUR/千瓦时', eleprice: '电度用电价格', historytrend: '历史趋势', curve: '曲线', @@ -153,11 +153,11 @@ export default { charge: '充电', time: '时段', ele: '电量(kWh)', - expend: '支出(元)', + expend: '支出(EUR)', disCharge: '放电', projectRevenue: '项目收益情况', monthTotalChargePrice: '本月总充电量总价', - rmb: '元', + rmb: 'EUR', monthTotalDisChargePrice: '本月总放电量总价', earnings: '收益', earningsRecalculation: '收益重算', @@ -203,7 +203,7 @@ export default { }, glance: { day: '天', - wRMB: '万元', + wRMB: 'EUR10K', safeDays: '安全运行天数', totalCapacity: '装机总容量', totalCharge: '总充电量', @@ -231,7 +231,7 @@ export default { setRevenue: '结算收益', chargeCost: '充电成本', dischargeRev: '放电收益', - rmb: '元', + rmb: 'EUR', setRatio: '计算比例', selectSetRatio: '请选择结算比例', priceCurve: '实时电价曲线', @@ -242,9 +242,9 @@ export default { noData: '暂无数据', inputNumber: '请输入0-100的数字', earningGlance: '收益概览', - unit: '单位:元/kWh', + unit: '单位:EUR/kWh', unitKw: '单位:kW', planCurve: '计划曲线', - unitRMB: '单位:元' + unitRMB: '单位:EUR' } } diff --git a/src/lang/screen/en.js b/src/lang/screen/en.js index 48fa6a1..c4818fe 100644 --- a/src/lang/screen/en.js +++ b/src/lang/screen/en.js @@ -21,7 +21,7 @@ export default { annualEarning: 'Annual Income', totalEarning: 'Total Revenue', groupEarning: 'Group Income', - mRMB: 'CNY10K', + mRMB: 'EUR10K', high: 'High', low: 'Low', comTime: 'Commission Time', diff --git a/src/lang/screen/zh.js b/src/lang/screen/zh.js index 131e933..3d9be8e 100644 --- a/src/lang/screen/zh.js +++ b/src/lang/screen/zh.js @@ -21,7 +21,7 @@ export default { annualEarning: '年收益', totalEarning: '总收益', groupEarning: '集团收益', - mRMB: '万元', + mRMB: 'EUR10K', high: '高', low: '低', comTime: '投运时间', diff --git a/src/lang/strategic/en.js b/src/lang/strategic/en.js index c5ec70a..34688a5 100644 --- a/src/lang/strategic/en.js +++ b/src/lang/strategic/en.js @@ -280,7 +280,7 @@ export default { safeLowerError: 'The minimum security capacity cannot be greater than the maximum security capacity', saveSuccess: 'Save succeeded', buildSuccess: 'Generate succeeded', - unit: 'Unit: RMB/kWh', + unit: 'Unit: EUR/kWh', loadCurve: 'Load curve', importSuccess: 'Import succeeded', newUnit: 'Unit:kWh' diff --git a/src/lang/strategic/zh.js b/src/lang/strategic/zh.js index 1d55664..794436d 100644 --- a/src/lang/strategic/zh.js +++ b/src/lang/strategic/zh.js @@ -277,7 +277,7 @@ export default { safeLowerError: '安全容量下限不能大于安全容量上限', saveSuccess: '保存成功', buildSuccess: '生成成功', - unit: '单位:元/kWh', + unit: '单位:EUR/kWh', loadCurve: '负荷曲线', importSuccess: '导入成功', newUnit: '单位:kW' diff --git a/src/lang/zh.js b/src/lang/zh.js index d427b95..1ac5125 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -889,7 +889,7 @@ export default { day: '日', power: '发电量', benefit: '收益', - wanji: '万元' + wanji: 'EUR10K' }, sophCharging: { // 智慧充电 station: '电站', @@ -905,7 +905,7 @@ export default { online: '在线', offline: '离线', accruedIncome: '累计收益', - tenThousand: '万元', + tenThousand: 'EUR10K', faultNum: '故障个数', acAuto: '交流汽车', chargeBenefit: '充电桩日充电量/收益', @@ -920,9 +920,9 @@ export default { peak: '峰', currentPos: '当前位置', chargeFees: '充电收费', - chargeFeesUnit: '元/kWh', + chargeFeesUnit: 'EUR/kWh', serviceFee: '服务费', - servecrFeeUnit: '元/次', + servecrFeeUnit: 'EUR/次', pileType: '充电桩类型', chargeNum: '今日充电次数', free: '空闲', diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 49606bd..83eaa08 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -1044,7 +1044,7 @@ export default { flex-shrink: 0; font-size: 18px !important; cursor: pointer; - min-width: 100px; + // min-width: 100px; i { font-size: 28px; diff --git a/src/utils/request.js b/src/utils/request.js index 0104e04..8264e46 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -13,7 +13,7 @@ const service = axios.create({ // request interceptor service.interceptors.request.use( config => { - config.headers['lang'] = sessionStorage.getItem('language') === 'en' ? 'en_US' : 'zh_CN' + config.headers['lang'] = sessionStorage.getItem('language') === 'zh' ? 'zh_CN' : 'en_US' // do something before request is sent if (config.headers.isScreen) { config.headers['authorization'] = getScreenToken() diff --git a/src/views/dashboard-zhongzi/components/topology/index.vue b/src/views/dashboard-zhongzi/components/topology/index.vue index 4fbc479..04a214c 100644 --- a/src/views/dashboard-zhongzi/components/topology/index.vue +++ b/src/views/dashboard-zhongzi/components/topology/index.vue @@ -586,12 +586,12 @@ - diff --git a/src/views/dashboardtest/components/top-center/ninth.vue b/src/views/dashboardtest/components/top-center/ninth.vue index 386ce0a..196847b 100644 --- a/src/views/dashboardtest/components/top-center/ninth.vue +++ b/src/views/dashboardtest/components/top-center/ninth.vue @@ -534,7 +534,7 @@ - + diff --git a/src/views/dashboardtest/components/top-center/pv1storage261.vue b/src/views/dashboardtest/components/top-center/pv1storage261.vue index fa446cb..546bf00 100644 --- a/src/views/dashboardtest/components/top-center/pv1storage261.vue +++ b/src/views/dashboardtest/components/top-center/pv1storage261.vue @@ -377,52 +377,49 @@ {{ item.name }} - + {{ item.value }} - - - - {{ item.name }} - + {{ item.value }} - - {{ item.name }} - - + +
+ + + {{ truncateText(item.name, 120) }} + + +
+
+ {{ item.value }}
- - - @@ -514,7 +511,11 @@ export default { } }, - computed: {}, + computed: { + lang() { + return this.$store.getters.language + } + }, watch: {}, created() { const result = changeTheme() @@ -531,6 +532,34 @@ export default { }, mounted() {}, methods: { + truncateText(text, maxWidth) { + if (!text) return '' + const width = this.measureTextWidth(text) + if (width <= maxWidth) return text + + let truncated = text + while (this.measureTextWidth(truncated + '...') > maxWidth && truncated.length > 0) { + truncated = truncated.slice(0, -1) + } + return truncated + (truncated.length < text.length ? '...' : '') + }, + // 精确测量文本渲染宽度(像素) + measureTextWidth(text, font = '14px sans-serif') { + // 创建或复用一个 canvas(避免重复创建) + if (!this._textMeasurementCanvas) { + this._textMeasurementCanvas = document.createElement('canvas') + } + const ctx = this._textMeasurementCanvas.getContext('2d') + ctx.font = font + return ctx.measureText(text).width + }, + + // 计算 value 的 x 坐标:baseX + name 的实际宽度 + 一点间距 + calculateValueX(name, baseX = 200) { + const truncatedName = this.truncateText(name, 120) // 限制 name 最大宽度 + const width = this.measureTextWidth(truncatedName) + return baseX + width + 6 // +6 是 name 和 value 之间的小空隙 + }, countChineseAndEnglishCharacters(str, x) { var chineseCount = str.match(/[\u4e00-\u9fa5]/g) ? str.match(/[\u4e00-\u9fa5]/g).length : 0 var englishCount = str.match(/[a-zA-Z]/g) ? str.match(/[a-zA-Z]/g).length : 0 diff --git a/src/views/dashboardtest/components/top-center/pv2storage261.vue b/src/views/dashboardtest/components/top-center/pv2storage261.vue index 460c5e5..015c76c 100644 --- a/src/views/dashboardtest/components/top-center/pv2storage261.vue +++ b/src/views/dashboardtest/components/top-center/pv2storage261.vue @@ -370,7 +370,7 @@ {{ item.name }} - + {{ item.value }} @@ -381,7 +381,7 @@ {{ item.name }} - + {{ item.value }} @@ -392,26 +392,68 @@ {{ item.name }} - + {{ item.value }} - + +
+ + + {{ truncateText(item.name, 100) }} + + +
+
+ + {{ item.value }}
- + +
+ + + {{ truncateText(item.name, 100) }} + + +
+
+ + {{ item.value }}
@@ -507,7 +549,11 @@ export default { } }, - computed: {}, + computed: { + lang() { + return this.$store.getters.language + } + }, watch: {}, created() { const result = changeTheme() @@ -524,6 +570,34 @@ export default { }, mounted() {}, methods: { + truncateText(text, maxWidth) { + if (!text) return '' + const width = this.measureTextWidth(text) + if (width <= maxWidth) return text + + let truncated = text + while (this.measureTextWidth(truncated + '...') > maxWidth && truncated.length > 0) { + truncated = truncated.slice(0, -1) + } + return truncated + (truncated.length < text.length ? '...' : '') + }, + // 精确测量文本渲染宽度(像素) + measureTextWidth(text, font = '14px sans-serif') { + // 创建或复用一个 canvas(避免重复创建) + if (!this._textMeasurementCanvas) { + this._textMeasurementCanvas = document.createElement('canvas') + } + const ctx = this._textMeasurementCanvas.getContext('2d') + ctx.font = font + return ctx.measureText(text).width + }, + + // 计算 value 的 x 坐标:baseX + name 的实际宽度 + 一点间距 + calculateValueX(name, baseX = 200) { + const truncatedName = this.truncateText(name, 120) // 限制 name 最大宽度 + const width = this.measureTextWidth(truncatedName) + return baseX + width + 6 // +6 是 name 和 value 之间的小空隙 + }, countChineseAndEnglishCharacters(str, x) { var chineseCount = str.match(/[\u4e00-\u9fa5]/g) ? str.match(/[\u4e00-\u9fa5]/g).length : 0 var englishCount = str.match(/[a-zA-Z]/g) ? str.match(/[a-zA-Z]/g).length : 0 diff --git a/src/views/dashboardtest/components/top-center/second-disposition.vue b/src/views/dashboardtest/components/top-center/second-disposition.vue index 9020d55..5871704 100644 --- a/src/views/dashboardtest/components/top-center/second-disposition.vue +++ b/src/views/dashboardtest/components/top-center/second-disposition.vue @@ -343,7 +343,7 @@ - + diff --git a/src/views/dashboardtest/components/top-center/seventh.vue b/src/views/dashboardtest/components/top-center/seventh.vue index ff5b068..71d221a 100644 --- a/src/views/dashboardtest/components/top-center/seventh.vue +++ b/src/views/dashboardtest/components/top-center/seventh.vue @@ -460,7 +460,7 @@ - + diff --git a/src/views/new-screen-zz/components/map-center.vue b/src/views/new-screen-zz/components/map-center.vue index f46d0ac..d05fa4c 100644 --- a/src/views/new-screen-zz/components/map-center.vue +++ b/src/views/new-screen-zz/components/map-center.vue @@ -81,14 +81,14 @@ export default { const province = [] if (data.length) { data.forEach((el) => { - el.value = [el.latitude, el.longitude] + el.value = [el.longitude, el.latitude] el.symbol = 'image://' + blue el.cityCode = 1000 province.push(el) }) this.pointData = province } else { - this.pointData = [{ symbol: 'image://' + blue, cityCode: 1000, value: [118.8062, 31.9208], name: '江苏' }] + this.pointData = [{ symbol: 'image://' + blue, cityCode: 1000, value: [30.787045, 103.923008], name: 'Sichuan' }] } } finally { this.loading = false @@ -97,21 +97,12 @@ export default { }, getInitMap() { this.$echarts.registerMap('world', worldJson) - // this.$echarts.registerMap('china', chinaMap) - // this.$echarts.registerMap('chinaMapOutline', chinaMapOutline) - this.pointData = [ - { name: 'Beijing', value: [116.4074, 39.9042] }, // 北京 - { name: 'New York', value: [-74.0060, 40.7128] }, // 纽约 - { name: 'London', value: [-0.1278, 51.5074] } // 伦敦 - ] var series = [ { - // map: 'china', name: '国家', map: 'world', type: 'map', roam: false, - // zoom: 1.65, zoom: 1.1, label: { normal: { @@ -126,7 +117,6 @@ export default { } } }, - // top: '29%', top: '10%', tooltip: { show: false @@ -144,8 +134,7 @@ export default { } } }, - // data: this.mapData - data: [{ name: 'China', value: 100 }] + data: this.mapData }, { @@ -164,10 +153,11 @@ export default { shadowColor: '#333' } }, - symbolSize: 10, - data: [this.pointData[this.pointIndex]] + symbolSize: 24, + symbolOffset: [0, '-50%'], // 或 [0, -12] 更精确 + data: [this.pointData[this.pointIndex]], - // showEffectOn: 'render' // 加载完毕显示特效 + showEffectOn: 'render' // 加载完毕显示特效 } ] @@ -197,25 +187,25 @@ export default { trigger: 'item', alwaysShowContent: true, backgroundColor: 'transparent', - position: 'top', + position: 'bottom', triggerOn: 'click', enterable: true, formatter: params => { // 获取xAxis data中的数据 let dataStr = `
` dataStr += `
- ${params.name} + ${params.name}
` dataStr += `
- 投运时间 + ${this.$t('screen.comTime')} ${params.data.createTime}
` dataStr += `
- 装机容量 + ${this.$t('screen.capacity')} ${params.data.capacity} kWh
` - const div = `
${dataStr}
` return div } @@ -224,11 +214,8 @@ export default { geo: [ { silent: true, - // map: 'chinaMapOutline', map: 'world', - zoom: 1.1, - // top: '10%', label: { normal: { show: false, @@ -266,7 +253,6 @@ export default { { silent: true, map: 'chinaMapOutline', - // zoom: 1.1, zoom: 1.2, top: '7%', label: { diff --git a/src/views/new-screen-zz/index.vue b/src/views/new-screen-zz/index.vue index 91949f5..29fb324 100644 --- a/src/views/new-screen-zz/index.vue +++ b/src/views/new-screen-zz/index.vue @@ -6,7 +6,7 @@
- + {{ $t('screen.ztscreenTitle') }}
{{ time }} @@ -339,7 +339,17 @@ $margin: 16px; left: $margin; top: 30px; } - + .left-title-en { + width: 200px; + height: 52px; + background: url(../../assets/new-screen/zhongzien.png) no-repeat; + background-size: 100% 100%; + color: #fff; + font-size: 16px; + position: absolute; + left: $margin; + top: 30px; + } .right-title { font-family: LCD; color: #fff; diff --git a/src/views/remote-control/issue-order/index.vue b/src/views/remote-control/issue-order/index.vue index d926675..b6d88bd 100644 --- a/src/views/remote-control/issue-order/index.vue +++ b/src/views/remote-control/issue-order/index.vue @@ -77,7 +77,7 @@