fix: 修改 值为 “0” 对取最大值的影响

This commit is contained in:
zhangyu
2022-03-25 16:37:24 +08:00
parent f2b055f20f
commit 4e343d7137
4 changed files with 16 additions and 7 deletions

View File

@@ -133,9 +133,14 @@ export default {
}) })
minTime = timeSorted.length ? timeSorted[0][0] : '' minTime = timeSorted.length ? timeSorted[0][0] : ''
maxTime = timeSorted.length ? timeSorted[timeSorted.length - 1][0] : '' maxTime = timeSorted.length ? timeSorted[timeSorted.length - 1][0] : ''
minValue = valueSorted.length ? valueSorted[0][1] : '' minValue = valueSorted.length ? valueSorted[0][1] : 0
maxValue = valueSorted.length ? valueSorted[valueSorted.length - 1][1] : '' maxValue = valueSorted.length ? valueSorted[valueSorted.length - 1][1] : 0
const unit = chartDataFormat.getUnit(chartUnit) const unit = chartDataFormat.getUnit(chartUnit)
if (!isNaN(maxValue)) {
maxValue = Number(maxValue)
} else {
maxValue = 0
}
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii) // 取最大值后 需要对其进行取整 maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii) // 取最大值后 需要对其进行取整
let oldValue = maxValue let oldValue = maxValue
let dot = 0 let dot = 0
@@ -154,7 +159,8 @@ export default {
maxValue = Math.floor(oldValue) / Math.pow(10, dot) maxValue = Math.floor(oldValue) / Math.pow(10, dot)
dot++ dot++
} }
const copies = chartDataFormat.copies(oldValue, unit.type) console.log(oldValue)
const copies = chartDataFormat.copies(Number(oldValue), unit.type)
return { minTime, maxTime, minValue, maxValue, copies, unit, dot } return { minTime, maxTime, minValue, maxValue, copies, unit, dot }
}, },
xAxisLabelFormatter (minTime, maxTime) { xAxisLabelFormatter (minTime, maxTime) {

View File

@@ -790,6 +790,9 @@ export default {
} }
}, },
Interval: function (value, copies, type, interValType) { Interval: function (value, copies, type, interValType) {
if (!copies) {
copies = 1
}
if (interValType === 'max' && value < 1) { if (interValType === 'max' && value < 1) {
if (value < 1) { if (value < 1) {
value = 1 value = 1

View File

@@ -23,7 +23,7 @@
id="asset-list" id="asset-list"
:params="filter" :params="filter"
:params-type="paramsType" :params-type="paramsType"
:permissions="{import: 'main_add', export: 'panel_edit'}" :permissions="{import: 'main_add', export: 'main_edit'}"
class="top-tool-export margin-r-10" class="top-tool-export margin-r-10"
export-file-name="asset-charts" export-file-name="asset-charts"
export-url="visual/panel/export" export-url="visual/panel/export"
@@ -60,8 +60,8 @@
:showLock="from === fromRoute.endpoint" :showLock="from === fromRoute.endpoint"
class="top-tool-export margin-r-10" class="top-tool-export margin-r-10"
export-file-name="endpoint-charts" export-file-name="endpoint-charts"
export-url="visual/panel/export" :export-url="'visual/panel/export'"
import-url="visual/panel/import" :import-url="'visual/panel/import'"
@afterImport="getTableData" @afterImport="getTableData"
@panelLockChange="panelLockChange" @panelLockChange="panelLockChange"
> >

View File

@@ -13,7 +13,7 @@
<div id="chart-import" @click="showImportBox(1)"><i class="nz-icon nz-icon-upload"></i>{{$t('overall.importExcel')}}</div> <div id="chart-import" @click="showImportBox(1)"><i class="nz-icon nz-icon-upload"></i>{{$t('overall.importExcel')}}</div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-has="permissions.export" v-if="exportUrl"> <el-dropdown-item v-has="permissions.export" v-if="exportUrl">
<div id="chart-export"@click="showImportBox(2)"><i class="nz-icon nz-icon-download1"></i>{{$t('overall.exportExcel')}}</div> <div id="chart-export" @click="showImportBox(2)"><i class="nz-icon nz-icon-download1"></i>{{$t('overall.exportExcel')}}</div>
</el-dropdown-item> </el-dropdown-item>
<!-- importexport之后的内容 --> <!-- importexport之后的内容 -->
<slot name="after"></slot> <slot name="after"></slot>