@@ -80,9 +123,14 @@
-
+
{{ item.text }}
@@ -230,7 +278,7 @@ const handlerCommand = (item: OptButton) => {
margin-left: 6px;
}
-.ml-6+.el-button {
+.ml-6 + .el-button {
margin-left: 6px;
}
diff --git a/src/utils/echartMethod.ts b/src/utils/echartMethod.ts
index 17843d6..000a444 100644
--- a/src/utils/echartMethod.ts
+++ b/src/utils/echartMethod.ts
@@ -4,8 +4,50 @@ const dataProcessing = (arr: any[]) => {
.map(item => (typeof item === 'number' ? item : parseFloat(item)))
}
+const calculateValue = (o:number,value: number, num: number, isMin: boolean) => {
+ if (value === 0) {
+ return 0
+ }else if(value>0&& Math.abs(value)<1 && isMin==true){
+ return 0
+ }else if(value>-1&& value<0 && isMin==false){
+ return 0
+ }
+ let base
+ if (Math.abs(o) >= 100) {
+ base = 100
+ } else if (Math.abs(o) >= 10) {
+ base = 10
+ } else if (Math.abs(o) >= 1) {
+ base = 1
+ } else {
+ base = 0.1
+ }
+ let calculatedValue
+ if (isMin) {
+ if (value < 0) {
+ calculatedValue = value + num * value
+ } else {
+ calculatedValue = value - num * value
+ }
+ } else {
+ if (value < 0) {
+ calculatedValue = value - num * value
+ } else {
+ calculatedValue = value + num * value
+ }
+ }
+ if (base === 0.1) {
+ return parseFloat(calculatedValue.toFixed(1))
+ } else if (isMin) {
+ return Math.floor(calculatedValue / base) * base
+ } else {
+ return Math.ceil(calculatedValue / base) * base
+ }
+}
+
// 处理y轴最大最小值
export const yMethod = (arr: any) => {
+ let num = 0.2
let numList = dataProcessing(arr)
let maxValue = 0
let minValue = 0
@@ -13,35 +55,80 @@ export const yMethod = (arr: any) => {
let min = 0
maxValue = Math.max(...numList)
minValue = Math.min(...numList)
- if (maxValue > 1000 || minValue < -1000) {
- max = Math.ceil(maxValue / 100) * 100
- if (minValue == 0) {
- min = 0
- } else {
- min = Math.floor(minValue / 100) * 100
- }
- } else if (maxValue < 60 && minValue > 40) {
- max = 60
- min = 40
- } else if (maxValue == minValue && maxValue < 10 && minValue > 0) {
- max = Math.ceil(maxValue / 10) * 10
- min = Math.floor(minValue / 10) * 10
- } else if (maxValue == minValue && maxValue != 0 && minValue != 0) {
- max = Math.ceil(maxValue / 10 + 1) * 10
- min = Math.floor(minValue / 10 - 1) * 10
- } else {
- max = Math.ceil(maxValue / 10) * 10
- min = Math.floor(minValue / 10) * 10
- }
+ const o=maxValue-minValue
+ min = calculateValue( o,minValue, num, true)
+ max = calculateValue(o,maxValue, num, false)
+ // if (-100 >= minValue) {
+ // min = Math.floor((minValue + num * minValue) / 100) * 100
+ // } else if (-10 >= minValue && minValue > -100) {
+ // min = Math.floor((minValue + num * minValue) / 10) * 10
+ // } else if (-1 >= minValue && minValue > -10) {
+ // min = Math.floor(minValue + num * minValue)
+ // } else if (0 > minValue && minValue > -1) {
+ // min = parseFloat((minValue + num * minValue).toFixed(1))
+ // } else if (minValue == 0) {
+ // min = 0
+ // } else if (0 < minValue && minValue < 1) {
+ // min = parseFloat((minValue - num * minValue).toFixed(1))
+ // } else if (1 <= minValue && minValue < 10) {
+ // min = Math.floor(minValue - num * minValue)
+ // } else if (10 <= minValue && minValue < 100) {
+ // min = Math.floor((minValue - num * minValue) / 10) * 10
+ // } else if (100 <= minValue) {
+ // min = Math.floor((minValue - num * minValue) / 100) * 100
+ // }
+
+ // if (-100 >= maxValue) {
+ // max = Math.ceil((maxValue - num * maxValue) / 100) * 100
+ // } else if (-10 >= maxValue && maxValue > -100) {
+ // max = Math.ceil((maxValue - num * maxValue) / 10) * 10
+ // } else if (-1 >= maxValue && maxValue > -10) {
+ // max = Math.ceil(maxValue - num * maxValue)
+ // } else if (0 > maxValue && maxValue > -1) {
+ // max = parseFloat((maxValue - num * maxValue).toFixed(1))
+ // } else if (maxValue == 0) {
+ // max = 0
+ // } else if (0 < maxValue && maxValue < 1) {
+ // max = parseFloat((maxValue + num * maxValue).toFixed(1))
+ // } else if (1 <= maxValue && maxValue < 10) {
+ // max = Math.ceil(maxValue + num * maxValue)
+ // } else if (10 <= maxValue && maxValue < 100) {
+ // max = Math.ceil((maxValue + num * maxValue) / 10) * 10
+ // } else if (100 <= maxValue) {
+ // max = Math.ceil((maxValue + num * maxValue) / 100) * 100
+ // }
+
+ // if (maxValue > 1000 || minValue < -1000) {
+ // max = Math.ceil(maxValue / 100) * 100
+ // if (minValue == 0) {
+ // min = 0
+ // } else {
+ // min = Math.floor(minValue / 100) * 100
+ // }
+ // } else if (maxValue < 60 && minValue > 40) {
+ // max = 60
+ // min = 40
+ // } else if (maxValue == minValue && maxValue < 10 && minValue > 0) {
+ // max = Math.ceil(maxValue / 10) * 10
+ // min = Math.floor(minValue / 10) * 10
+ // } else if (maxValue == minValue && maxValue != 0 && minValue != 0) {
+ // max = Math.ceil(maxValue / 10 + 1) * 10
+ // min = Math.floor(minValue / 10 - 1) * 10
+ // } else {
+ // max = Math.ceil(maxValue / 10) * 10
+ // min = Math.floor(minValue / 10) * 10
+ // }
+
+ // if (maxValue > 0 && maxValue < 1) {
+ // max = 1
+ // } else if (max == 0 && minValue > -1 && minValue < 0) {
+ // min = -1
+ // }
- if (maxValue > 0 && maxValue < 1) {
- max = 1
- } else if (max == 0 && minValue > -1 && minValue < 0) {
- min = -1
- }
return [min, max]
}
+
/**
* title['A相','B相',]
* data[[1,2],[3,4]]
diff --git a/src/views/govern/manage/factory.vue b/src/views/govern/manage/factory.vue
index 7191e2f..83c2003 100644
--- a/src/views/govern/manage/factory.vue
+++ b/src/views/govern/manage/factory.vue
@@ -283,6 +283,7 @@ const tableStore = new TableStore({
},
{ title: '设备名称', field: 'name' },
{ title: '网络设备ID', field: 'ndid' },
+
{
title: '设备类型',
field: 'devType',
@@ -305,7 +306,7 @@ const tableStore = new TableStore({
return row.cellValue === 'MQTT' ? 'MQTT' : row.cellValue === 'CLD' ? 'CLD' : row.cellValue
}
},
- { title: '录入时间', field: 'createTime',sortable: true },
+ { title: '录入时间', field: 'createTime', sortable: true },
{
title: '使用状态',
@@ -352,6 +353,21 @@ const tableStore = new TableStore({
})
}
},
+ // { title: 'MQTT状态', field: 'connectStatus', width: 100, },
+ {
+ title: 'MQTT状态',
+ field: 'connectStatus',
+ width: 100,
+ render: 'tag',
+ custom: {
+ 未连接: 'danger',
+ 已连接: 'success'
+ },
+ replaceValue: {
+ 未连接: '未连接',
+ 已连接: '已连接'
+ }
+ },
{
title: '通讯状态',
field: 'runStatus',
@@ -360,20 +376,11 @@ const tableStore = new TableStore({
custom: {
1: 'danger',
2: 'success'
- // 3: 'primary',
- // 4: 'primary',
- // 5: 'warning'
},
replaceValue: {
1: '离线',
2: '在线'
- // 3: '接入',
- // 4: '已取消',
- // 5: '未接入'
}
- // formatter: row => {
- // return row.cellValue == 1 ? '未注册' : row.cellValue == 2 ? '注册' : '接入'
- // },
},
{