Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3
# Conflicts: # nezha-fronted/src/components/chart/panelChart.vue
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<!-- <span class="project-name">{{item.name}}</span>-->
|
||||
<topology
|
||||
:fromOverView="true"
|
||||
:from-chart="true"
|
||||
:obj="item"
|
||||
:ref="'topology' + index"
|
||||
:topologyIndexF="isFullscreen?('screen'+chartInfo.id+'-'+index):(chartInfo.id+'-'+index)"
|
||||
|
||||
@@ -310,12 +310,23 @@ export default {
|
||||
}
|
||||
const chartData = []
|
||||
const params = {
|
||||
t: this.chartInfo.id,
|
||||
q: encodeURIComponent(JSON.stringify(q)),
|
||||
stat: startTime,
|
||||
end: endTime,
|
||||
resultType: 'matrix'
|
||||
}
|
||||
this.$get('/stat', params).then(res => {
|
||||
// this.$get('/stat', params).then(res => {
|
||||
// if (res.code === 200) {
|
||||
// chartData.push(res.data.result)
|
||||
// } else {
|
||||
// chartData.push({ error: res.msg || res.error || res })
|
||||
// this.isError = true
|
||||
// }
|
||||
// this.chartData = chartData
|
||||
// this.loading = false
|
||||
// })
|
||||
this.sendAjax('/stat', params).then(res => {
|
||||
if (res.code === 200) {
|
||||
chartData.push(res.data.result)
|
||||
} else {
|
||||
@@ -530,6 +541,41 @@ export default {
|
||||
color = '#23bf9a'
|
||||
}
|
||||
return color
|
||||
},
|
||||
sendAjax (url, params) {
|
||||
// 构造表单数据
|
||||
return new Promise(resolve => {
|
||||
let nowUrl = url
|
||||
Object.keys(params).forEach((key, index) => {
|
||||
if (index == 0) {
|
||||
nowUrl += '?' + key + '=' + params[key]
|
||||
} else {
|
||||
nowUrl += '&' + key + '=' + params[key]
|
||||
}
|
||||
})
|
||||
const formData = new FormData()
|
||||
formData.append('username', 'johndoe')
|
||||
formData.append('id', 123456)
|
||||
// 创建xhr对象
|
||||
const xhr = new XMLHttpRequest()
|
||||
// 设置xhr请求的超时时间
|
||||
xhr.timeout = 3000
|
||||
// 设置响应返回的数据格式
|
||||
xhr.responseType = ''
|
||||
// 创建一个 post 请求,采用异步
|
||||
xhr.open('get', 'http://192.168.44.100/' + nowUrl, true)
|
||||
xhr.setRequestHeader('Authorization', localStorage.getItem('nz-token'));
|
||||
// 注册相关事件回调处理函数
|
||||
xhr.onload = function (e) {
|
||||
if (this.status == 200 || this.status == 304) {
|
||||
// alert(this.responseText)
|
||||
resolve(JSON.parse(this.responseText))
|
||||
}
|
||||
}
|
||||
xhr.onerror = function(e) { console.log(e) };
|
||||
// 发送数据
|
||||
xhr.send()
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -762,7 +762,6 @@ export default {
|
||||
document.body.style.height = 'auto'
|
||||
// document.getElementsByTagName('html')[0].style.overflow = 'visible'
|
||||
const position = dom.getBoundingClientRect()
|
||||
console.log(position)
|
||||
this.getPdf(dom, -1 * position.left, -1 * position.top,this.searchTime)
|
||||
// this.getPdf(dom, 0, 0)
|
||||
}, 2000)
|
||||
|
||||
@@ -31,7 +31,6 @@ export default {
|
||||
// a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
|
||||
const imgWidth = 595.28
|
||||
const imgHeight = 592.28 / contentWidth * contentHeight
|
||||
console.log(canvas)
|
||||
// canvas.paddingTop = '30px'
|
||||
const pageDataImg = canvas.toDataURL('image/jpeg', 1.0)
|
||||
const img = new Image()
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
<!--画布部分-->
|
||||
<div :id="'topology-canvas' + topologyIndexF" :ref="'topology-canvas'+ topologyIndexF" class="full" @contextmenu="onContextMenu($event)"></div>
|
||||
<!--设置属性-->
|
||||
<div v-if="editTopologyFlag&&toolShow.attr" class="props">
|
||||
<div v-if="editTopologyFlag&&toolShow.attr && !fromOverView" class="props">
|
||||
<canvas-props ref="CanvasProps"
|
||||
:index="topologyIndex"
|
||||
:imgArr = 'tools'
|
||||
@@ -170,7 +170,7 @@
|
||||
@notModuleIDArrChange="notModuleIDArrChange">
|
||||
</canvas-props>
|
||||
</div>
|
||||
<div class="context-menu" v-if="contextmenu.left && editTopologyFlag && 0" :style="this.contextmenu">
|
||||
<div class="context-menu" v-if="contextmenu.left && editTopologyFlag && 0 && !fromOverView" :style="this.contextmenu">
|
||||
<CanvasContextMenu :index="topologyIndexF" :props.sync="props"></CanvasContextMenu>
|
||||
</div>
|
||||
<!--所有节点上的小图标-->
|
||||
@@ -1751,7 +1751,6 @@ export default {
|
||||
Promise.all(promiseArr).then((res2, header) => {
|
||||
this.iconArray = [...res.data.list]
|
||||
this.iconArray.forEach((item, index) => {
|
||||
console.log(res2[index])
|
||||
item.image = res2[index].data || res2[index]
|
||||
if (!getTopologyImg(item.id)) {
|
||||
setTopologyImg(item.id, item.image)
|
||||
|
||||
Reference in New Issue
Block a user