Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3

# Conflicts:
#	nezha-fronted/src/components/charts/chartDataFormat.js
#	nezha-fronted/src/components/page/asset/asset.vue
This commit is contained in:
zhangyu
2022-03-30 18:35:11 +08:00
7 changed files with 17 additions and 12 deletions

View File

@@ -309,7 +309,6 @@ export default {
this.chartChildrenData = flag this.chartChildrenData = flag
}, },
resize () { resize () {
console.log(this.$refs['chart' + this.chartInfo.id])
this.$refs['chart' + this.chartInfo.id] && this.$refs['chart' + this.chartInfo.id].resize() this.$refs['chart' + this.chartInfo.id] && this.$refs['chart' + this.chartInfo.id].resize()
}, },
refreshLogs (params) { refreshLogs (params) {

View File

@@ -341,7 +341,6 @@ export default {
} }
}, },
resize () { resize () {
console.log(213)
setTimeout(() => { setTimeout(() => {
getChart(this.chartId) && getChart(this.chartId).resize() getChart(this.chartId) && getChart(this.chartId).resize()
}, 100) }, 100)

View File

@@ -34,7 +34,7 @@ function percent02 (value, index) {
if (!numberWithEConvent(scientificNotationValue)) { if (!numberWithEConvent(scientificNotationValue)) {
return `${scientificNotationValue} %` return `${scientificNotationValue} %`
} }
value = parseFloat((Number(value) * 100)) value = parseFloat((Number(value) * 100).toFixed(2))
return `${value} %` return `${value} %`
} }
function localFormat (value, index) { function localFormat (value, index) {
@@ -728,7 +728,7 @@ export default {
pow++ pow++
value = value * 10 value = value * 10
} }
return Math.ceil(value + 1) / Math.pow(10, pow) return Math.floor(value + 1) / Math.pow(10, pow)
} }
if (type === 'Time') { if (type === 'Time') {
return value return value

View File

@@ -203,9 +203,9 @@ export const cancelWithChange = {
if (!binding.value || !binding.value.obj) return if (!binding.value || !binding.value.obj) return
const unsavedChange = localStorage.getItem('nz-unnsaved-change') const unsavedChange = localStorage.getItem('nz-unnsaved-change')
const oldValue = JSON.parse(JSON.stringify(binding.value.obj)) const oldValue = JSON.parse(JSON.stringify(binding.value.obj))
el.__newValue__ = oldValue
function domClick (e) { function domClick (e) {
const newValue = JSON.parse(JSON.stringify(binding.value.obj)) if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__)) {
if (unsavedChange == 'on' && !isEqual(oldValue, newValue)) {
MessageBox.confirm(i18n.t('tip.confirmCancel'), { MessageBox.confirm(i18n.t('tip.confirmCancel'), {
confirmButtonText: i18n.t('tip.yes'), confirmButtonText: i18n.t('tip.yes'),
cancelButtonText: i18n.t('tip.no'), cancelButtonText: i18n.t('tip.no'),
@@ -222,6 +222,9 @@ export const cancelWithChange = {
el.__vueDomClick__ = domClick el.__vueDomClick__ = domClick
el.addEventListener('click', domClick) el.addEventListener('click', domClick)
}, },
update (el, binding, vnode) {
el.__newValue__ = binding.value.obj
},
unbind: function (el, binding) { unbind: function (el, binding) {
// 解除事件监听 // 解除事件监听
document.removeEventListener('click', el.__vueDomClick__) document.removeEventListener('click', el.__vueDomClick__)

View File

@@ -6,7 +6,7 @@
<el-tab-pane :label="$t('project.topology.data')" name="1"> <el-tab-pane :label="$t('project.topology.data')" name="1">
<el-form v-model="selection.pen.data" class="pens-data" label-position="top"> <el-form v-model="selection.pen.data" class="pens-data" label-position="top">
<!--module--> <!--module-->
<el-form-item v-if="!selection.pen.type&&!fromDiagram" class="sub-box half-form-item" label="Module" <el-form-item v-if="!selection.pen.type&&!fromDiagram" class="sub-box half-form-item" :label="$t('overall.module')"
prop="moduleId"> prop="moduleId">
<el-select v-model="selection.pen.data.moduleId" :placeholder="$t('el.select.placeholder')" <el-select v-model="selection.pen.data.moduleId" :placeholder="$t('el.select.placeholder')"
:popper-append-to-body="true" popper-class="asset-dropdown right-box-select-top" size="small" :popper-append-to-body="true" popper-class="asset-dropdown right-box-select-top" size="small"
@@ -274,7 +274,7 @@
<!--</div>--> <!--</div>-->
<!--</el-collapse-item>--> <!--</el-collapse-item>-->
<!--样式--> <!--样式-->
<el-collapse-item :title="'Style'" name="4" v-if="selection.pen"> <el-collapse-item :title="$t('project.topology.style')" name="4" v-if="selection.pen">
<div class="flex flex-warp"> <div class="flex flex-warp">
<div class="props-pen-item" v-if="selection.pen&&!selection.pen.type"> <div class="props-pen-item" v-if="selection.pen&&!selection.pen.type">
@@ -650,7 +650,7 @@
</div> </div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item :title="'Font'" name="5" v-if="selection.pen&&!selection.pen.type"> <el-collapse-item :title="$t('project.topology.font')" name="5" v-if="selection.pen&&!selection.pen.type">
<div class="flex flex-warp"> <div class="flex flex-warp">
<div class="props-pen-item" style="width: 100%"> <div class="props-pen-item" style="width: 100%">
<div>{{ $t('project.topology.textContent') }}</div> <div>{{ $t('project.topology.textContent') }}</div>

View File

@@ -234,14 +234,18 @@ export default {
params.x = 0 params.x = 0
params.y = 0 params.y = 0
} }
if (!params.x && !params.y && params.groupId) { // group 内的坐标需要单独计算 if (isNaN(params.y) && isNaN(params.y) && params.groupId) { // group 内的坐标需要单独计算
params.x = 0 params.x = 0
params.y = 999 params.y = 999
} }
if (!params.x && !params.y) { if (isNaN(params.y) && isNaN(params.y)) {
params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x
params.y = this.chartLastPosition.y + 12 params.y = this.chartLastPosition.y + 12
} }
if (params.x + params.span > 12) {
params.x = 0
params.y += 1
}
delete params.panel delete params.panel
if (params.type === 'table') { if (params.type === 'table') {
delete params.param.tags delete params.param.tags

View File

@@ -104,7 +104,7 @@ Vue.mixin({
}, },
utcTimeToTimezoneStr: function (time) { utcTimeToTimezoneStr: function (time) {
if (time) { if (time) {
return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') return bus.timeFormate(time, localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss')
} else { } else {
return '-' return '-'
} }