2241 lines
60 KiB
JavaScript
2241 lines
60 KiB
JavaScript
|
||
import * as echarts from "echarts";
|
||
import { getMinerAccountPower, getMinerAccountInfo, getMinerList, getMinerPower, getHistoryIncome, getHistoryOutcome, getAccountPowerDistribution } from "../../api/miningAccount"
|
||
import { Debounce,throttle }from "../../utils/publicMethods";
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
activeName: "power",
|
||
option: {
|
||
legend: {
|
||
right: 100,
|
||
show: true,
|
||
formatter: function (name) {
|
||
return name;
|
||
},
|
||
},
|
||
// grid: {//解决Y轴显示不全
|
||
// left: "2%",
|
||
// containLabel: true
|
||
// },
|
||
grid:{},
|
||
tooltip: {
|
||
trigger: "axis",
|
||
textStyle: {
|
||
align: "left",
|
||
},
|
||
animation: false,
|
||
formatter: function (params) {
|
||
var res
|
||
res = params[0].axisValueLabel;
|
||
|
||
|
||
for (let i = 0; i <= params.length - 1; i++) {
|
||
|
||
if (params[i].seriesName == "Rejection rate" || params[i].seriesName == "拒绝率") {
|
||
res += `</br>${params[i].marker} ${params[i].seriesName}      <span style="font-weight: bold">${params[i].value}%</span>`
|
||
}else{
|
||
res += `</br>${params[i].marker} ${params[i].seriesName}      <span style="font-weight: bold">${params[i].value}</span>`
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
return res;
|
||
},
|
||
axisPointer: {
|
||
animation: false,
|
||
snap: true,
|
||
label: {
|
||
precision: 2, //坐标轴保留的位数
|
||
},
|
||
type: "cross", //cross shadow
|
||
crossStyle: {
|
||
//十字轴横线
|
||
// opacity: "0",
|
||
width: 0.5,
|
||
},
|
||
lineStyle: {
|
||
// opacity: 0,
|
||
},
|
||
},
|
||
},
|
||
|
||
xAxis: {
|
||
// type: "time",
|
||
boundaryGap: false,
|
||
|
||
axisTick: {
|
||
//去除刻度
|
||
show: false,
|
||
},
|
||
axisLine: {
|
||
//去除轴线
|
||
show: false,
|
||
},
|
||
data: []
|
||
},
|
||
yAxis: [
|
||
{
|
||
position: "left",
|
||
type: "value",
|
||
name:"GH/s",
|
||
nameTextStyle:{
|
||
padding: [0, 0, 0,-40],
|
||
}
|
||
// min: `dataMin`,
|
||
// max: `dataMax`,
|
||
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: true,
|
||
min:0,
|
||
max:100,
|
||
splitLine:{//不显示右侧Y轴横线
|
||
show: false
|
||
}
|
||
},
|
||
|
||
],
|
||
dataZoom: [
|
||
{
|
||
type: "inside",
|
||
start: 0,
|
||
end: 100,
|
||
maxSpan: 100,
|
||
minSpan: 2,
|
||
// animation: false,
|
||
},
|
||
{
|
||
type: "inside",//slider
|
||
start: 0,
|
||
end: 100,
|
||
// showDetail: false,
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: "总算力",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#5721E4",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#5721E4",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(210,195,234)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [],
|
||
},
|
||
{
|
||
name: "Refusal rate",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#FE2E74",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#FE2E74",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(252,220,233)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [],
|
||
yAxisIndex: 1,
|
||
},
|
||
|
||
|
||
|
||
],
|
||
},
|
||
barOption: {
|
||
tooltip: {
|
||
trigger: 'axis',
|
||
axisPointer: {
|
||
type: 'shadow'
|
||
}
|
||
},
|
||
grid: {
|
||
left: '3%',
|
||
right: '8%',
|
||
bottom: '3%',
|
||
containLabel: true
|
||
},
|
||
xAxis: [
|
||
{
|
||
name:"MH/s",
|
||
type: 'category',
|
||
data: [],
|
||
axisTick: {
|
||
alignWithLabel: true
|
||
}
|
||
}
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: 'value',
|
||
show: true,
|
||
name:"Pcs",
|
||
nameTextStyle:{
|
||
padding: [0, 0, 0,-25],
|
||
}
|
||
|
||
}
|
||
],
|
||
dataZoom: [
|
||
{
|
||
type: "inside",
|
||
start: 0,
|
||
end: 100,
|
||
maxSpan: 100,
|
||
minSpan: 2,
|
||
animation: false,
|
||
},
|
||
{
|
||
type: "inside",//slider
|
||
start: 0,
|
||
end: 100,
|
||
// showDetail: false,
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: 'count',
|
||
type: 'bar',
|
||
barWidth: '60%',
|
||
data: [],
|
||
itemStyle: {
|
||
borderRadius: [100, 100, 0, 0],
|
||
color: "#7645EE",
|
||
}
|
||
}
|
||
]
|
||
},
|
||
miniOption: {
|
||
legend: {
|
||
right: 100,
|
||
show:false,
|
||
formatter: function (name) {
|
||
return name;
|
||
},
|
||
},
|
||
grid: {//解决Y轴显示不全
|
||
left: "5%",
|
||
containLabel: true
|
||
},
|
||
tooltip: {
|
||
trigger: "axis",
|
||
textStyle: {
|
||
align: "left",
|
||
},
|
||
animation: false,
|
||
formatter: function (params) {
|
||
var res
|
||
res = params[0].axisValueLabel;
|
||
|
||
|
||
for (let i = 0; i <= params.length - 1; i++) {
|
||
|
||
if (params[i].seriesName == "Rejection rate" || params[i].seriesName == "拒绝率") {
|
||
res += `</br>${params[i].marker} ${params[i].seriesName}      <span style="font-weight: bold">${params[i].value}%</span>`
|
||
}else{
|
||
res += `</br>${params[i].marker} ${params[i].seriesName}      <span style="font-weight: bold">${params[i].value}</span>`
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
return res;
|
||
},
|
||
axisPointer: {
|
||
animation: false,
|
||
snap: true,
|
||
label: {
|
||
precision: 2, //坐标轴保留的位数
|
||
},
|
||
type: "cross", //cross shadow
|
||
crossStyle: {
|
||
//十字轴横线
|
||
// opacity: "0",
|
||
width: 0.5,
|
||
},
|
||
lineStyle: {
|
||
// opacity: 0,
|
||
},
|
||
},
|
||
},
|
||
|
||
xAxis: {
|
||
// type: "time",
|
||
boundaryGap: false,
|
||
|
||
axisTick: {
|
||
//去除刻度
|
||
show: false,
|
||
},
|
||
axisLine: {
|
||
//去除轴线
|
||
show: false,
|
||
},
|
||
axisLabel:{},
|
||
|
||
data: ["07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1"]
|
||
},
|
||
yAxis: [
|
||
{
|
||
position: "left",
|
||
type: "value",
|
||
name:"MH/s",
|
||
nameTextStyle:{
|
||
|
||
padding: [0, 0, 0,-40],
|
||
}
|
||
// min: `dataMin`,
|
||
// max: `dataMax`,
|
||
// axisLabel: {
|
||
// formatter: function (value) {
|
||
// let data
|
||
// if (value > 10000000) {
|
||
// data = `${(value / 10000000)} KW`
|
||
// } else if (value > 1000000) {
|
||
// data = `${(value / 1000000)} M`
|
||
// } else if (value / 10000) {
|
||
// data = `${(value / 10000)} W`
|
||
// }
|
||
// return data
|
||
// }
|
||
// }
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: true,
|
||
splitLine:{//不显示右侧Y轴横线
|
||
show: false
|
||
}
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: false,
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: false,
|
||
},
|
||
],
|
||
dataZoom: [
|
||
{
|
||
type: "inside",
|
||
start: 0,
|
||
end: 100,
|
||
maxSpan: 100,
|
||
minSpan: 2,
|
||
animation: false,
|
||
},
|
||
{
|
||
type: "inside",//slider
|
||
start: 0,
|
||
end: 100,
|
||
// showDetail: false,
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: "Computational power",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#5721E4",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#5721E4",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(210,195,234)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
},
|
||
{
|
||
name: "Refusal rate",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#FE2E74",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#FE2E74",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(252,220,233)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
yAxisIndex: 1,
|
||
},
|
||
|
||
|
||
|
||
],
|
||
},
|
||
onLineOption: {
|
||
legend: {
|
||
right: 100,
|
||
show:false,
|
||
formatter: function (name) {
|
||
return name;
|
||
},
|
||
},
|
||
grid: {//解决Y轴显示不全
|
||
left: "5%",
|
||
containLabel: true
|
||
},
|
||
tooltip: {
|
||
trigger: "axis",
|
||
textStyle: {
|
||
align: "left",
|
||
},
|
||
animation: false,
|
||
formatter: function (params) {
|
||
var res
|
||
res = params[0].axisValueLabel;
|
||
res += `</br>${params[0].marker} <span style="font-weight: bold">${params[0].seriesName}</span>\u00A0\u00A0\u00A0\u00A0 ${params[0].value}
|
||
</br>${params[1].marker} <span style="font-weight: bold">${params[1].seriesName}</span>\u00A0\u00A0\u00A0\u00A0 ${params[1].value}%
|
||
`;
|
||
return res;
|
||
},
|
||
axisPointer: {
|
||
animation: false,
|
||
snap: true,
|
||
label: {
|
||
precision: 2, //坐标轴保留的位数
|
||
},
|
||
type: "cross", //cross shadow
|
||
crossStyle: {
|
||
//十字轴横线
|
||
// opacity: "0",
|
||
width: 0.5,
|
||
},
|
||
lineStyle: {
|
||
// opacity: 0,
|
||
},
|
||
},
|
||
},
|
||
|
||
xAxis: {
|
||
// type: "time",
|
||
boundaryGap: false,
|
||
|
||
axisTick: {
|
||
//去除刻度
|
||
show: false,
|
||
},
|
||
axisLine: {
|
||
//去除轴线
|
||
show: false,
|
||
},
|
||
data: ["07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1"]
|
||
},
|
||
yAxis: [
|
||
{
|
||
position: "left",
|
||
type: "value",
|
||
name:"MH/s",
|
||
nameTextStyle:{
|
||
|
||
padding: [0, 0, 0,-40],
|
||
}
|
||
// min: `dataMin`,
|
||
// max: `dataMax`,
|
||
// axisLabel: {
|
||
// formatter: function (value) {
|
||
// let data
|
||
// if (value > 10000000) {
|
||
// data = `${(value / 10000000)} KW`
|
||
// } else if (value > 1000000) {
|
||
// data = `${(value / 1000000)} M`
|
||
// } else if (value / 10000) {
|
||
// data = `${(value / 10000)} W`
|
||
// }
|
||
// return data
|
||
// }
|
||
// }
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: true,
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: false,
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: false,
|
||
},
|
||
],
|
||
dataZoom: [
|
||
{
|
||
type: "inside",
|
||
start: 0,
|
||
end: 100,
|
||
maxSpan: 100,
|
||
minSpan: 2,
|
||
animation: false,
|
||
},
|
||
{
|
||
type: "inside",//slider
|
||
start: 0,
|
||
end: 100,
|
||
// showDetail: false,
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: "Computational power",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#5721E4",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#5721E4",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(210,195,234)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
},
|
||
{
|
||
name: "Refusal rate",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#FE2E74",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#FE2E74",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(252,220,233)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
yAxisIndex: 1,
|
||
},
|
||
|
||
|
||
|
||
],
|
||
},
|
||
OffLineOption: {
|
||
legend: {
|
||
right: 100,
|
||
show:false,
|
||
formatter: function (name) {
|
||
return name;
|
||
},
|
||
},
|
||
grid: {//解决Y轴显示不全
|
||
left: "5%",
|
||
containLabel: true
|
||
},
|
||
tooltip: {
|
||
trigger: "axis",
|
||
textStyle: {
|
||
align: "left",
|
||
},
|
||
animation: false,
|
||
formatter: function (params) {
|
||
var res
|
||
res = params[0].axisValueLabel;
|
||
res += `</br>${params[0].marker} <span style="font-weight: bold">${params[0].seriesName}</span>\u00A0\u00A0\u00A0\u00A0 ${params[0].value}
|
||
</br>${params[1].marker} <span style="font-weight: bold">${params[1].seriesName}</span>\u00A0\u00A0\u00A0\u00A0 ${params[1].value}%
|
||
`;
|
||
return res;
|
||
},
|
||
axisPointer: {
|
||
animation: false,
|
||
snap: true,
|
||
label: {
|
||
precision: 2, //坐标轴保留的位数
|
||
},
|
||
type: "cross", //cross shadow
|
||
crossStyle: {
|
||
//十字轴横线
|
||
// opacity: "0",
|
||
width: 0.5,
|
||
},
|
||
lineStyle: {
|
||
// opacity: 0,
|
||
},
|
||
},
|
||
},
|
||
|
||
xAxis: {
|
||
// type: "time",
|
||
boundaryGap: false,
|
||
|
||
axisTick: {
|
||
//去除刻度
|
||
show: false,
|
||
},
|
||
axisLine: {
|
||
//去除轴线
|
||
show: false,
|
||
},
|
||
data: ["07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1","07-1"]
|
||
},
|
||
yAxis: [
|
||
{
|
||
position: "left",
|
||
type: "value",
|
||
name:"MH/s",
|
||
nameTextStyle:{
|
||
|
||
padding: [0, 0, 0,-40],
|
||
}
|
||
// min: `dataMin`,
|
||
// max: `dataMax`,
|
||
// axisLabel: {
|
||
// formatter: function (value) {
|
||
// let data
|
||
// if (value > 10000000) {
|
||
// data = `${(value / 10000000)} KW`
|
||
// } else if (value > 1000000) {
|
||
// data = `${(value / 1000000)} M`
|
||
// } else if (value / 10000) {
|
||
// data = `${(value / 10000)} W`
|
||
// }
|
||
// return data
|
||
// }
|
||
// }
|
||
},
|
||
{
|
||
position: "right",
|
||
// type: "log",
|
||
splitNumber: "5",
|
||
show: true,
|
||
splitLine:{//不显示右侧Y轴横线
|
||
show: false
|
||
}
|
||
},
|
||
|
||
],
|
||
dataZoom: [
|
||
{
|
||
type: "inside",
|
||
start: 0,
|
||
end: 100,
|
||
maxSpan: 100,
|
||
minSpan: 2,
|
||
animation: false,
|
||
},
|
||
{
|
||
type: "inside",//slider
|
||
start: 0,
|
||
end: 100,
|
||
// showDetail: false,
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: "Computational power",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#5721E4",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#5721E4",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(210,195,234)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
},
|
||
{
|
||
name: "Refusal rate",
|
||
type: "line",
|
||
smooth: false, //线条是否圆滑
|
||
symbol: "circle",
|
||
symbolSize: 5,
|
||
showSymbol: false,
|
||
itemStyle: {
|
||
color: "#FE2E74",
|
||
borderColor: "rgba(221,220,107,0.1)",
|
||
borderWidth: 12,
|
||
},
|
||
lineStyle: {
|
||
//线条样式
|
||
color: "#FE2E74",
|
||
width: "2",
|
||
},
|
||
areaStyle: {
|
||
origin: 'start',//颜色始终显示在线条下
|
||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
{
|
||
offset: 0,
|
||
color: 'rgb(252,220,233)'
|
||
},
|
||
{
|
||
offset: 1,
|
||
color: 'rgb(255, 255, 255)'
|
||
}
|
||
])
|
||
},
|
||
data: [12,15,8,3,6,9,78,12,63],
|
||
yAxisIndex: 1,
|
||
},
|
||
|
||
|
||
|
||
],
|
||
},
|
||
sunTabActiveName: "all",
|
||
Accordion: "",
|
||
currentPage: 1,
|
||
params: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
},
|
||
PowerParams: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
interval: "rt",
|
||
},
|
||
PowerDistribution: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
interval: "rt",
|
||
},
|
||
MinerListParams: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
type: "0",
|
||
filter: "",
|
||
limit: 50,
|
||
page: 1,
|
||
sort:`30m`,
|
||
collation:`asc`,
|
||
},
|
||
activeName2: "power", //power
|
||
IncomeParams: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
limit: 10,
|
||
page: 1,
|
||
},
|
||
OutcomeParams: {
|
||
account: "lx888",
|
||
coin: "grs",
|
||
limit: 10,
|
||
page: 1,
|
||
},
|
||
MinerAccountData: {
|
||
// totalProfit: "78678862.96791889",
|
||
// expend: "78678862.96791889",
|
||
// preProfit: "78678862.96791889",
|
||
// todayPorfit: "78678862.96791889",
|
||
// balance: "78678862.96791889",
|
||
},
|
||
MinerListData: {
|
||
// all: "100",
|
||
// online: "99",
|
||
// offline: "1",
|
||
// miner: "",
|
||
// rate: "55656",
|
||
// dailyRate: "5656",
|
||
// reject: "",
|
||
},
|
||
intervalList: [
|
||
// {
|
||
// value: "1h",
|
||
// label: "home.hour",
|
||
// },
|
||
{
|
||
value: "rt",
|
||
label: "home.realTime",
|
||
},
|
||
{
|
||
value: "1d",
|
||
label: "home.day",
|
||
},
|
||
],
|
||
HistoryIncomeData: [
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "565S656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "56G5656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "565Y656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// coin: "ETH",
|
||
// amount: "5645656",
|
||
// comment: "挖矿收益",
|
||
|
||
// },
|
||
|
||
|
||
|
||
|
||
|
||
],
|
||
HistoryOutcomeData: [
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56D5656",
|
||
// txid: "12345678d90",
|
||
// status: 0,
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56G5656",
|
||
// txid: "123456f7890",
|
||
// status: 0,
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "565T656",
|
||
// txid: "123sf4567890",
|
||
// status: 0,
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56D5656",
|
||
// txid: "12345678d90",
|
||
// status: 0,
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56G5656",
|
||
// txid: "123456f7890",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "565T656",
|
||
// txid: "123sf4567890",
|
||
// },
|
||
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56D5656",
|
||
// txid: "12345678d90",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56G5656",
|
||
// txid: "123456f7890",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "565T656",
|
||
// txid: "123sf4567890",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56D5656",
|
||
// txid: "12345678d90",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "56G5656",
|
||
// txid: "123456f7890",
|
||
// },
|
||
// {
|
||
// date: "2021-09-21",
|
||
// address: "0x1234567890",
|
||
// comment: "mona",
|
||
// amount: "565T656",
|
||
// txid: "123sf4567890",
|
||
// },
|
||
|
||
|
||
|
||
|
||
],
|
||
currentPageIncome: 1,
|
||
MinerListTableData: [
|
||
// {
|
||
// miner: "107fx61",
|
||
// rate: "0.0066666 ",
|
||
// dailyRate: "0.019999 ",
|
||
// reject: "0.01 TH/s",
|
||
// offline:1442,
|
||
// status:1
|
||
// },
|
||
// {
|
||
// miner: "107dfx62",
|
||
// rate: "0.407777 ",
|
||
// dailyRate: "0.016666 ",
|
||
// reject: "0.01 TH/s",
|
||
// offline:82,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107dfsx63",
|
||
// rate: "0.9635656 ",
|
||
// dailyRate: "0.018888",
|
||
// reject: "0.01 TH/s",
|
||
// offline:78,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107xsf6",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:1
|
||
// },
|
||
// {
|
||
// miner: "107xsf666",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107xsf678",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:1
|
||
// },
|
||
// {
|
||
// miner: "107xsf6",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107xsf6",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107xsf6",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:2
|
||
// },
|
||
// {
|
||
// miner: "107xsf6",
|
||
// rate: "0.00 H/s",
|
||
// dailyRate: "0.01 TH/s",
|
||
// reject: "0.01 TH/s",
|
||
// offline:61,
|
||
// status:2
|
||
// },
|
||
|
||
],
|
||
AccountPowerDistributionintervalList: [
|
||
{
|
||
value: "rt",
|
||
label: "home.realTime",
|
||
},
|
||
{
|
||
value: "1d",
|
||
label: "home.day",
|
||
},
|
||
],
|
||
miniLoading:false,
|
||
search: "",
|
||
input2: "",
|
||
timeActive: "rt",
|
||
barActive: "rt",
|
||
powerChartLoading: false,
|
||
barChartLoading: false,
|
||
miniChartParams: {
|
||
miner: "",
|
||
coin: "grs",
|
||
},
|
||
ids: "smallChart107fx61",
|
||
activeMiner:"",
|
||
miniId:"",
|
||
MinerListLoading:false,
|
||
miner:"miner",
|
||
accountId:"",
|
||
currentPageMiner: 1,
|
||
minerTotal:0,
|
||
accountItem:{},
|
||
HistoryIncomeTotal:0,
|
||
HistoryOutcomeTotal:0,
|
||
stateList:[{
|
||
value: "1",
|
||
label: "mining.onLine"
|
||
},{
|
||
value: "2",
|
||
label: "mining.offLine"
|
||
},
|
||
],
|
||
Sort30:"asc",
|
||
Sort1h:"asc",
|
||
paymentStatusList:[
|
||
{
|
||
value: 0,
|
||
label: "mining.paymentInProgress"
|
||
},
|
||
{
|
||
value: 1,
|
||
label: "mining.paymentCompleted"
|
||
}
|
||
|
||
|
||
],
|
||
lang: 'zh',
|
||
|
||
}
|
||
},
|
||
computed: {
|
||
sortedMinerListTableData() { //离线旷工靠前
|
||
if (!this.MinerListTableData) return [];
|
||
|
||
return [...this.MinerListTableData].sort((a, b) => {
|
||
// 确保 status 是字符串类型
|
||
const statusA = String(a.status);
|
||
const statusB = String(b.status);
|
||
|
||
// 离线(status='2')的排在前面
|
||
if (statusA === '2' && statusB !== '2') return -1;
|
||
if (statusA !== '2' && statusB === '2') return 1;
|
||
|
||
// status 相同时保持原有顺序
|
||
return 0;
|
||
});
|
||
}
|
||
},
|
||
watch: {
|
||
'$route' (to, from) {
|
||
this.accountItem = JSON.parse(localStorage.getItem(`accountItem`))
|
||
this.accountId = this.accountItem .id
|
||
this.params.account = this.accountItem .ma
|
||
this.params.coin = this.accountItem .coin
|
||
this.PowerParams.account = this.accountItem .ma
|
||
this.PowerParams.coin = this.accountItem .coin
|
||
this.PowerDistribution.account = this.accountItem .ma
|
||
this.PowerDistribution.coin = this.accountItem .coin
|
||
this.MinerListParams.account = this.accountItem .ma
|
||
this.MinerListParams.coin = this.accountItem .coin
|
||
this.OutcomeParams.account = this.accountItem .ma
|
||
this.OutcomeParams.coin = this.accountItem .coin
|
||
this.IncomeParams.account = this.accountItem .ma
|
||
this.IncomeParams.coin = this.accountItem .coin
|
||
|
||
|
||
|
||
|
||
|
||
|
||
this.getMinerAccountInfoData(this.params)
|
||
this.getMinerAccountPowerData(this.PowerParams)
|
||
this.getAccountPowerDistributionData(this.PowerDistribution)
|
||
this.getMinerListData(this.MinerListParams)
|
||
this.getHistoryIncomeData(this.IncomeParams)
|
||
this.getHistoryOutcomeData(this.OutcomeParams)
|
||
|
||
|
||
|
||
|
||
|
||
|
||
},
|
||
"$i18n.locale":{
|
||
|
||
handler(val) {
|
||
// this.lang = val;
|
||
location.reload();//刷新页面 刷新echarts
|
||
},
|
||
|
||
}
|
||
},
|
||
mounted() {
|
||
this.lang = this.$i18n.locale;
|
||
this.accountItem = JSON.parse(localStorage.getItem(`accountItem`))
|
||
this.accountId = this.accountItem .id
|
||
this.params.account = this.accountItem .ma
|
||
this.params.coin = this.accountItem .coin
|
||
this.PowerParams.account = this.accountItem .ma
|
||
this.PowerParams.coin = this.accountItem .coin
|
||
this.PowerDistribution.account = this.accountItem .ma
|
||
this.PowerDistribution.coin = this.accountItem .coin
|
||
this.MinerListParams.account = this.accountItem .ma
|
||
this.MinerListParams.coin = this.accountItem .coin
|
||
this.OutcomeParams.account = this.accountItem .ma
|
||
this.OutcomeParams.coin = this.accountItem .coin
|
||
this.IncomeParams.account = this.accountItem .ma
|
||
this.IncomeParams.coin = this.accountItem .coin
|
||
|
||
if (this.$isMobile) {
|
||
|
||
|
||
this.option.yAxis[1].show =false
|
||
this.option.grid.left="16%"
|
||
this.option.grid.right="5%"
|
||
this.option.grid.top="10%"
|
||
this.option.grid.bottom="45%"
|
||
|
||
this.option.legend.bottom=18
|
||
this.option.legend.right="30%"
|
||
this.option.xAxis.axisLabel= {
|
||
interval: 8,
|
||
rotate: 70
|
||
}
|
||
|
||
|
||
this.barOption.grid.right="16%"
|
||
|
||
this.miniOption.yAxis[1].show =false
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
this.getMinerAccountInfoData(this.params)
|
||
this.getMinerAccountPowerData(this.PowerParams)
|
||
this.getAccountPowerDistributionData(this.PowerDistribution)
|
||
this.getMinerListData(this.MinerListParams)
|
||
this.getHistoryIncomeData(this.IncomeParams)
|
||
this.getHistoryOutcomeData(this.OutcomeParams)
|
||
|
||
},
|
||
methods: {
|
||
|
||
//初始化图表
|
||
inCharts() {
|
||
this.myChart = echarts.init(document.getElementById("powerChart"));
|
||
this.option.series[0].name= this.$t(`home.finallyPower`)
|
||
this.option.series[1].name= this.$t(`home.rejectionRate`)
|
||
this.myChart.setOption(this.option);
|
||
|
||
window.addEventListener('resize', throttle(() => {
|
||
if (this.myChart) this.myChart.resize();
|
||
}, 200));
|
||
},
|
||
//初始化小图表
|
||
smallInCharts(option) {
|
||
|
||
// if (this.miniChart == null) {
|
||
// this.miniChart = echarts.init(document.getElementById("smallChart"));
|
||
// }
|
||
// this.miniChart.setOption(this.miniOption,true);
|
||
|
||
if (this.$isMobile) {
|
||
this.miniOption.yAxis[1].show =false
|
||
}
|
||
option.series[0].name= this.$t(`home.minerSComputingPower`)
|
||
option.series[1].name= this.$t(`home.rejectionRate`)
|
||
this.miniChart.setOption(option,true);
|
||
|
||
window.addEventListener('resize', throttle(() => {
|
||
if (this.miniChart) this.miniChart.resize();
|
||
}, 200));
|
||
|
||
|
||
},
|
||
barInCharts() {
|
||
if (this.barChart == null) {
|
||
this.barChart = echarts.init(document.getElementById("barChart"));
|
||
}
|
||
this.barOption.series[0].name = this.$t(`home.numberOfMiningMachines`);
|
||
this.barChart.setOption(this.barOption);
|
||
|
||
|
||
window.addEventListener('resize', throttle(() => {
|
||
if (this.barChart) this.barChart.resize();
|
||
}, 200));
|
||
},
|
||
//获取当前挖矿账号信息(包含收益、余额)
|
||
async getMinerAccountInfoData(params) {
|
||
const data = await getMinerAccountInfo(params)
|
||
this.MinerAccountData = data.data
|
||
// console.log(data,"获取币种信息");
|
||
},
|
||
async getMinerAccountPowerData(params) {
|
||
this.powerChartLoading = true
|
||
const data = await getMinerAccountPower(params)
|
||
|
||
if (!data) {
|
||
this.powerChartLoading = false
|
||
if (this.myChart) {
|
||
this.myChart.dispose()//销毁图表实列
|
||
}
|
||
return
|
||
}
|
||
let chartData = data.data
|
||
let xData = []
|
||
let pvData = []
|
||
let rejectRate = []
|
||
chartData.forEach(item => {
|
||
|
||
if (item.date.includes(`T`) && params.interval == `rt`) {
|
||
item.date= `${item.date.split("T")[0]} ${item.date.split("T")[1].split(`.`)[0]}`
|
||
} else if(item.date.includes(`T`) && params.interval == `1d`){
|
||
item.date= item.date.split("T")[0]
|
||
}
|
||
xData.push(item.date)
|
||
pvData.push(item.pv.toFixed(2))
|
||
rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
});
|
||
let maxValue = Math.max(...rejectRate)
|
||
maxValue= Math.round(maxValue*3)
|
||
if (maxValue>0) {
|
||
|
||
this.option.yAxis[1].max=maxValue
|
||
}
|
||
|
||
this.option.xAxis.data = xData
|
||
this.option.series[0].data = pvData
|
||
this.option.series[1].data = rejectRate
|
||
|
||
this.inCharts()
|
||
this.powerChartLoading = false
|
||
|
||
|
||
|
||
},
|
||
async getAccountPowerDistributionData(params) {
|
||
this.barChartLoading = true
|
||
const data = await getAccountPowerDistribution(params)
|
||
let barData = data.data
|
||
let xData = []
|
||
let barValueList = []
|
||
barData.forEach(item => {
|
||
xData.push(`${item.low}-${item.high}`)
|
||
barValueList.push(item.count)
|
||
})
|
||
this.barOption.xAxis[0].data = xData
|
||
this.barOption.series[0].data = barValueList
|
||
this.barInCharts()
|
||
this.barChartLoading = false
|
||
},
|
||
formatNumber(num) {//保留两位小数并补0
|
||
const intPart = Math.floor(num);
|
||
const decimalPart = Math.floor((num - intPart) * 100);
|
||
return `${intPart}.${String(decimalPart).padStart(2, '0')}`;
|
||
},
|
||
async getMinerListData(params) {
|
||
this.MinerListLoading = true
|
||
const data = await getMinerList(params)
|
||
if (data && data.code == 200) {
|
||
this.MinerListData = data.data
|
||
if (this.MinerListData.submit && this.MinerListData.submit.includes(`T`)) {
|
||
this.MinerListData.submit =`${this.MinerListData.submit.split(`T`)[0]} ${this.MinerListData.submit.split(`T`)[1].split(`.`)[0]}`
|
||
}
|
||
this.MinerListTableData = data.data.rows
|
||
|
||
this.MinerListData.rate = this.formatNumber(this.MinerListData.rate)
|
||
this.MinerListData.dailyRate = this.formatNumber(this.MinerListData.dailyRate)
|
||
|
||
this.MinerListTableData.forEach(item=>{
|
||
if (item.submit.includes(`T`)) {
|
||
item.submit = `${item.submit.split(`T`)[0]} ${item.submit.split(`T`)[1].split(`.`)[0]}`
|
||
|
||
}
|
||
item.rate= this.formatNumber(item.rate)
|
||
item.dailyRate= this.formatNumber(item.dailyRate)
|
||
|
||
})
|
||
this.minerTotal= data.data.total
|
||
// switch (this.sunTabActiveName) {
|
||
// case "all":
|
||
// this.minerTotal=data.data.all
|
||
// break;
|
||
// case "onLine":
|
||
// this.minerTotal=data.data.online
|
||
// break;
|
||
// case "off-line":
|
||
// this.minerTotal=data.data.offline
|
||
// break;
|
||
|
||
// default:
|
||
// break;
|
||
// }
|
||
|
||
|
||
}
|
||
|
||
this.MinerListLoading = false
|
||
|
||
},
|
||
|
||
//小图
|
||
// async getMinerPowerData(params) {
|
||
// this.miniLoading=true
|
||
// const data = await getMinerPower(params)
|
||
|
||
// if (!data) {
|
||
// this.miniLoading=false
|
||
// return
|
||
// }
|
||
// let miniData = data.data
|
||
// let xData = []
|
||
// let pv = []
|
||
// let rejectRate = []
|
||
|
||
// miniData.forEach(item => {
|
||
|
||
// if (item.date.includes(`T`) && params.interval == `1h`) {
|
||
// item.date= `${item.date.split("T")[0]} ${item.date.split("T")[1].split(`.`)[0]}`
|
||
// } else if(item.date.includes(`T`) && params.interval == `1d`){
|
||
// item.date= item.date.split("T")[0]
|
||
// }
|
||
// item.date= `${item.date.split("T")[0]} ${item.date.split("T")[1].split(`.`)[0]}`
|
||
// xData.push(item.date)
|
||
|
||
|
||
|
||
|
||
// pv.push(item.pv.toFixed(2))
|
||
// rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
// })
|
||
|
||
// this.miniOption.xAxis.data = xData
|
||
// this.miniOption.series[0].data = pv
|
||
// this.miniOption.series[1].data = rejectRate
|
||
|
||
// this.miniOption.series[0].name= this.$t(`home.finallyPower`)
|
||
// this.miniOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
// this.ids = `SmallChart${this.miniId}`
|
||
// this.miniChart = echarts.init(document.getElementById(this.ids))
|
||
// let maxValue = Math.max(...rejectRate)
|
||
// maxValue= Math.round(maxValue*3)
|
||
// if (maxValue>0) {
|
||
// this.miniOption.yAxis[1].max=maxValue
|
||
// }
|
||
|
||
// this.$nextTick(() => {
|
||
// this.smallInCharts(this.miniOption)
|
||
// });
|
||
|
||
|
||
|
||
// this.miniLoading=false
|
||
// },
|
||
getMinerPowerData:Debounce(async function(params){
|
||
this.miniLoading=true
|
||
const data = await getMinerPower(params)
|
||
|
||
if (!data) {
|
||
this.miniLoading=false
|
||
return
|
||
}
|
||
let miniData = data.data
|
||
let xData = []
|
||
let pv = []
|
||
let rejectRate = []
|
||
|
||
miniData.forEach(item => {
|
||
|
||
if (item.date.includes(`T`) && params.interval == `1h`) {
|
||
item.date= `${item.date.split("T")[0]} ${item.date.split("T")[1].split(`.`)[0]}`
|
||
} else if(item.date.includes(`T`) && params.interval == `1d`){
|
||
item.date= item.date.split("T")[0]
|
||
}
|
||
item.date= `${item.date.split("T")[0]} ${item.date.split("T")[1].split(`.`)[0]}`
|
||
xData.push(item.date)
|
||
|
||
|
||
|
||
|
||
pv.push(item.pv.toFixed(2))
|
||
rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
})
|
||
|
||
this.miniOption.xAxis.data = xData
|
||
this.miniOption.series[0].data = pv
|
||
this.miniOption.series[1].data = rejectRate
|
||
|
||
this.miniOption.series[0].name= this.$t(`home.finallyPower`)
|
||
this.miniOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
this.ids = `SmallChart${this.miniId}`
|
||
this.miniChart = echarts.init(document.getElementById(this.ids))
|
||
let maxValue = Math.max(...rejectRate)
|
||
maxValue= Math.round(maxValue*3)
|
||
if (maxValue>0) {
|
||
this.miniOption.yAxis[1].max=maxValue
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
this.$nextTick(() => {
|
||
this.smallInCharts(this.miniOption)
|
||
});
|
||
console.log(this.miniOption,5656565);
|
||
|
||
|
||
|
||
this.miniLoading=false
|
||
},200),
|
||
//小图
|
||
// async getMinerPowerOnLine(params) {
|
||
// this.miniLoading=true
|
||
// const data = await getMinerPower(params)
|
||
|
||
// if (!data) {
|
||
// this.miniLoading=false
|
||
// return
|
||
// }
|
||
// let miniData = data.data
|
||
// let xData = []
|
||
// let pv = []
|
||
// let rejectRate = []
|
||
|
||
// miniData.forEach(item => {
|
||
// if (item.date.includes(`T`)) {
|
||
// xData.push(`${item.date.split("T")[0]} ${item.date.split("T")[1].split(".")[0]}` )
|
||
|
||
// } else {
|
||
// xData.push(item.date)
|
||
// }
|
||
|
||
// pv.push(item.pv.toFixed(2))
|
||
// rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
// })
|
||
|
||
|
||
// this.onLineOption.xAxis.data = xData
|
||
// this.onLineOption.series[0].data = pv
|
||
// this.onLineOption.series[1].data = rejectRate
|
||
// this.onLineOption.series[0].name= this.$t(`home.finallyPower`)
|
||
// this.onLineOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
// this.ids = `Small${this.miniId}`
|
||
// this.miniChartOnLine = echarts.init(document.getElementById(this.ids))
|
||
|
||
// this.$nextTick(() => {
|
||
// this.miniChartOnLine.setOption(this.onLineOption,true);
|
||
// window.addEventListener("resize", () => {
|
||
// if (this.miniChartOnLine) this.miniChartOnLine.resize();
|
||
// });
|
||
// });
|
||
|
||
|
||
|
||
// this.miniLoading=false
|
||
// },
|
||
getMinerPowerOnLine:Debounce(async function(params){
|
||
|
||
this.miniLoading=true
|
||
const data = await getMinerPower(params)
|
||
|
||
if (!data) {
|
||
this.miniLoading=false
|
||
return
|
||
}
|
||
let miniData = data.data
|
||
let xData = []
|
||
let pv = []
|
||
let rejectRate = []
|
||
|
||
miniData.forEach(item => {
|
||
if (item.date.includes(`T`)) {
|
||
xData.push(`${item.date.split("T")[0]} ${item.date.split("T")[1].split(".")[0]}` )
|
||
|
||
} else {
|
||
xData.push(item.date)
|
||
}
|
||
|
||
pv.push(item.pv.toFixed(2))
|
||
rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
})
|
||
|
||
|
||
this.onLineOption.xAxis.data = xData
|
||
this.onLineOption.series[0].data = pv
|
||
this.onLineOption.series[1].data = rejectRate
|
||
this.onLineOption.series[0].name= this.$t(`home.finallyPower`)
|
||
this.onLineOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
this.ids = `Small${this.miniId}`
|
||
this.miniChartOnLine = echarts.init(document.getElementById(this.ids))
|
||
|
||
this.$nextTick(() => {
|
||
this.miniChartOnLine.setOption(this.onLineOption,true);
|
||
// window.addEventListener("resize", () => {
|
||
// if (this.miniChartOnLine) this.miniChartOnLine.resize();
|
||
// });
|
||
window.addEventListener('resize', throttle(() => {
|
||
if (this.miniChartOnLine) this.miniChartOnLine.resize();
|
||
}, 200));
|
||
|
||
});
|
||
|
||
|
||
|
||
this.miniLoading=false
|
||
|
||
|
||
},200),
|
||
//小图
|
||
// async getMinerPowerOffLine(params) {
|
||
// this.miniLoading=true
|
||
// const data = await getMinerPower(params)
|
||
// if (!data) {
|
||
// this.miniLoading=false
|
||
// return
|
||
// }
|
||
// let miniData = data.data
|
||
// let xData = []
|
||
// let pv = []
|
||
// let rejectRate = []
|
||
|
||
// miniData.forEach(item => {
|
||
// if (item.date.includes(`T`)) {
|
||
// xData.push(`${item.date.split("T")[0]} ${item.date.split("T")[1].split(".")[0]}` )
|
||
|
||
// } else {
|
||
// xData.push(item.date)
|
||
// }
|
||
|
||
// pv.push(item.pv.toFixed(2))
|
||
// rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
// })
|
||
|
||
|
||
// this.OffLineOption.xAxis.data = xData
|
||
// this.OffLineOption.series[0].data = pv
|
||
// this.OffLineOption.series[1].data = rejectRate
|
||
// this.OffLineOption.series[0].name= this.$t(`home.finallyPower`)
|
||
// this.OffLineOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
|
||
// this.ids = `SmallOff${this.miniId}`
|
||
// this.miniChartOff = echarts.init(document.getElementById(this.ids))
|
||
|
||
// this.$nextTick(() => {
|
||
// this.miniChartOff.setOption(this.OffLineOption,true);
|
||
// window.addEventListener("resize", () => {
|
||
// if (this.miniChartOff) this.miniChartOff.resize();
|
||
// });
|
||
// });
|
||
|
||
|
||
|
||
// this.miniLoading=false
|
||
// },
|
||
getMinerPowerOffLine:Debounce(async function(params){
|
||
this.miniLoading=true
|
||
const data = await getMinerPower(params)
|
||
if (!data) {
|
||
this.miniLoading=false
|
||
return
|
||
}
|
||
let miniData = data.data
|
||
let xData = []
|
||
let pv = []
|
||
let rejectRate = []
|
||
|
||
miniData.forEach(item => {
|
||
if (item.date.includes(`T`)) {
|
||
xData.push(`${item.date.split("T")[0]} ${item.date.split("T")[1].split(".")[0]}` )
|
||
|
||
} else {
|
||
xData.push(item.date)
|
||
}
|
||
|
||
pv.push(item.pv.toFixed(2))
|
||
rejectRate.push((item.rejectRate * 100).toFixed(4))
|
||
})
|
||
|
||
|
||
this.OffLineOption.xAxis.data = xData
|
||
this.OffLineOption.series[0].data = pv
|
||
this.OffLineOption.series[1].data = rejectRate
|
||
this.OffLineOption.series[0].name= this.$t(`home.finallyPower`)
|
||
this.OffLineOption.series[1].name= this.$t(`home.rejectionRate`)
|
||
|
||
|
||
this.ids = `SmallOff${this.miniId}`
|
||
this.miniChartOff = echarts.init(document.getElementById(this.ids))
|
||
|
||
this.$nextTick(() => {
|
||
this.miniChartOff.setOption(this.OffLineOption,true);
|
||
// window.addEventListener("resize", () => {
|
||
// if (this.miniChartOff) this.miniChartOff.resize();
|
||
// });
|
||
|
||
window.addEventListener('resize', throttle(() => {
|
||
if (this.miniChartOff) this.miniChartOff.resize();
|
||
}, 200))
|
||
});
|
||
|
||
|
||
|
||
this.miniLoading=false
|
||
|
||
|
||
},200),
|
||
async getHistoryIncomeData(params) {
|
||
const data = await getHistoryIncome(params)
|
||
|
||
if (data && data.code == 200) {
|
||
this.HistoryIncomeData = data.rows
|
||
this.HistoryIncomeTotal=data.total
|
||
this.HistoryIncomeData.forEach(item=>{
|
||
if (item.date.includes(`T`)) {
|
||
item.date =item.date.split(`T`)[0]
|
||
}
|
||
})
|
||
|
||
|
||
}
|
||
|
||
},
|
||
async getHistoryOutcomeData(params) {
|
||
const data = await getHistoryOutcome(params)
|
||
if (data && data.code == 200) {
|
||
this.HistoryOutcomeData = data.rows
|
||
this.HistoryOutcomeTotal=data.total
|
||
|
||
this.HistoryOutcomeData.forEach(item=>{
|
||
if (item.date.includes(`T`)) {
|
||
item.date =`${item.date.split(`T`)[0]} `
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
|
||
},
|
||
|
||
// handelMiniChart(id, miner) {
|
||
|
||
// if (!this.Accordion) return
|
||
// this.miniId = id
|
||
// this.miner = miner
|
||
// this.$nextTick(() => {
|
||
// this.getMinerPowerData({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
// });
|
||
|
||
// },
|
||
|
||
handelMiniChart: throttle(function(id, miner) {
|
||
if (!this.Accordion) return
|
||
this.miniId = id
|
||
this.miner = miner
|
||
this.$nextTick(() => {
|
||
this.getMinerPowerData({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
});
|
||
}, 1000),
|
||
|
||
|
||
|
||
// handelOnLineMiniChart(id, miner){
|
||
// if (!this.Accordion) return
|
||
// this.miniId = id
|
||
// this.$nextTick(() => {
|
||
// this.getMinerPowerOnLine({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
// });
|
||
// },
|
||
|
||
|
||
handelOnLineMiniChart: throttle(function(id, miner) {
|
||
if (!this.Accordion) return
|
||
this.miniId = id
|
||
this.$nextTick(() => {
|
||
this.getMinerPowerOnLine({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
});
|
||
}, 1000),
|
||
// handelMiniOffLine(id, miner){
|
||
// if (!this.Accordion) return
|
||
// this.miniId = id
|
||
// this.$nextTick(() => {
|
||
// this.getMinerPowerOffLine({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
// });
|
||
// },
|
||
|
||
handelMiniOffLine: throttle(function(id, miner) {
|
||
if (!this.Accordion) return
|
||
this.miniId = id
|
||
this.$nextTick(() => {
|
||
this.getMinerPowerOffLine({ miner:miner, coin: this.params.coin, account: this.params.account })
|
||
});
|
||
}, 1000),
|
||
|
||
|
||
|
||
handleClick() {
|
||
switch (this.activeName) {
|
||
case "power":
|
||
this.inCharts()
|
||
// this.getMinerAccountPowerData(this.PowerParams)
|
||
break;
|
||
case "miningMachineDistribution":
|
||
this.distributionInCharts()
|
||
// this.getAccountPowerDistributionData(this.PowerDistribution)
|
||
break;
|
||
|
||
|
||
|
||
default:
|
||
break;
|
||
}
|
||
},
|
||
handleClick2(activeName2) {
|
||
this.activeName2 = activeName2;
|
||
this.search=""
|
||
this.MinerListParams.filter=""
|
||
this.Accordion=""
|
||
this.IncomeParams.limit=10
|
||
this.MinerListParams.limit=50
|
||
this.OutcomeParams.limit =10
|
||
switch (this.activeName2) {
|
||
case "power":
|
||
this.getMinerListData(this.MinerListParams)
|
||
break;
|
||
case "miningMachine":
|
||
this.getHistoryIncomeData(this.IncomeParams)
|
||
break;
|
||
case "payment":
|
||
this.getHistoryOutcomeData(this.OutcomeParams)
|
||
break;
|
||
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
|
||
},
|
||
onlineStatus(sunTabActiveName) {
|
||
this.Accordion=""
|
||
this.search=""
|
||
this.MinerListParams.filter=""
|
||
this.sunTabActiveName = sunTabActiveName
|
||
switch (this.sunTabActiveName) {
|
||
case "all":
|
||
this.MinerListParams.type = 0
|
||
break;
|
||
case "onLine":
|
||
this.MinerListParams.type = 1
|
||
break;
|
||
case "off-line":
|
||
this.MinerListParams.type = 2
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
handleInterval(value) {
|
||
this.PowerParams.interval = value
|
||
this.timeActive = value
|
||
this.getMinerAccountPowerData(this.PowerParams)
|
||
},
|
||
distributionInterval(value) {
|
||
this.PowerDistribution.interval = value
|
||
this.barActive = value
|
||
this.getAccountPowerDistributionData(this.PowerDistribution)
|
||
},
|
||
|
||
handelSearch() {
|
||
this.MinerListParams.filter = this.search
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
handleSizeChange(val) {
|
||
console.log(`每页 ${val} 条`);
|
||
this.OutcomeParams.limit = val
|
||
this.OutcomeParams.page = 1
|
||
this.getHistoryOutcomeData(this.OutcomeParams)
|
||
this.currentPage = 1
|
||
},
|
||
handleCurrentChange(val) {
|
||
console.log(`当前页: ${val}`);
|
||
this.OutcomeParams.page = val
|
||
this.getHistoryOutcomeData(this.OutcomeParams)
|
||
},
|
||
handleSizeChangeIncome(val) {
|
||
console.log(`每页 ${val} 条`);
|
||
this.IncomeParams.limit = val
|
||
this.IncomeParams.page = 1
|
||
this.getHistoryIncomeData(this.IncomeParams)
|
||
this.currentPageIncome = 1
|
||
},
|
||
handleCurrentChangeIncome(val) {
|
||
console.log(`当前页: ${val}`);
|
||
this.IncomeParams.page = val
|
||
this.getHistoryIncomeData(this.IncomeParams)
|
||
},
|
||
handleSizeMiner(val) {
|
||
console.log(`每页 ${val} 条`);
|
||
this.MinerListParams.limit = val
|
||
this.MinerListParams.page = 1
|
||
this.getMinerListData(this.MinerListParams)
|
||
this.currentPageMiner = 1
|
||
},
|
||
handleCurrentMiner(val) {
|
||
console.log(`当前页: ${val}`);
|
||
this.MinerListParams.page = val
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
|
||
handelStateList(value ){
|
||
return this.stateList.find(item => item.value == value).label || ""
|
||
},
|
||
handleSort(sort){
|
||
this.MinerListParams.sort = sort
|
||
if ( this.MinerListParams.collation == "asc") {
|
||
this.MinerListParams.collation = "desc"
|
||
}else{
|
||
this.MinerListParams.collation = "asc"
|
||
}
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
handleSort30(){
|
||
if ( this.MinerListParams.collation[0] == "asc") {
|
||
this.MinerListParams.collation[0] = "desc"
|
||
}else{
|
||
this.MinerListParams.collation[0] = "asc"
|
||
}
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
handleSort1h(){
|
||
if ( this.MinerListParams.collation[1] == "asc") {
|
||
this.MinerListParams.collation[1] = "desc"
|
||
}else{
|
||
this.MinerListParams.collation[1] = "asc"
|
||
}
|
||
this.getMinerListData(this.MinerListParams)
|
||
},
|
||
handelTimeInterval(time){
|
||
if (time) {
|
||
|
||
var seconds = time * 60;
|
||
var days = Math.floor(seconds / (3600 * 24));
|
||
var hours = Math.floor((seconds % (3600 * 24)) / 3600);
|
||
var minutes = Math.floor((seconds % 3600) / 60);
|
||
var secs = seconds % 60;
|
||
|
||
|
||
// var hours = Math.floor(minutes / 60);
|
||
// var remainingMinutes = minutes % 60;
|
||
// return hours + "时" + remainingMinutes + "分";
|
||
|
||
if (days) {
|
||
return `(${days}${this.$t(`personal.day`)} ${hours}${this.$t(`personal.hour`)} ${minutes}${this.$t(`personal.minute`)} ${this.$t(`personal.front`)})`
|
||
}else if (hours) {
|
||
return `(${hours}${this.$t(`personal.hour`)} ${minutes}${this.$t(`personal.minute`)} ${this.$t(`personal.front`)})`
|
||
}else if(minutes){
|
||
return `( ${minutes}${this.$t(`personal.minute`)} ${this.$t(`personal.front`)})`
|
||
}
|
||
}
|
||
},
|
||
|
||
jumpPage() {
|
||
|
||
this.$router.push({
|
||
path: `/${this.lang}/personalCenter/personalMining`,
|
||
query: {
|
||
id: this.accountId,
|
||
coin: this.params.coin,
|
||
ma: this.params.account
|
||
}
|
||
});
|
||
},
|
||
async copyTxid(ID) {
|
||
let id = `id${ID}`
|
||
let d= document.getElementById(id)
|
||
// d.select() //选中
|
||
// document.execCommand("copy") //直接复制
|
||
try {
|
||
await navigator.clipboard.writeText(d.textContent);
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copySuccessful`),
|
||
type: 'success'
|
||
});
|
||
} catch (err) {
|
||
console.log(err);
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copyFailed`),
|
||
type: 'error'
|
||
});
|
||
}
|
||
},
|
||
handelPayment(val){
|
||
if (val || val == 0) {
|
||
let obj= this.paymentStatusList.find(item=>item.value ==val)
|
||
|
||
return obj.label
|
||
}else{
|
||
return ''
|
||
}
|
||
},
|
||
clickCopyAddress(item){
|
||
// 创建临时输入框
|
||
var tempInput = document.createElement('input');
|
||
tempInput.value = item.address;
|
||
document.body.appendChild(tempInput);
|
||
|
||
try {
|
||
tempInput.select();
|
||
const isCopySuccessful = document.execCommand('copy');
|
||
if (isCopySuccessful) {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copySuccessful`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
} else {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copyFailed`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
}
|
||
} catch (error) {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copyFailed`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
} finally {
|
||
if (document.body.contains(tempInput)) {
|
||
document.body.removeChild(tempInput);
|
||
} else {
|
||
console.log('临时输入框不是 body 的子节点,无法移除。');
|
||
}
|
||
}
|
||
|
||
},
|
||
clickCopyTxid(item){
|
||
// 创建临时输入框
|
||
var tempInput = document.createElement('input');
|
||
tempInput.value = item.txid;
|
||
document.body.appendChild(tempInput);
|
||
|
||
try {
|
||
tempInput.select();
|
||
const isCopySuccessful = document.execCommand('copy');
|
||
if (isCopySuccessful) {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copySuccessful`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
} else {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copyFailed`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
}
|
||
} catch (error) {
|
||
this.$message({
|
||
showClose: true,
|
||
message: this.$t(`personal.copyFailed`),
|
||
type: 'success',
|
||
|
||
|
||
});
|
||
} finally {
|
||
if (document.body.contains(tempInput)) {
|
||
document.body.removeChild(tempInput);
|
||
} else {
|
||
console.log('临时输入框不是 body 的子节点,无法移除。');
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
handelTxid(txid){
|
||
if (this.accountItem.coin.includes(`dgb`)) {
|
||
window.open(`https://chainz.cryptoid.info/dgb/tx.dws?${txid}.htm`)
|
||
|
||
}else{
|
||
switch (this.accountItem.coin) {
|
||
case `nexa`:
|
||
window.open(`https://explorer.nexa.org/tx/${txid}`)
|
||
break;
|
||
case `mona`:
|
||
window.open(`https://mona.insight.monaco-ex.org/insight/tx/${txid}`)
|
||
break;
|
||
case `grs`:
|
||
window.open(`https://chainz.cryptoid.info/grs/tx.dws?${txid}.htm`)
|
||
break;
|
||
case `rxd`:
|
||
window.open(`https://explorer.radiantblockchain.org/tx/${txid}`)
|
||
break;
|
||
case `enx`:
|
||
window.open(`https://explorer.entropyx.org/txs/${txid}`)
|
||
break;
|
||
case `alph`:
|
||
window.open(`https://explorer.alephium.org/transactions/${txid}`)
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//
|
||
}
|
||
|
||
}
|
||
} |