fix:修改全屏时间回显不正确 以及 修改 chart比较 因为前后数量不同导致的bug

This commit is contained in:
zhangyu
2021-03-31 11:10:04 +08:00
parent 21a31be44f
commit 7203d5bb3f
15 changed files with 1767 additions and 1757 deletions

View File

@@ -149,6 +149,7 @@ export default {
echart: null,
echartScreen: null,
bgColorList: [],
stableFilter: {},
option: {
title: {
show: false
@@ -296,7 +297,7 @@ export default {
this.searchTime = []
this.$set(this.searchTime, 0, this.oldSearchTime[0])
this.$set(this.searchTime, 1, this.oldSearchTime[1])
// this.$refs.calendarPanel.setCustomTime(this.searchTime);
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.stableFilter)
this.screenModal = true
},
resize (chartItem) {
@@ -304,6 +305,9 @@ export default {
},
// 设置数据, filter区分
setData (chartItem, seriesItem, panelId, filter, legend, area, errorMsg) {
if (filter) {
this.stableFilter = filter
}
if (errorMsg && errorMsg !== '') {
this.isError = true
this.errorContent = errorMsg

View File

@@ -123,6 +123,7 @@ export default {
start_time: '',
end_time: ''
},
stableFilter: {},
firstShow: false, // 默认不显示操作按钮,
caretShow: false,
dragTitleShow: false,
@@ -387,7 +388,7 @@ export default {
this.searchTime = []
this.$set(this.searchTime, 0, this.oldSearchTime[0])
this.$set(this.searchTime, 1, this.oldSearchTime[1])
// this.$refs.calendarPanel.setCustomTime(this.searchTime);
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.stableFilter)
this.seriesItemScreen = this.seriesItem
this.screenModal = true
@@ -397,6 +398,9 @@ export default {
},
// 设置数据, filter区分
setData (chartItem, seriesItem, panelId, filter, area, errorMsg) {
if (filter) {
this.stableFilter = filter
}
if (errorMsg && errorMsg !== '') {
this.isError = true
this.errorContent = errorMsg

View File

@@ -369,13 +369,16 @@ export default {
this.searchTime = []
this.$set(this.searchTime, 0, this.oldSearchTime[0])
this.$set(this.searchTime, 1, this.oldSearchTime[1])
// this.$refs.calendarPanel.setCustomTime(this.searchTime);
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.stableFilter)
this.seriesItemScreen = this.seriesItem
this.screenModal = true
},
// 设置数据, filter区分
setData (chartItem, seriesItem, panelId, filter, area, errorMsg) {
if (filter) {
this.stableFilter = filter
}
if (errorMsg && errorMsg !== '') {
this.isError = true
this.errorContent = errorMsg

View File

@@ -572,7 +572,6 @@ export default {
this.chartType = 'line'
}
const minusTime = (new Date(this.searchTime[0]).getTime() - new Date(this.$refs.pickTime.$refs.multipleTime.searchTime[0]).getTime())
const minusFlag = this.$refs.pickTime && this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length
let minTime = null
let maxTime = null
if (dataArg.length > 0 && dataArg[0].data &&
@@ -733,6 +732,7 @@ export default {
formatter: function (params) {
let str = '<div>'
let sum = 0
let minusFlag = true
params.forEach((item, i) => {
const tip = legend[item.seriesIndex]
const color = self.bgColorList[item.seriesIndex]
@@ -743,12 +743,13 @@ export default {
str += bus.timeFormate(tData)
str += '</div>'
}
if (i === params.length / 2 && tip.alias.indexOf('process_') !== -1) {
if (tip.alias.indexOf('process_') !== -1 && minusFlag) {
const value = item.data[0] - minusTime
const tData = new Date(value)
str += '<div style="margin-bottom: 5px;margin-top: 5px">'
str += bus.timeFormate(tData)
str += '</div>'
minusFlag = false
}
let val = item.data[1] ? parseFloat(Number(item.data[1]).toFixed(2)) : ''
if (val === 0) {
@@ -1367,11 +1368,10 @@ export default {
// this.searchTime = this.oldSearchTime;
this.$set(this.searchTime, 0, this.oldSearchTime[0])
this.$set(this.searchTime, 1, this.oldSearchTime[1])
// this.$refs.calendarPanel.setCustomTime(this.searchTime);
this.screenModal = true
this.isGreyScreen = []
this.$refs.pickTime.$refs.multipleTime.searchTime = []
// this.$refs.pickTime.$refs.timerPick.setCustomTime(this.searchTime)
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.stableFilter)
this.seriesItemScreen = this.seriesItem
// this.seriesItemScreen = this.seriesItem;
/*
@@ -1489,7 +1489,6 @@ export default {
}
// 一个图表
axios.all(axiosArr).then((res) => {
console.log(res)
if (res.length > 0) {
const series = []
const legend = []
@@ -1626,10 +1625,15 @@ export default {
console.log(series)
const minusTime = (new Date(this.searchTime[0]).getTime() - new Date(this.$refs.pickTime.$refs.multipleTime.searchTime[0]).getTime())
console.log(minusTime)
if (this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) {
if (this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length && res.length > this.data.elements.length) {
let cutPoint = 0
res.forEach((item, index) => {
if (index < res.length / 2) {
cutPoint += res[index].data.result.length
}
})
series.forEach((item, index) => {
if (index >= series.length / 2) {
console.log(123123);
if (index >= cutPoint) {
series[index].data.forEach((item1, index1) => {
item1[0] = item1[0] + minusTime
})

View File

@@ -856,7 +856,7 @@ const cn = {
lat: '纬度',
lng: '经度',
zoom: '缩放',
lnglat:'坐标',
lnglat: '坐标'
},
email: {
email: '邮件',

View File

@@ -26,7 +26,7 @@
import icon from 'leaflet/dist/images/marker-icon.png'
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
export default {
name: "latlngPicker",
name: 'latlngPicker',
props: {
initData: { type: Object },
appendToBody: { type: Boolean, default: true },
@@ -34,20 +34,20 @@
},
data () {
return {
lnglat:"",
lnglat: '',
mapParam: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 },
map: null,
marker: null,
mapConfigVisible: false,
mapConfigVisible: false
}
},
created () {
if (this.initData) {
this.mapParam = JSON.parse(JSON.stringify(this.initData));
this.mapParam = JSON.parse(JSON.stringify(this.initData))
} else {
this.queryDefaultMapConfig();
this.queryDefaultMapConfig()
}
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
},
mounted () {
},
@@ -57,7 +57,7 @@
this.map.remove()
this.map = null
}
this.setLatlng();
this.setLatlng()
const DefaultIcon = L.icon({
iconUrl: icon,
iconSize: [26, 40],
@@ -102,31 +102,31 @@
mapClose: function () {
this.mapConfigVisible = false
const latlng = this.marker.getLatLng()
this.mapParam.longitude = latlng.lng.toFixed(3);
this.mapParam.latitude = latlng.lat.toFixed(3);
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
this.mapParam.longitude = latlng.lng.toFixed(3)
this.mapParam.latitude = latlng.lat.toFixed(3)
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
this.mapParam.zoom = this.map.getZoom();
this.mapParam.zoom = this.map.getZoom()
},
setLatlng: function () {
let lnglat = this.lnglat.split(",");
const lnglat = this.lnglat.split(',')
this.mapParam.longitude = lnglat[0]
this.mapParam.latitude = lnglat[1]
},
getAttribute: function () {
return JSON.parse(JSON.stringify(this.mapParam));
return JSON.parse(JSON.stringify(this.mapParam))
},
setLnglat: function (lat, lng) {
if (lat && lng) {
this.mapParam.latitude=lat;
this.mapParam.longitude =lng;
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
this.mapParam.latitude = lat
this.mapParam.longitude = lng
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
}
},
queryDefaultMapConfig: function () {
this.$get("/sysConfig?paramKey=map_center_config").then(response=>{
this.$get('/sysConfig?paramKey=map_center_config').then(response => {
if (response.code == 200) {
this.mapParam = JSON.parse(response.data.paramKey.map_center_config);
this.mapParam = JSON.parse(response.data.paramKey.map_center_config)
}
})
}

View File

@@ -1164,7 +1164,7 @@ export default {
},
onMessage (event, data, e) {
console.log('onMessage', event, data);
console.log('onMessage', event, data)
// console.log(getTopology(this.topologyIndex))
// this.notModuleIDArr=[];
this.toolShow.attr = false

View File

@@ -1164,7 +1164,7 @@
},
onMessage (event, data, e) {
console.log('onMessage', event, data);
console.log('onMessage', event, data)
// console.log(getTopology(this.topologyIndex))
// this.notModuleIDArr=[];
this.toolShow.attr = false

View File

@@ -70,7 +70,7 @@
</template>
<script>
import latlngPicker from "../latlngPicker";
import latlngPicker from '../latlngPicker'
const regNum = /^[0-9]+.?[0-9]*/
export default {
name: 'dcBox',
@@ -119,9 +119,9 @@ export default {
if (valid) {
if (this.editDc.id) {
const param = { ...this.editDc }
let attr = this.$refs.latlngPicker.getAttribute();
param.latitude = attr.latitude;
param.longitude = attr.longitude;
const attr = this.$refs.latlngPicker.getAttribute()
param.latitude = attr.latitude
param.longitude = attr.longitude
this.$put('idc', param).then(response => {
this.prevent_opt.save = false
if (response.code === 200) {
@@ -211,7 +211,7 @@ export default {
handler (n, o) {
this.editDc = JSON.parse(JSON.stringify(n))
this.$nextTick(() => {
this.$refs.latlngPicker.setLnglat(this.editDc.latitude,this.editDc.longitude);
this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude)
})
}
}

View File

@@ -262,38 +262,32 @@ export default {
},
setCustomTime (timeGroup) {
console.log(timeGroup)
if (!timeGroup[2] || timeGroup.length === 2) {
this.$set(this.searchTime, 0, timeGroup[0])
this.$set(this.searchTime, 1, timeGroup[1])
this.nowTimeType = {
id: 0,
text: this.$t('dashboard.panel.customTimeRange')
}
this.$set(this.showTime, 'id', this.nowTimeType.id)
this.$set(this.showTime, 'text', this.nowTimeType.text)
} else if (timeGroup[2]) {
const type = timeGroup[2].substr(timeGroup[2].length - 1, 1)
const value = timeGroup[2].substr(0, timeGroup[2].length - 1)
if (value == 30 && type === 'd') {
if (timeGroup) {
this.showTime = this.nowTimeType = this.timeData.find(item => item.id == timeGroup.id)
if (this.showTime) {
this.$set(this.searchTime, 0, timeGroup.start_time)
this.$set(this.searchTime, 1, timeGroup.end_time)
} else {
this.showTime = this.nowTimeType = {
id: 11,
text: this.$t('dashboard.panel.lastThirtyDay'),
type: 'date',
value: 30
id: 4,
text: this.$t('dashboard.panel.lastOneHour'),
type: 'hour',
value: 1
}
} else if (value == 30 && type === 'm') {
this.showTime = this.nowTimeType = {
id: 3,
text: this.$t('dashboard.panel.lastThirtyMin'),
type: 'minute',
value: 30
const time = bus.getTimezontDateRange()
this.$set(this.searchTime, 0, time[0])
this.$set(this.searchTime, 1, time[1])
}
} else {
this.showTime = this.nowTimeType = this.timeData.find(item => item.value == value)
this.showTime = this.nowTimeType = {
id: 4,
text: this.$t('dashboard.panel.lastOneHour'),
type: 'hour',
value: 1
}
this.$set(this.showTime, 'id', this.nowTimeType.id)
this.$set(this.showTime, 'text', this.nowTimeType.text)
const time = bus.getTimezontDateRange()
this.$set(this.searchTime, 0, time[0])
this.$set(this.searchTime, 1, time[1])
}
},
// left(){},

View File

@@ -356,7 +356,7 @@
<script>
import { positiveInteger, port, hostPlus, host, uSize } from '../../common/js/validate'
import latlngPicker from "../../common/latlngPicker";
import latlngPicker from '../../common/latlngPicker'
import bus from '../../../libs/bus'
import draggable from 'vuedraggable'
@@ -588,7 +588,7 @@ export default {
if (valid) {
const param = {}
if (type == 'basic') {
this.basic.map_center_config = this.$refs.latlngPicker.getAttribute();
this.basic.map_center_config = this.$refs.latlngPicker.getAttribute()
this.basic.map_center_config = JSON.stringify(this.basic.map_center_config)
}
param[type] = Object.assign({}, this[type])

View File

@@ -394,6 +394,7 @@ export default {
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss')
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss')
this.filter.value = this.searchTime[2]
this.filter.id = this.$refs.pickTime.$refs.timePicker.showTime.id
this.getTableData()
this.getData(this.filter)
},