From b209a6aba0b5263ddff41e688b31d8763cb458dc Mon Sep 17 00:00:00 2001 From: hzz Date: Tue, 14 Jan 2025 14:30:54 +0800 Subject: [PATCH] update --- src/locales/lang/zh.ts | 5 +- src/views/Temp/GetonAgain/bottom.vue | 113 +++++++++++++-------------- vue.config.js | 4 +- 3 files changed, 60 insertions(+), 62 deletions(-) diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 5881658..2754828 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -8,6 +8,9 @@ * 版权信息 : 2023 by ${再登软件}, All Rights Reserved. */ + +const currentDate = new Date(); +const currentYear = currentDate.getFullYear(); export default { messages: { 'energyConsume': '能耗 实时监测系统', @@ -255,7 +258,7 @@ export default { 'HanJie_generalEnvironment': '焊接-环境 实时监测系统', 'noiseDetection': '噪音监测', 'NormalValue': '正常值', - 'PowerConsumption_2023': '2024年度用电量(度)', + 'PowerConsumption_2023': currentYear + '年度用电量(度)', 'Production_2023': '2024年度生产额(元)', 'GasConsumption_2023JiXie': '2024年机械分厂用气量(立方)', 'DianKongGatewayDtatus': '电控分厂物联网关状态', diff --git a/src/views/Temp/GetonAgain/bottom.vue b/src/views/Temp/GetonAgain/bottom.vue index 347a138..9a7a875 100644 --- a/src/views/Temp/GetonAgain/bottom.vue +++ b/src/views/Temp/GetonAgain/bottom.vue @@ -12,11 +12,7 @@
- + + +
-->
@@ -43,12 +39,11 @@ import { getPowerData, getconsumeDetail } from "@/http/energyConsume"; import border6 from "@/components/borderBox/border6.vue"; import border3 from "@/components/borderBox/border3.vue"; import pm from "./chart/pm.vue"; -import power from "./chart/power2023.vue"; import chart from "@/components/assembly/chart2.vue"; import { useRoute, useRouter } from "vue-router"; import { useEnergyConsumeStore } from "@/store/module/energyConsume"; import { useI18n } from 'vue-i18n' -let {t} = useI18n(); +let { t } = useI18n(); const store = useEnergyConsumeStore(); const router = useRouter(); @@ -82,10 +77,10 @@ function reset(val: any) { const powerBox = (width: any, height: any) => { let a = calcWH(height, width, 1, 1, 0); //修改高度 - powerref.value.setchartWH(a.oWidth-20, a.oHeight-20); + powerref.value.setchartWH(a.oWidth - 20, a.oHeight - 20); // Productionref.value.setchartWH(a.oWidth-20, a.oHeight-20); // pmref.value.setchartWH(a.oWidth-40,a.oHeight-40) -// yields.value.setchartWH(a.oWidth, a.oHeight - 30); + // yields.value.setchartWH(a.oWidth, a.oHeight - 30); }; let powerOption = reactive({ title: "", @@ -96,7 +91,7 @@ let powerOption = reactive({ color: "rgb(255,255,255,0.9)", }, }, - + tooltip: { trigger: "item", axisPointer: { @@ -107,8 +102,8 @@ let powerOption = reactive({ }, legend: { type: "scroll", - width:800, - right:20, + width: 800, + right: 20, }, grid: { top: "8%", @@ -121,10 +116,10 @@ let powerOption = reactive({ type: 'category', data: [ ], - + }, yAxis: { - type: 'value', + type: 'value', }, series: [ ], @@ -144,54 +139,54 @@ let powerOption = reactive({ // // yields.value.setData(result.data); // } // } -function setcontentData(val){ - let monthData=[] - let powerMonth=[] - for(let key in val.power){ - monthData.push(key) - powerMonth.push(val.power[key]) - } - powerOption.option.xAxis.data=[] - powerOption.option.series=[] - powerOption.option.xAxis.data=monthData.reverse() - powerOption.option.series.push({ - data: powerMonth.reverse(), - type: 'bar', - showBackground: true, - backgroundStyle: { - color: 'rgba(180, 180, 180, 0.2)' - }, - itemStyle: { - color: function(params) { - // 通过返回值的下标一一对应将颜色赋给柱子上,return出去什么颜色就是什么颜色,这里可以写判断 - // console.log(params) - let color = ['#1089e7', '#f57474', '#56d0e3', '#f8b448', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'] - // return colors[params.dataIndex]; - return color[params.dataIndex]; - } - }, - barWidth:'20%', +function setcontentData(val) { + let monthData = [] + let powerMonth = [] + for (let key in val.power) { + monthData.push(key) + powerMonth.push(val.power[key]) + } + powerOption.option.xAxis.data = [] + powerOption.option.series = [] + powerOption.option.xAxis.data = monthData.reverse() + powerOption.option.series.push({ + data: powerMonth.reverse(), + type: 'bar', + showBackground: true, + backgroundStyle: { + color: 'rgba(180, 180, 180, 0.2)' + }, + itemStyle: { + color: function (params) { + // 通过返回值的下标一一对应将颜色赋给柱子上,return出去什么颜色就是什么颜色,这里可以写判断 + // console.log(params) + let color = ['#1089e7', '#f57474', '#56d0e3', '#f8b448', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'] + // return colors[params.dataIndex]; + return color[params.dataIndex]; + } + }, + barWidth: '20%', label: { - show: true, - color:'#fff', - formatter: function(params){ - return params.value.toLocaleString() - }, - position: "top", - textStyle: { - color: "#fff", - fontSize: 14, - }, - }, - }) - - powerref.value.changeData(powerOption.option) + show: true, + color: '#fff', + formatter: function (params) { + return params.value.toLocaleString() + }, + position: "top", + textStyle: { + color: "#fff", + fontSize: 14, + }, + }, + }) + + powerref.value.changeData(powerOption.option) - // pmref.value.setData({two:val.dust.pm25,ten:val.dust.pm10}) + // pmref.value.setData({two:val.dust.pm25,ten:val.dust.pm10}) } onMounted(() => { - + }); diff --git a/vue.config.js b/vue.config.js index 7ed6320..e17acad 100644 --- a/vue.config.js +++ b/vue.config.js @@ -21,8 +21,8 @@ module.exports = defineConfig( devServer: { proxy: { [process.env.VUE_APP_BASE_API]: { - target: 'http://192.168.10.98:9015', // 想要请求的url地址 - // target: 'http://8.130.165.100:9015', + // target: 'http://192.168.10.98:9015', // 想要请求的url地址 + target: 'http://8.141.87.86:9015', // target: 'http://192.168.110.19:8080', ws: true, // 是否要开启代理 changeOrigin: true,