深基坑(echarts):y轴最大值最小值报警线处理

This commit is contained in:
骆乐 2022-10-14 09:58:18 +08:00
parent bc49ff3df2
commit 7746171721
3 changed files with 35 additions and 94 deletions

BIN
dist.zip

Binary file not shown.

View File

@ -41,6 +41,7 @@ if (process.env.NODE_ENV == 'development') {
// tag: 本地
// axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地
axios.defaults.baseURL = 'http://192.168.34.216:6023/' // 邱平毅本地
// axios.defaults.baseURL = 'http://192.168.34.216:6024/'
// axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 河南春笋
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上
// axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1

View File

@ -703,8 +703,10 @@ export default {
xAxis: [],
data: [],
},
max:'',
min:'',
max: -999999,
min: 999999,
max1: -999999,
min1: 999999,
};
},
created() {
@ -722,40 +724,6 @@ export default {
// this.createdEchart5()
},
methods: {
//
selectDeepExcavationCurrentDataList(val) {
console.log('默认第一次带sn了吗',this.checkList2)
selectDeepExcavationCurrentDataListApi({
measurePointNumber: this.checkList,
relaId: this.relaId,
projectSn: this.projectSn,
sensorSn: val ,
startTime: this.dateTime != null ? this.dateTime[0] : "",
endTime: this.dateTime != null ? this.dateTime[1] : "",
pageNo:this.pageNo1,
pageSize:this.pageSize1,
}).then(res => {
this.max = res.result.alarmValue;
this.min = res.result.alarmValue * ('-1');
this.unit = res.result.unit;
console.log("默认第一次进来的时候单位", this.unit)
if (res.code == 200 && res.result) {
this.total1 = res.result.data.total
this.tableData2 = res.result.data.records;
this.echartData7 = {
xAxis: [],
data: []
};
res.result.data.records.forEach(item => {
this.echartData7.xAxis.unshift(item.receiveTime);
this.echartData7.data.unshift(item.data);
});
this.$nextTick(() => {
this.createdEchart7();
});
}
});
},
//
selectDeepExcavationAllMeasurePointList() {
selectDeepExcavationAllMeasurePointListApi({
@ -1403,7 +1371,6 @@ export default {
// },
//
showDetail(val) {
console.log('点击获取详情',this.unit)
this.dateTime = []
this.pageSize1= 10,
this.pageNo= 1,
@ -1418,13 +1385,11 @@ export default {
},
handleSizeChange1(val) {
this.pageSize1 = val;
console.log('分页',val);
this.selectDeepExcavationCurrentDataList(this.checkList2);
this.getEchartsData(this.checkList2);
},
handleCurrentChange1(val) {
this.pageNo1 = val;
console.log('分页分页',val);
this.selectDeepExcavationCurrentDataList(this.checkList2);
this.getEchartsData(this.checkList2);
},
createdEchart5() {
// console.log(this.$refs['echart5'])
@ -1591,6 +1556,7 @@ export default {
let chart7 = echarts.init(this.$refs["echart7"]);
this.chart7 = chart7;
chart7.clear();
let that = this;
this.option7 = {
tooltip: {
trigger: "axis",
@ -1634,22 +1600,14 @@ export default {
}
},
yAxis: {
type: "value",
// scale:true,
// max:this.max + 1,
min:this.min -1,
// max:function(obj){//线
// var ma=obj.max;
// var mi=obj.min;
// var val=Math.ceil((ma+(ma-mi)/2))
// return val
// },
// min:function(obj){
// var ma=obj.max;
// var mi=obj.min;
// var val=Math.ceil((mi-(ma-mi)/2))
// return mi==0?0:val
// },
// type: "value",
scale:true,
max:function(obj){//线
return that.max + 1
},
min:function(obj){
return that.min - 1
},
name:`单位/${ this.unit }`,
boundaryGap: [0, '100%'],
splitLine: {
@ -1744,7 +1702,7 @@ export default {
position:'end',
formatter:'警戒线'
},
yAxis:this.max
yAxis:this.max1
},
{
silent:true,
@ -1757,29 +1715,9 @@ export default {
position:'end',
formatter:'警戒线'
},
yAxis:this.min
yAxis:this.min1
}]
}
// markLine:{
// data:[{
// symbol: 'none',
// yAxis: 100,
// }],
// lineStyle:{
// color: '#F92A08'
// },
// label:{
// position: 'insideStartTop',
// formatter: '{f|: 100}',
// rich:{
// f:{
// backgroundColor: 'rgba(249, 42, 8, 0.7)',
// color: '#fff',
// padding: [4, 60, 8, 8],
// }
// }
// },
// }
}
]
};
@ -1889,32 +1827,30 @@ export default {
if (this.getSensorList.length != 0) {
this.checkList2 = this.getSensorList[0].sensorSn;
console.log('默认的传感器编号',this.checkList2)
// this.selectDeepExcavationCurrentDataList(this.checkList2)
this.getEchartsData()
// this.$nextTick(()=>{
// this.createdEchart7()
// })
this.getEchartsData(this.checkList2)
}
}
});
},
//
getEchartsData() {
selectDeepExcavationCurrentDataListApi({
async getEchartsData(val) {
await selectDeepExcavationCurrentDataListApi({
measurePointNumber: this.checkList,
relaId: this.relaId,
sensorSn: this.checkList2 ,
sensorSn: val,
projectSn: this.projectSn,
startTime: this.dateTime != null ? this.dateTime[0] : "",
endTime: this.dateTime != null ? this.dateTime[1] : "",
pageNo:this.pageNo1,
pageSize:this.pageSize1,
}).then(res => {
console.log('单位',res.result.unit)
console.log('返回值',res)
this.unit = res.result.unit
// console.log('',this.unit )
this.max = res.result.alarmValue;
this.min = res.result.alarmValue * ('-1');
this.max = res.result.positiveAlarmValue;
this.min = res.result.positiveAlarmValue * ('-1');
this.max1 = res.result.positiveAlarmValue;
this.min1 = res.result.negativeAlarmValue;
// debugger
if (res.code == 200 && res.result) {
this.total1 = res.result.data.total
this.tableData2 = res.result.data.records;
@ -1923,10 +1859,15 @@ export default {
data: []
};
res.result.data.records.forEach(item => {
if(this.max < item.data){
this.max = item.data
}
if(this.min > item.data){
this.min = item.data
}
this.echartData7.xAxis.unshift(item.receiveTime);
this.echartData7.data.unshift(item.data);
});
// console.log('===========', this.echartData7.xAxis[0].split(' ')[0])
this.$nextTick(() => {
this.createdEchart7();
});
@ -1941,7 +1882,7 @@ export default {
type: "warning"
});
}
this.selectDeepExcavationCurrentDataList(this.checkList2);
this.getEchartsData(this.checkList2);
}
},
watch: {
@ -1949,7 +1890,6 @@ export default {
handler(newval, oldval) {
if (newval != oldval) {
console.log('新旧',newval, oldval)
this.getEchartsData();
this.checkList2=""
}
},