lb 8 місяці тому
джерело
коміт
e1e73b341d
4 змінених файлів з 19 додано та 10 видалено
  1. +4
    -2
      src/components/Common/TodayFaultType/index.jsx
  2. +4
    -1
      src/components/Modules/EnergyCostAnalysis/ElectricityCost/index.jsx
  3. +10
    -6
      src/utils/energeChartOption.js
  4. +1
    -1
      src/utils/index.ts

+ 4
- 2
src/components/Common/TodayFaultType/index.jsx Переглянути файл

@@ -145,7 +145,7 @@ function getOptions(data, chart_type) {
axisPointer: {
type: "shadow",
},
className: 'xc-chart-tooltip'
className: "xc-chart-tooltip",
// backgroundColor: ''
},
xAxis: {
@@ -207,7 +207,9 @@ function getOptions(data, chart_type) {
fontSize: 10,
color: "#fffc",
},
data: (dataList || []).map((item) => item.value),
data: (dataList || []).map((item) =>
item.value == null || isNaN(+item.value) ? null : (+item.value).toFixed(2)
),
},
],
};


+ 4
- 1
src/components/Modules/EnergyCostAnalysis/ElectricityCost/index.jsx Переглянути файл

@@ -147,7 +147,10 @@ function getOptions(period, trend) {
},
},
series: {
data: trend[period].map((item) => item.qty),
// !(item.value == null || isNaN(+item.value)) ? (+item.value).toFixed(2) : null
data: trend[period].map((item) =>
item.qty == null || isNaN(+item.qty) ? null : (+item.qty).toFixed(2)
),
type: "line",
symbol: "circle",
symbolSize: 6,


+ 10
- 6
src/utils/energeChartOption.js Переглянути файл

@@ -4,7 +4,7 @@ export function lunarYear(year) {
return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
}

export function getOptions(period, source, trend, options={}) {
export function getOptions(period, source, trend, options = {}) {
if (trend[period].length == 0) return null;
const today = new Date();
const currentYear = today.getFullYear();
@@ -40,7 +40,7 @@ export function getOptions(period, source, trend, options={}) {
.fill(1)
.map((_, index) => {
if (period == "week") {
const dtimestamp = today - (index+1) * 24 * 60 * 60 * 1000;
const dtimestamp = today - (index + 1) * 24 * 60 * 60 * 1000;
return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
dtimestamp
).getDate()}`;
@@ -65,7 +65,7 @@ export function getOptions(period, source, trend, options={}) {
},
},
yAxis: {
name: source == 'elec' ? '单位/kWh' : "单位/Nm³",
name: source == "elec" ? "单位/kWh" : "单位/Nm³",
nameTextStyle: {
color: "#fff",
fontSize: 10,
@@ -96,10 +96,14 @@ export function getOptions(period, source, trend, options={}) {
{
data:
source == "elec"
? trend[period].map((item) => item.qty)
? trend[period].map((item) =>
item.qty == null || isNaN(+item.qty)
? null
: (+item.qty).toFixed(2)
)
: trend[period],
type: "line",
symbol: 'circle',
symbol: "circle",
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@@ -119,6 +123,6 @@ export function getOptions(period, source, trend, options={}) {
className: "xc-chart-tooltip",
// backgroundColor: ''
},
...options
...options,
};
}

+ 1
- 1
src/utils/index.ts Переглянути файл

@@ -124,8 +124,8 @@ new XClient(
new XClient(
{
url: "ws://10.70.2.2:8080/websocket/message?userId=ENERGY" + newUser,
// url: "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser,
name: "MES_DATA",
// "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser,
// "ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
},
energeHandler


Завантаження…
Відмінити
Зберегти